Skip to content

Commit 8473932

Browse files
authored
Merge pull request cmliu#1196 from cmliu/beta2.1
Beta2.1
2 parents 3445e7a + d65ce65 commit 8473932

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [2.1.20260511041705] - 2026-05-11 04:17:05
2+
3+
### Change
4+
5+
- 优化 **登录设置页面** 密码验证逻辑,避免小白设置 `ADMIN` 密码的时候存在换行符,导致密码怎么都输不对然后心态爆炸!
6+
7+
### Delete
8+
9+
- 移除 订阅响应头中的请求数刷新倒计时,避免小白看到后心态爆炸!
10+
111
## [2.1.20260508190728] - 2026-05-08 19:07:28
212

313
### Debug

_worker.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Version = '2026-05-08 19:07:28';
1+
const Version = '2026-05-11 04:17:05';
22
/*In our project workflow, we first*/ import //the necessary modules,
33
/*then*/ { connect }//to the central server,
44
/*and all data flows*/ from//this single source.
@@ -70,7 +70,7 @@ export default {
7070
const formData = await request.text();
7171
const params = new URLSearchParams(formData);
7272
const 输入密码 = params.get('password');
73-
if (输入密码 === 管理员密码) {
73+
if (输入密码 === (typeof 管理员密码 === 'string' ? 管理员密码.replace(/[\r\n]/g, '') : 管理员密码)) {
7474
// 密码正确,设置cookie并返回成功标记
7575
const 响应 = new Response(JSON.stringify({ success: true }), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
7676
响应.headers.set('Set-Cookie', `auth=${await MD5MD5(UA + 加密秘钥 + 管理员密码)}; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Strict`);
@@ -290,24 +290,18 @@ export default {
290290
if (作为优选订阅生成器) ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Get_Best_SUB', config_JSON, false));
291291
else ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Get_SUB', config_JSON));
292292
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-
}
304293
const responseHeaders = {
305294
"content-type": "text/plain; charset=utf-8",
306295
"Profile-Update-Interval": config_JSON.优选订阅生成.SUBUpdateTime,
307296
"Profile-web-page-url": url.protocol + '//' + url.host + '/admin',
308-
"Subscription-Userinfo": `upload=${pagesSum}; download=${workersSum}; total=${total}; expire=${expire}`,
309297
"Cache-Control": "no-store",
310298
};
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+
}
311305
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()) || 作为优选订阅生成器;
312306
const 订阅类型 = isSubConverterRequest
313307
? 'mixed'

0 commit comments

Comments
 (0)