-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(fs): support manually trigger objs update hook #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
如果可以定时执行更好,但是现在openlist里面没有定时任务系统 |
有,但扫这个有风控风险,还是手动比较好 |
提供功能 说明风险 让用户自己选择? |
加这个定时扫的功能又要建一张表持久化扫描任务,又要做配套的CRUD和备份还原的适配,懒了,不想写。我之前考虑过要不要将来加一个大的定时任务模块进去,如果哪天心情好要加这个功能了把定时扫描一块做了吧 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds functionality to manually trigger object update hooks for file system operations, enabling on-demand index updates and STRM driver file generation.
Key Changes:
- Added manual scan API endpoints (
/admin/scan/start,/admin/scan/stop,/admin/scan/progress) to trigger recursive filesystem scanning - Introduced new settings
HandleHookAfterWritingandHandleHookRateLimitto control automatic hook triggering after write operations - Implemented rate-limited recursive directory scanning with concurrent support for virtual paths
- Extended file operations (Move, Copy, Put, PutURL, ArchiveDecompress) to optionally trigger hooks after completion
- Updated transfer tasks to support hook handling with configurable rate limiting
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| server/router.go | Added new /admin/scan route group with endpoints for starting, stopping, and checking progress of manual scans |
| server/middlewares/search.go | Changed HTTP status code from 500 to 404 for unavailable search functionality |
| server/handles/scan.go | New handler file implementing manual scan endpoints with request/response types |
| internal/task_group/transfer.go | Added hook handling logic to transfer operations with rate limiting support |
| internal/setting/setting.go | Added GetFloat helper function for retrieving float settings |
| internal/op/recursive_list.go | New file implementing recursive directory listing with cancellation and rate limiting |
| internal/op/fs.go | Extended Move, Copy, Put, and PutURL operations to trigger hooks when enabled |
| internal/op/archive.go | Extended ArchiveDecompress to trigger hooks for extracted content |
| internal/conf/const.go | Added configuration constants for hook handling settings |
| internal/bootstrap/data/setting.go | Added default values for new hook-related settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description / 描述
添加一个按钮用于手动触发指定路径下所有子路径的
ObjsUpdateHook,这将触发索引更新以及strm驱动的生成本地文件功能。添加一个设置选项,开启时支持在复制或移动任务完成后自动触发目标路径及所有子路径的
ObjsUpdateHook。前端:OpenListTeam/OpenList-Frontend#275
Motivation and Context / 背景
How Has This Been Tested? / 测试
测了
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。