Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17765c7

Browse files
committed
Merge branch 'master' of github.com:Peng-YM/QuanX
2 parents e7036d7 + f5a13af commit 17765c7

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

Tasks/caiyun.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ if (typeof $request !== "undefined") {
118118
);
119119
else $.notify("[彩云天气]", "❌ 出现错误", JSON.stringify(err, Object.getOwnPropertyNames(err)));
120120
})
121-
.finally($.done());
121+
.finally(() => $.done());
122122
}
123123

124124
async function scheduler() {

Tasks/psn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $.http.get({
2121
return parse(data['@graph']);
2222
})
2323
.catch((err) => $.error(err))
24-
.finally($.done());
24+
.finally(() => $.done());
2525

2626
function parse(products) {
2727
products.forEach(item => {

Tools/RunningMode/running-mode.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ $done();
5353

5454
function manager() {
5555
let ssid;
56+
let mode;
57+
5658
if (isSurge) {
5759
const v4_ip = $network.v4.primaryAddress;
5860
// no network connection
@@ -61,7 +63,7 @@ function manager() {
6163
return;
6264
}
6365
ssid = $network.wifi.ssid;
64-
const mode = ssid ? lookupSSID(ssid) : config.cellular;
66+
mode = ssid ? lookupSSID(ssid) : config.cellular;
6567
const target = {
6668
RULE: "rule",
6769
PROXY: "global-proxy",
@@ -71,7 +73,7 @@ function manager() {
7173
} else if (isLoon) {
7274
const conf = JSON.parse($config.getConfig());
7375
ssid = conf.ssid;
74-
const mode = ssid ? lookupSSID(ssid) : config.cellular;
76+
mode = ssid ? lookupSSID(ssid) : config.cellular;
7577
const target = {
7678
DIRECT: 0,
7779
RULE: 1,
@@ -98,16 +100,11 @@ function lookupSSID(ssid) {
98100
}
99101

100102
function notify(title, subtitle, content) {
101-
const TIMESTAMP_KEY = "running_mode_notified_time";
102-
const THROTTLE_TIME = 3 * 1000;
103-
const lastNotifiedTime = $persistentStore.read(THROTTLE_TIME);
104-
if (
105-
!lastNotifiedTime ||
106-
new Date().getTime() - lastNotifiedTime > THROTTLE_TIME
107-
) {
108-
$persistentStore.write(new Date().getTime().toString(), TIMESTAMP_KEY);
103+
const SUBTITLE_STORE_KEY = "running_mode_notified_subtitle";
104+
const lastNotifiedSubtitle = $persistentStore.read(SUBTITLE_STORE_KEY);
105+
106+
if (!lastNotifiedSubtitle || lastNotifiedSubtitle !== subtitle) {
107+
$persistentStore.write(subtitle.toString(), SUBTITLE_STORE_KEY);
109108
$notification.post(title, subtitle, content);
110109
}
111-
}
112-
113-
notify("title", "subtitle", "content");
110+
}

0 commit comments

Comments
 (0)