opentreehole / backend Goto Github PK
View Code? Open in Web Editor NEWOpen Tree Hole 的后端项目
Open Tree Hole 的后端项目
Describe the question
前端无法从floor得到发送者的user id,故无法按照原有api发送penalty请求。
另外,处理举报时建议接受penalty等级,而非直接接受silent。
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
需要一个API,以查看某floor的编辑历史。
可以局限于管理员可用,也可以开放给所有用户使用,建议后者。
同时,floor应增加一个标记代表该帖是否曾被编辑过。
Describe alternatives you've considered
无
服务器未必会发送 csrf_token,需要进一步设置
客户端请求 logout,服务器应删除回收其 token
或者也可以不自动处理,而是引起管理员注意
对于不宜鼓励讨论等的内容,增加限流机制。
对于处于限流机制控制下的洞,具有以下特性:
以上三条特性可根据限流等级进行调配。
第三条特性可能涉及后端组装响应的顺序依据,但考虑到限流机制对社区的正面意义,为此付出的代码量是可以接受的。
Is your feature request related to a problem? Please describe.
API KEY 的生成机制迟迟没有提交,这是 APP 端认证用户的手段,属于最基本的功能,应当被优先解决。
Describe the solution you'd like
等待能否获得学校的oauth,在找到更好的认证方式之前,正式版将暂缓发布
Describe alternatives you've considered
此功能用于处理根据管理规范具有灵活性的部分违规言论。是特殊情况下,在各方面综合平衡考虑下的一个良好处理方案。
具体特性如下:
根据树洞用户需求,可以考虑添加一种删除或修改自己的言论的机制,但
对某一IP或某一用户短时间内大量请求;或载入时间非常早的帖子的请求进行人机验证
可以考虑ReCAPTCHA等第三方服务
现在向https://hole.hath.top/user/favorites 发送POST请求会返回404,是否是后端还没有添加增删收藏的功能?
另外,是否考虑在发送主题帖信息的时候携带一下用户是否收藏的信息?
Which feature would you want to enhance, and why?
floor加一个字段:特殊Tag
在 #6 中实现的发送 apns 通知功能,由于本地缺少 apns_key 而导致报错:
File "E:\CS\OpenTreeHole\api\utils.py", line 19, in <module>
apns_client = APNsClient('apns_key.pem', use_sandbox=(environ.get("HOLE_ENV") != "production"),
File "C:\Users\shi\.virtualenvs\OpenTreeHole\lib\site-packages\apns2\client.py", line 56, in __init__
self.__credentials = CertificateCredentials(credentials, password) # type: Credentials
File "C:\Users\shi\.virtualenvs\OpenTreeHole\lib\site-packages\apns2\credentials.py", line 37, in __init__
ssl_context = init_context(cert=cert_file, cert_password=password)
File "C:\Users\shi\.virtualenvs\OpenTreeHole\lib\site-packages\hyper\tls.py", line 131, in init_context
context.load_cert_chain(cert, password=cert_password)
FileNotFoundError: [Errno 2] No such file or directory
请 @KavinZhao 向团队成员提供此 key,或者设法解决此问题。
另提请各位开发者在本地环境发生变更时要及时说明并更新项目文档,否则会影响开发工作乃至生产环境的稳定性。
Describe the bug
被禁言用户试图发帖会导致内部错误
To Reproduce
先禁言用户,然后创建一个新的树洞
Version
dev-latest
Additional context
Exception Value: can't compare offset-naive and offset-aware datetimes
Exception Location: /www/backend/api/models.py, line 185, in is_silenced
Describe the bug
如果一个帖子被置顶,那么正常加载帖子时不应该再将此贴发给前端,不然会出现重复。
Version
dev-latest
Describe the question
实际使用中经常出现HTTP 429超过限速的情况,尤其是当用户快速翻页时
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
设计API直接隐藏一个主题帖
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
考虑到Secrets、证书私钥和APNS key等敏感数据存储在生产服务器上,必须部署SELinux以严格控制敏感文件访问权限。
具体细节可能需要进一步讨论,这个Issue先放在这里作为备忘录
目前所使用的[reply_to]方式仅能引用同一楼层内的一个帖子,但有时会遇到需要跨贴引用的情况(e.g. 如何评价某贴中的某回复)
因此,可以考虑新增如下功能:
虽然引用主要是前端渲染的事情,但理想情况下服务器应当将被引用的内容随原内容一起传给前端,以减少请求次数。
使用Celery
Describe the bug
点赞非自己发的帖子时会返回403并提示“您没有执行该操作的权限。”
To Reproduce
PUT请求https://hole.hath.top/floors/121939
payload为{like: "add"}
Version
dev-latest
Is your feature request related to a problem? Please describe.
为弥补某些发错、发重帖子,或恶意刷屏的行为,应设置删除主题帖的功能。
使用 websocket 实现通知实时推送
目前我们使用User Profile存储用户数据。这是旧版Django的推荐做法,现已不建议使用。
根据Django文档:
如果你准备启动一个新的项目,强烈推荐你设置一个自定义的用户模型,即使默认的用户模型对你来说已经足够了。这个模型的行为与默认用户模型相通,但是你能在未来需要的时候自定义它
在你已经建立数据库表之后再去修改 AUTH_USER_MODEL 要困难的多,因为它会影响外键和多对多关系。
因此,建议将Django内置的AUTH_USER_MODEL
替换为自定义模型,并加入用户数据的相关字段,而不是新开一个单独的Profile。这将使模型具有更强的可扩展性,并减少很多不必要的麻烦(例如User Profile不存在)等。
What happens when all random names are used up?
不应该在上传图片的commit message中包含上传者的id,否则可以通过社工等方式推理出用户真实身份。
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
需要一个API以在用户退出登录时删除push token
要不然用户必忘
APNsClient
instanceDescribe the bug
举报时发生内部错误
To Reproduce
POST http://hole.hath.top/reports
Version
dev-latest
Additional context
IntegrityError
(1048, "Column 'dealed_by_id' cannot be null")
逻辑上来说,帖子被举报似乎不需要获得通知,相比之下,被举报的帖子被处理,或者自己提交的举报被处理才需要获得通知。
Which feature would you want to enhance, and why?
signals.py 里面的代码没有单元测试
Describe the solution you'd like
为了更准确地识别开发团队和管理团队的公告帖子,应当允许为这些帖子添加一个标记。
此标记随Floor
发送给前端,由前端渲染为一个特殊的tag(或者其他用户无法伪造的方式),以方便用户辨别。
此标记还可以用于标注因违规而删除的帖子,以防用户伪造"该内容因违反社区规范而删除"的整活文字。
favorites 和 pinned holes 的 prefetch_length 似乎均为1,且无法设置
比如用户没有MiPush token,服务器就会向MiPush服务器发送一条空的(不带 push token 的)推送请求。但事实上应该什么都不发送才对。
否则可能会因客户端标准不统一/恶意传递错误信息导致数据不统一
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.