Created
February 6, 2021 03:55
-
-
Save alanhe421/a35484467afabb8ac6ee2246d37363e5 to your computer and use it in GitHub Desktop.
surge wifi changed ,auto change proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description | |
* 如果是家里WI-FI则开启直连模式 | |
* 如果不是家里WI-FI则开启代理模式 | |
*/ | |
const WIFI_DONT_NEED_PROXYS = ['xiaomi_Alan_5G']; | |
if (WIFI_DONT_NEED_PROXYS.includes($network.wifi.ssid)) { | |
$surge.setOutboundMode('direct'); | |
$notification.post('Surge', 'Wi-Fi changed', 'use direct mode'); | |
} else { | |
$surge.setSelectGroupPolicy('Final-select', 'Group'); | |
$surge.setOutboundMode('rule'); | |
$notification.post('Surge', 'Wi-Fi changed', 'use rule-based proxy mode'); | |
} | |
$done(); |
存在多个wifi名称的话该如何实现呢
语法变了
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
对应配置如下