mirror of
https://github.com/lush2020/CF-Workers-SUB.git
synced 2026-03-21 02:52:38 +08:00
Update _worker.js
This commit is contained in:
15
_worker.js
15
_worker.js
@@ -7,6 +7,8 @@ let ChatID =''; //可以为空,或者@userinfobot中获取,/start
|
||||
let TG = 0; //小白勿动, 开发者专用,1 为推送所有的访问信息,0 为不推送订阅转换后端的访问信息与异常访问
|
||||
let FileName = 'CF-Workers-SUB';
|
||||
let SUBUpdateTime = 6; //自定义订阅更新时间,单位小时
|
||||
let total = 99;//PB
|
||||
let timestamp = 4102329600000;//2099-12-31
|
||||
|
||||
//节点链接 + 订阅链接
|
||||
let MainData = `
|
||||
@@ -37,10 +39,15 @@ export default {
|
||||
|
||||
const currentDate = new Date();
|
||||
currentDate.setHours(0, 0, 0, 0);
|
||||
const timestamp = Math.ceil(currentDate.getTime() / 1000);
|
||||
const fakeToken = await MD5MD5(`${mytoken}${timestamp}`);
|
||||
const timeTemp = Math.ceil(currentDate.getTime() / 1000);
|
||||
const fakeToken = await MD5MD5(`${mytoken}${timeTemp}`);
|
||||
//console.log(`${fakeUserID}\n${fakeHostName}`); // 打印fakeID
|
||||
|
||||
let UD = Math.floor(((timestamp - Date.now())/timestamp * 99 * 1099511627776 * 1024)/2);
|
||||
total = total * 1099511627776 * 1024;
|
||||
let expire= Math.floor(timestamp / 1000) ;
|
||||
SUBUpdateTime = env.SUBUPTIME || SUBUpdateTime;
|
||||
|
||||
let 重新汇总所有链接 = await ADD(MainData + '\n' + urls.join('\n'));
|
||||
let 自建节点 ="";
|
||||
let 订阅链接 ="";
|
||||
@@ -149,6 +156,7 @@ export default {
|
||||
headers: {
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"Profile-Update-Interval": `${SUBUpdateTime}`,
|
||||
"Subscription-Userinfo": `upload=${UD}; download=${UD}; total=${total}; expire=${expire}`,
|
||||
}
|
||||
});
|
||||
} else if (订阅格式 == 'clash'){
|
||||
@@ -165,6 +173,7 @@ export default {
|
||||
headers: {
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"Profile-Update-Interval": `${SUBUpdateTime}`,
|
||||
"Subscription-Userinfo": `upload=${UD}; download=${UD}; total=${total}; expire=${expire}`,
|
||||
}
|
||||
});
|
||||
//throw new Error(`Error fetching subconverterUrl: ${subconverterResponse.status} ${subconverterResponse.statusText}`);
|
||||
@@ -176,6 +185,7 @@ export default {
|
||||
"Content-Disposition": `attachment; filename*=utf-8''${encodeURIComponent(FileName)}; filename=${FileName}`,
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"Profile-Update-Interval": `${SUBUpdateTime}`,
|
||||
"Subscription-Userinfo": `upload=${UD}; download=${UD}; total=${total}; expire=${expire}`,
|
||||
|
||||
},
|
||||
});
|
||||
@@ -184,6 +194,7 @@ export default {
|
||||
headers: {
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"Profile-Update-Interval": `${SUBUpdateTime}`,
|
||||
"Subscription-Userinfo": `upload=${UD}; download=${UD}; total=${total}; expire=${expire}`,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user