#Surge #脚本 #JavaScript #JS #IPv6
📈 Surge 一个简单判断当前配置是否开启了 IPv6 的例子
!(async () => {
const { profile } = await httpAPI('/v1/profiles/current?sensitive=0', 'GET')
$done({ IPv6: /(^|\n)ipv6\s?=\s?(true|1)\b/i.test(profile)})
})();
function httpAPI(path = '', method = 'POST', body = null) {
return new Promise(resolve => {
$httpAPI(method, path, body, result => {
resolve(result);
});
});
}
📈 Surge 一个简单判断当前配置是否开启了 IPv6 的例子
!(async () => {
const { profile } = await httpAPI('/v1/profiles/current?sensitive=0', 'GET')
$done({ IPv6: /(^|\n)ipv6\s?=\s?(true|1)\b/i.test(profile)})
})();
function httpAPI(path = '', method = 'POST', body = null) {
return new Promise(resolve => {
$httpAPI(method, path, body, result => {
resolve(result);
});
});
}