Repository navigation
Conversation
Add /admin/upload-grants to create, list, and revoke temporary upload grants, showing the code and /#/send?grant=... link once on creation. On /send, accept a grant via ?grant= (stripped from the URL and kept in sessionStorage) or manual input when guest upload is disabled, with a button to clear it. Attach X-Upload-Grant only on server upload endpoints; direct S3 PUT requests skip the header.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
配合后端的临时上传授权码功能,加上后台管理和发送页的前端支持。
vastsa/FileCodeBox#568
Assisted by: Claude Opus 5.5
Changed
/admin/upload-grants页面:按有效期、允许次数和备注生成临时授权码,生成后只展示这一次授权码和/#/send?grant=...链接,方便直接复制;列表里可以看到首尾提示、已用次数、过期时间和当前状态,也能撤销。游客上传开启时会在顶部提示授权码暂不生效。/send:游客上传关闭时,除了登录管理员账号,也可以手动输入授权码或通过?grant=链接打开。读到?grant=后会从 URL 里去掉,授权码存到sessionStorage,表单顶部会显示当前授权码并提供清除按钮。/share/text、/share/file、/chunk/upload、/presign/upload)带上X-Upload-Grant,直传 S3 的PUT请求不带。tests/upload-grant.test.mjs加了路径匹配、提示格式、状态判断和发送页参数清理的测试。