|
1 | | -const Version = '2026-05-08 19:07:28'; |
| 1 | +const Version = '2026-05-11 04:17:05'; |
2 | 2 | /*In our project workflow, we first*/ import //the necessary modules, |
3 | 3 | /*then*/ { connect }//to the central server, |
4 | 4 | /*and all data flows*/ from//this single source. |
@@ -70,7 +70,7 @@ export default { |
70 | 70 | const formData = await request.text(); |
71 | 71 | const params = new URLSearchParams(formData); |
72 | 72 | const 输入密码 = params.get('password'); |
73 | | - if (输入密码 === 管理员密码) { |
| 73 | + if (输入密码 === (typeof 管理员密码 === 'string' ? 管理员密码.replace(/[\r\n]/g, '') : 管理员密码)) { |
74 | 74 | // 密码正确,设置cookie并返回成功标记 |
75 | 75 | const 响应 = new Response(JSON.stringify({ success: true }), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } }); |
76 | 76 | 响应.headers.set('Set-Cookie', `auth=${await MD5MD5(UA + 加密秘钥 + 管理员密码)}; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Strict`); |
@@ -290,24 +290,18 @@ export default { |
290 | 290 | if (作为优选订阅生成器) ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Get_Best_SUB', config_JSON, false)); |
291 | 291 | else ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Get_SUB', config_JSON)); |
292 | 292 | const ua = UA.toLowerCase(); |
293 | | - const expire = 4102329600;//2099-12-31 到期时间 |
294 | | - const now = Date.now(); |
295 | | - const today = new Date(now); |
296 | | - today.setHours(0, 0, 0, 0); |
297 | | - const UD = Math.floor(((now - today.getTime()) / 86400000) * 24 * 1099511627776 / 2); |
298 | | - let pagesSum = UD, workersSum = UD, total = 24 * 1099511627776; |
299 | | - if (config_JSON.CF.Usage.success) { |
300 | | - pagesSum = config_JSON.CF.Usage.pages; |
301 | | - workersSum = config_JSON.CF.Usage.workers; |
302 | | - total = Number.isFinite(config_JSON.CF.Usage.max) ? (config_JSON.CF.Usage.max / 1000) * 1024 : 1024 * 100; |
303 | | - } |
304 | 293 | const responseHeaders = { |
305 | 294 | "content-type": "text/plain; charset=utf-8", |
306 | 295 | "Profile-Update-Interval": config_JSON.优选订阅生成.SUBUpdateTime, |
307 | 296 | "Profile-web-page-url": url.protocol + '//' + url.host + '/admin', |
308 | | - "Subscription-Userinfo": `upload=${pagesSum}; download=${workersSum}; total=${total}; expire=${expire}`, |
309 | 297 | "Cache-Control": "no-store", |
310 | 298 | }; |
| 299 | + if (config_JSON.CF.Usage.success) { |
| 300 | + const pagesSum = config_JSON.CF.Usage.pages; |
| 301 | + const workersSum = config_JSON.CF.Usage.workers; |
| 302 | + const total = Number.isFinite(config_JSON.CF.Usage.max) ? (config_JSON.CF.Usage.max / 1000) * 1024 : 1024 * 100; |
| 303 | + responseHeaders["Subscription-Userinfo"] = `upload=${pagesSum}; download=${workersSum}; total=${total}; expire=4102329600`; // 2099-12-31 到期时间 |
| 304 | + } |
311 | 305 | const isSubConverterRequest = url.searchParams.has('b64') || url.searchParams.has('base64') || request.headers.get('subconverter-request') || request.headers.get('subconverter-version') || ua.includes('subconverter') || ua.includes(('CF-Workers-SUB').toLowerCase()) || 作为优选订阅生成器; |
312 | 306 | const 订阅类型 = isSubConverterRequest |
313 | 307 | ? 'mixed' |
|
0 commit comments