clc.js
· 1.3 KiB · JavaScript
Raw
// CLC TimezoneDB Mock
// Giữ schema y như TimezoneDB, nhưng timestamp mock lại
try {
const YEARS_TO_SUBTRACT = 60 * 60 * 24 * 18200; // ~49.86 năm
const TWO_HOURS = 7200; // 2 giờ
const nowSec = Math.floor(Date.now() / 1000);
// Đếm số lần gọi
let callCount = parseInt($persistentStore.read("v3") || "0", 10) + 1;
$persistentStore.write(String(callCount), "v3");
// Tạo timestamp giả
const fakeTimestamp = nowSec - YEARS_TO_SUBTRACT + (callCount * TWO_HOURS);
// Build body theo schema TimezoneDB (mock cơ bản, bạn có thể hardcode thêm)
const body = {
status: "OK",
message: "",
countryCode: "VN",
zoneName: "Asia/Ho_Chi_Minh",
abbreviation: "ICT",
gmtOffset: 25200, // +7h
dst: "0",
zoneStart: fakeTimestamp - 86400, // giả: hôm trước
zoneEnd: fakeTimestamp + 86400, // giả: hôm sau
nextAbbreviation: "ICT",
timestamp: fakeTimestamp,
formatted: new Date(fakeTimestamp * 1000).toISOString().replace("T", " ").split(".")[0]
};
$done({
response: {
status: 200,
headers: {
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "no-store"
},
body: JSON.stringify(body)
}
});
} catch (e) {
$done({});
}
1 | // CLC TimezoneDB Mock |
2 | // Giữ schema y như TimezoneDB, nhưng timestamp mock lại |
3 | |
4 | try { |
5 | const YEARS_TO_SUBTRACT = 60 * 60 * 24 * 18200; // ~49.86 năm |
6 | const TWO_HOURS = 7200; // 2 giờ |
7 | const nowSec = Math.floor(Date.now() / 1000); |
8 | |
9 | // Đếm số lần gọi |
10 | let callCount = parseInt($persistentStore.read("v3") || "0", 10) + 1; |
11 | $persistentStore.write(String(callCount), "v3"); |
12 | |
13 | // Tạo timestamp giả |
14 | const fakeTimestamp = nowSec - YEARS_TO_SUBTRACT + (callCount * TWO_HOURS); |
15 | |
16 | // Build body theo schema TimezoneDB (mock cơ bản, bạn có thể hardcode thêm) |
17 | const body = { |
18 | status: "OK", |
19 | message: "", |
20 | countryCode: "VN", |
21 | zoneName: "Asia/Ho_Chi_Minh", |
22 | abbreviation: "ICT", |
23 | gmtOffset: 25200, // +7h |
24 | dst: "0", |
25 | zoneStart: fakeTimestamp - 86400, // giả: hôm trước |
26 | zoneEnd: fakeTimestamp + 86400, // giả: hôm sau |
27 | nextAbbreviation: "ICT", |
28 | timestamp: fakeTimestamp, |
29 | formatted: new Date(fakeTimestamp * 1000).toISOString().replace("T", " ").split(".")[0] |
30 | }; |
31 | |
32 | $done({ |
33 | response: { |
34 | status: 200, |
35 | headers: { |
36 | "Content-Type": "application/json; charset=utf-8", |
37 | "Cache-Control": "no-store" |
38 | }, |
39 | body: JSON.stringify(body) |
40 | } |
41 | }); |
42 | } catch (e) { |
43 | $done({}); |
44 | } |
45 |
clc.module
· 414 B · Text
Raw
#!name=CLC Time Mock
#!desc=Mock TimezoneDB: local time minus ~50 years + +2h per call
#!author=f97
#!homepage=https://f97.xyz
[Script]
# Chặn mọi request tới api.timezonedb.com và trả JSON local
CLC-Time=type=http-request,pattern=^https?:\/\/api\.timezonedb\.com\/.* ,script-path=https://demo.opengist.io/f97/cfa7470912c74cae8834bbd590f86666/raw/HEAD/clc.js
[MITM]
hostname=%APPEND% api.timezonedb.com
1 | #!name=CLC Time Mock |
2 | #!desc=Mock TimezoneDB: local time minus ~50 years + +2h per call |
3 | #!author=f97 |
4 | #!homepage=https://f97.xyz |
5 | |
6 | [Script] |
7 | # Chặn mọi request tới api.timezonedb.com và trả JSON local |
8 | CLC-Time=type=http-request,pattern=^https?:\/\/api\.timezonedb\.com\/.* ,script-path=https://demo.opengist.io/f97/cfa7470912c74cae8834bbd590f86666/raw/HEAD/clc.js |
9 | |
10 | [MITM] |
11 | hostname=%APPEND% api.timezonedb.com |
12 |
count.js
· 579 B · JavaScript
Raw
try {
const body = JSON.parse($response.body);
const YEARS_TO_SUBTRACT = 60 * 60 * 24 * 18200; // ~49.86 years
const TWO_HOURS = 7200; // 2 hours in seconds
const now = Math.floor(Date.now() / 1000);
// Get and increment call count
let callCount = parseInt($persistentStore.read("v3") || "0") + 1;
$persistentStore.write(callCount.toString(), "v3");
// Update timestamp if exists
if (body?.timestamp) {
body.timestamp = now - YEARS_TO_SUBTRACT + (callCount * TWO_HOURS);
}
$done({ body: JSON.stringify(body) });
} catch (error) {
$done({});
}
1 | try { |
2 | const body = JSON.parse($response.body); |
3 | const YEARS_TO_SUBTRACT = 60 * 60 * 24 * 18200; // ~49.86 years |
4 | const TWO_HOURS = 7200; // 2 hours in seconds |
5 | const now = Math.floor(Date.now() / 1000); |
6 | |
7 | // Get and increment call count |
8 | let callCount = parseInt($persistentStore.read("v3") || "0") + 1; |
9 | $persistentStore.write(callCount.toString(), "v3"); |
10 | |
11 | // Update timestamp if exists |
12 | if (body?.timestamp) { |
13 | body.timestamp = now - YEARS_TO_SUBTRACT + (callCount * TWO_HOURS); |
14 | } |
15 | |
16 | $done({ body: JSON.stringify(body) }); |
17 | } catch (error) { |
18 | $done({}); |
19 | } |
fix.js
· 328 B · JavaScript
Raw
try {
let body = JSON.parse($response.body);
const secondsToSubtract = 60 * 60 * 24 * 18200; // ~49.86 năm
const now = Math.floor(Date.now() / 1000);
if (body?.timestamp) {
body.timestamp = Number(now ?? body.timestamp) - secondsToSubtract;
}
$done({ body: JSON.stringify(body) });
} catch (e) {
$done({});
}
1 | try { |
2 | let body = JSON.parse($response.body); |
3 | const secondsToSubtract = 60 * 60 * 24 * 18200; // ~49.86 năm |
4 | const now = Math.floor(Date.now() / 1000); |
5 | |
6 | if (body?.timestamp) { |
7 | body.timestamp = Number(now ?? body.timestamp) - secondsToSubtract; |
8 | } |
9 | $done({ body: JSON.stringify(body) }); |
10 | } catch (e) { |
11 | $done({}); |
12 | } |
now.js
· 319 B · JavaScript
Raw
try {
let body = JSON.parse($response.body);
// Lấy timestamp hiện tại theo giờ hệ thống (UTC, tính theo giây)
const now = Math.floor(Date.now() / 1000);
if (body?.timestamp) {
body.now = now;
body.timestamp = now;
}
$done({ body: JSON.stringify(body) });
} catch (e) {
$done({});
}
1 | try { |
2 | let body = JSON.parse($response.body); |
3 | |
4 | // Lấy timestamp hiện tại theo giờ hệ thống (UTC, tính theo giây) |
5 | const now = Math.floor(Date.now() / 1000); |
6 | |
7 | if (body?.timestamp) { |
8 | body.now = now; |
9 | body.timestamp = now; |
10 | } |
11 | |
12 | $done({ body: JSON.stringify(body) }); |
13 | } catch (e) { |
14 | $done({}); |
15 | } |
timezone.module
· 327 B · Text
Raw
#!name=Timezone
#!homepage=https://f97.xyz
#!author=f97
#!desc=Adjust TimezoneDB timestamp by subtracting ~50 years
[Script]
TimezoneDB=type=http-response,pattern=timezonedb,requires-body=1,script-path=https://demo.opengist.io/f97/cfa7470912c74cae8834bbd590f86666/raw/HEAD/count.js
[MITM]
hostname=%APPEND% api.timezonedb.com
1 | #!name=Timezone |
2 | #!homepage=https://f97.xyz |
3 | #!author=f97 |
4 | #!desc=Adjust TimezoneDB timestamp by subtracting ~50 years |
5 | |
6 | [Script] |
7 | TimezoneDB=type=http-response,pattern=timezonedb,requires-body=1,script-path=https://demo.opengist.io/f97/cfa7470912c74cae8834bbd590f86666/raw/HEAD/count.js |
8 | |
9 | [MITM] |
10 | hostname=%APPEND% api.timezonedb.com |