Skip to content

Commit

Permalink
fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
xkww3n committed Sep 17, 2024
1 parent 33bd316 commit 1c2f0e1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
10 changes: 9 additions & 1 deletion source/personal/bypass.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
$done($persistentStore.read("bypass"))
var match = 0
if ($network.wifi.ssid) {
match = $persistentStore.read("bypass_wifi");
}
else {
match = $persistentStore.read("bypass_cellular");
}

$done({matched: match});
35 changes: 17 additions & 18 deletions source/personal/set_bypass.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,29 @@ const GLOBAL_WIFI = [
"McDonald's"
];

var bypass;
var bypass_cellular = 0;
var bypass_wifi = 0;

if ($network.wifi.ssid) {
if (GLOBAL_WIFI.includes($network.wifi.ssid)) {
bypass = 1;
try {
if ($intent.parameter === "内地") {
bypass_cellular = 0;
}
else {
bypass = 0;
};
$persistentStore.write(bypass, "bypass");
$done();
bypass_cellular = 1;
}
$persistentStore.write(bypass_cellular, "bypass_cellular");
}
else {
try {
if ($indent.parameter === "内地") {
bypass = 0;
catch (err) { // triggered by network-changed event, no `$intent` passed in
if ($network.wifi.ssid) {
if (GLOBAL_WIFI.includes($network.wifi.ssid)){
bypass_wifi = 1;
}
else {
bypass = 1;
bypass_wifi = 0;
}
$persistentStore.write(bypass, "bypass");
$done();
}
catch (err) {
$done();
$persistentStore.write(bypass_wifi, "bypass_wifi");
}
}
finally {
$done();
}

0 comments on commit 1c2f0e1

Please sign in to comment.