mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-01-31 09:03:19 +08:00
修改无referer时无法上传的bug
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
- 上传显示实时上传进度
|
||||
- 支持整体复制和单独复制(整体复制即将所有链接通过换行串联起来后复制)
|
||||
- 上传后图片无需手动点击,可直接展示在管理页面中
|
||||
- 支持API上传认证
|
||||
- 支持访问域名限制
|
||||
- 支持API上传认证(感谢[hl128k](https://github.com/hl128k))
|
||||
- 支持访问域名限制(感谢[hl128k](https://github.com/hl128k))
|
||||
|
||||
## 3.Deployment
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@ function isAuthCodeDefined(authCode) {
|
||||
|
||||
export async function onRequestPost(context) { // Contents of context object
|
||||
const { request, env, params, waitUntil, next, data } = context;
|
||||
const referer = request.headers.get('Referer');
|
||||
const authCode = new URLSearchParams(new URL(referer).search).get('authcode');
|
||||
// const referer = request.headers.get('Referer');
|
||||
// const authCode = new URLSearchParams(new URL(referer).search).get('authcode');
|
||||
const authCode = new URL(request.url).searchParams.get('authcode');
|
||||
const clonedRequest = request.clone();
|
||||
if (isAuthCodeDefined(env.AUTH_CODE) && !isValidAuthCode(env.AUTH_CODE, authCode)) {
|
||||
return new UnauthorizedException("error");
|
||||
|
||||
Reference in New Issue
Block a user