-
Notifications
You must be signed in to change notification settings - Fork 8.6k
添加多任务上传功能 index-multi.html #258
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
Open
sangokvip
wants to merge
11
commits into
cf-pages:main
Choose a base branch
from
sangokvip:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
27de72c
up-mul
sangokvip 7906863
Update .gitignore
sangokvip b610d2f
Update upload.js
sangokvip b914a00
Update index-multi.html
sangokvip 01f129c
Update index-multi.html
sangokvip b224186
Update index-multi.html
sangokvip eadd6bf
Update index-multi.html
sangokvip 7d29530
Update index-multi.html
sangokvip 8f40ca0
Update index-multi.html
sangokvip 4a67e3c
admin
sangokvip 0858cd7
Merge branch 'cf-pages:main' into main
sangokvip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| node_modules/.bin/* | ||
| node_modules/.mf/* | ||
| .wrangler/* | ||
| data/* | ||
| data/* | ||
| /mcp-feedback-enhanced |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| { | ||
| } | ||
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||
| export async function onRequestPost(context) { | ||||||||||
| const { request, env } = context; | ||||||||||
|
|
||||||||||
| try { | ||||||||||
| const body = await request.json(); | ||||||||||
| const { password } = body; | ||||||||||
|
|
||||||||||
| // 固定密码 | ||||||||||
| const ADMIN_PASSWORD = 'Sangok#3'; | ||||||||||
|
Comment on lines
+8
to
+9
|
||||||||||
| // 固定密码 | |
| const ADMIN_PASSWORD = 'Sangok#3'; | |
| // 从环境变量读取管理员密码 | |
| const ADMIN_PASSWORD = env.ADMIN_PASSWORD; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| export async function onRequest(context) { | ||
| // Contents of context object | ||
| const { | ||
| request, // same as existing Worker API | ||
| env, // same as existing Worker API | ||
| params, // if filename includes [id] or [[path]] | ||
| waitUntil, // same as ctx.waitUntil in existing Worker API | ||
| next, // used for middleware or to fetch assets | ||
| data, // arbitrary space for passing data between middlewares | ||
| } = context; | ||
| if(typeof context.env.BASIC_USER == "undefined" || context.env.BASIC_USER == null || context.env.BASIC_USER == ""){ | ||
| return new Response('Not using basic auth.', { status: 200 }); | ||
| }else{ | ||
| const { request, env } = context; | ||
|
|
||
| // 检查cookie认证 | ||
| const cookies = request.headers.get('Cookie') || ''; | ||
| const isAuthenticated = cookies.includes('admin_auth=authenticated'); | ||
|
|
||
| if (isAuthenticated) { | ||
| return new Response('true', { status: 200 }); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // 如果没有cookie认证,检查是否配置了基础认证 | ||
| if (typeof env.BASIC_USER == "undefined" || env.BASIC_USER == null || env.BASIC_USER == "") { | ||
| return new Response('false', { status: 401 }); | ||
| } else { | ||
| return new Response('true', { status: 200 }); | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,7 @@ | ||
| export async function onRequest(context) { | ||
| // Contents of context object | ||
| const { | ||
| request, // same as existing Worker API | ||
| env, // same as existing Worker API | ||
| params, // if filename includes [id] or [[path]] | ||
| waitUntil, // same as ctx.waitUntil in existing Worker API | ||
| next, // used for middleware or to fetch assets | ||
| data, // arbitrary space for passing data between middlewares | ||
| } = context; | ||
| //get the request url | ||
| const { request } = context; | ||
| const url = new URL(request.url); | ||
| //redirect to admin page | ||
| return Response.redirect(url.origin+"/admin.html", 302) | ||
|
|
||
| } | ||
|
|
||
| // 重定向到新的登录页面 | ||
| return Response.redirect(url.origin + "/login.html", 302); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,9 @@ | ||
| export async function onRequest(context) { | ||
| // Contents of context object | ||
| const { | ||
| request, // same as existing Worker API | ||
| env, // same as existing Worker API | ||
| params, // if filename includes [id] or [[path]] | ||
| waitUntil, // same as ctx.waitUntil in existing Worker API | ||
| next, // used for middleware or to fetch assets | ||
| data, // arbitrary space for passing data between middlewares | ||
| } = context; | ||
| return new Response('Logged out.', { status: 401 }); | ||
|
|
||
| } | ||
| const { request } = context; | ||
| const url = new URL(request.url); | ||
|
|
||
| // 清除认证cookie并重定向到首页 | ||
| const response = Response.redirect(url.origin + "/", 302); | ||
| response.headers.set('Set-Cookie', 'admin_auth=; Path=/; HttpOnly; Max-Age=0; SameSite=Strict'); | ||
| return response; | ||
| } |
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
Oops, something went wrong.
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.
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.
Empty configuration file should not be committed to the repository. Either remove this file or add it to
.gitignoreif it's intended for local development only.