alist
alist copied to clipboard
希望增加能够记住排序设定的功能
Please make sure of the following things
- [X] I have read the documentation.
- [X] I'm sure there are no duplicate issues or discussions.
- [X] I'm sure this feature is not implemented.
- [X] I'm sure it's a reasonable and popular requirement.
Description of the feature / 需求描述
上一级目录按了按时间排序,然后进入子目录后,返回上一级目录,还是按照时间排序 现在每次返回都是按照默认方式排序,没办法记住排序的方式
Suggested solution / 实现思路
No response
Additional context / 附件
No response
Thanks for opening your first issue here! Be sure to follow the issue template!
+1,附实现思路:
- 在数据库中,添加 table,table 名可以为 [prefix]_order_rule,field 包含路径 path,order_by,order_direction,add_time
- UI 中,点击文件列表表头,触发排序规则的更新 API(不知前端是否支持?),API 可以为 POST /api/fs/order,参数包含 path,order_by,order_direction,取值与 storage 表兼容
- 后端直接写入数据库,同时设置该规则的添加时间 add_time 为当前时间戳
- 当前端请求 /api/fs/list 返回目录列表时,同时在返回值中设置 order_by,order_direction 的值,由后端从数据库中查询,并在前端应用该排序规则;如无法查到,返回 storage 表中对应的配置作为缺省值
- 避免在后端进行排序,以降低服务器压力
- 每次查询到 order_rule 表中的排序规则时,更新 add_time 为当前时间戳
- alist 定期清理该表中所有超时的记录(通过预设超时时间实现)。超时代表用户长期不访问该目录,清理不会影响用户体验
- 建议在数据库中添加字段以记录程序上次启动和上次停止的时间戳,这样计算超时用户体验更好
- 也可考虑在 redis 中实现该功能,如 alist 打算引入 redis,建议将基础索引功能也迁移到 redis 中
- 有空提 PR,现在蹲个好心人
+1