-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
后台优化(音频上传/音视频卡片/黑白名单/优化代码结构) #210
base: main
Are you sure you want to change the base?
Conversation
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.
Copilot reviewed 6 out of 6 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (2)
functions/api/manage/editName/[id].js:11
- Check if
value
is null or undefined before accessingvalue.metadata
. Suggestion:if (!value || !value.metadata) return new Response(
Image metadata not found for ID: ${params.id}, { status: 404 });
if (!value.metadata) return new Response(`Image metadata not found for ID: ${params.id}`, { status: 404 });
functions/upload.js:108
- Use optional chaining to simplify the code and make it more readable.
if (result.audio) return result.audio.file_id;
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.
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (5)
functions/api/manage/editName/[id].js:11
- [nitpick] The error message could be more descriptive. Consider including additional context, such as 'Metadata not found for image ID: ' + params.id.
if (!value.metadata) return new Response(`Image metadata not found for ID: ${params.id}`, { status: 404 });
functions/upload.js:54
- The variable 'fileExtension' is used without being defined. Ensure 'fileExtension' is properly set before using it.
await env.img_url.put(`${fileId}.${fileExtension}`, "", {
functions/upload.js:60
- The variable 'fileName' should be properly set before using it in the metadata.
fileName: fileName,
functions/upload.js:46
- [nitpick] The error message 'Failed to get file ID' could be more descriptive to help with debugging.
const fileId = getFileId(result.data);
functions/file/[id].js:51
- [nitpick] The metadata initialization is redundant. Consolidate the metadata properties to avoid setting them multiple times.
let record = await env.img_url.getWithMetadata(params.id);
主要功能更新
upload.js
添加了audio
的判断,支持音频/文件上传file/[id].js
优化后台判定,Refer 包含/admin前缀的请求(如admin-imgtc、admin-waterfall)直接返回文件metadata
中添加了fileName
,默认显示原始文件名,支持重命名(新增一个了editName
API)admin-tc.css
界面预览
视频界面
音频界面
文件界面