Skip to content

Commit 9376e29

Browse files
committed
chore: refine
1 parent 7e7b1a2 commit 9376e29

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

luci-app-openclash/luasrc/view/openclash/myip.htm

+27-17
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<meta http-equiv="x-dns-prefetch-control" content="on">
88
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
99
<link rel="dns-prefetch" href="//whois.pconline.com.cn">
10-
<link rel="dns-prefetch" href="//forge.speedtest.cn">
10+
<link rel="dns-prefetch" href="//pubstatic.b0.upaiyun.com">
1111
<link rel="dns-prefetch" href="//api-ipv4.ip.sb">
1212
<link rel="dns-prefetch" href="//api.ipify.org">
1313
<link rel="dns-prefetch" href="//api.ttt.sh">
1414
<link rel="dns-prefetch" href="//qqwry.api.skk.moe">
1515
<link rel="dns-prefetch" href="//d.skk.moe">
16-
<link rel="preconnect" href="https://forge.speedtest.cn">
16+
<link rel="preconnect" href="https://pubstatic.b0.upaiyun.com">
1717
<link rel="preconnect" href="https://whois.pconline.com.cn">
1818
<link rel="preconnect" href="https://api-ipv4.ip.sb">
1919
<link rel="preconnect" href="https://api.ipify.org">
@@ -143,7 +143,7 @@
143143
<span style="float: right;"><img src="/luci-static/resources/openclash/img/eye-light.svg" height="20px" title="<%:Hide IP%>" alt="<%:Hide IP%>" id="eye-icon" onclick="return privacy_my_ip(this)" /></span>
144144
</p>
145145
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
146-
<span class="ip-title">SpeedTest:</span><span class="ip-result" id="ip-speedtest"></span> <span class="ip-geo" id="ip-speedtest-geo"></span>
146+
<span class="ip-title">UpaiYun:</span><span class="ip-result" id="ip-upaiyun"></span> <span class="ip-geo" id="ip-upaiyun-geo"></span>
147147
</p>
148148
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
149149
<span class="ip-title">PConline:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-geo"></span>
@@ -189,13 +189,13 @@
189189
const $$ = document;
190190
var ip_pcol_ip;
191191
var ip_ipsb_ip;
192-
var ip_speedtest_ip;
192+
var ip_upaiyun_ip;
193193
var ip_ipify_ip;
194194
var refresh_http;
195195
var refresh_ip;
196196
$$.getElementById('ip-pcol').innerHTML = '<%:Querying...%>';
197197
$$.getElementById('ip-ipify').innerHTML = '<%:Querying...%>';
198-
$$.getElementById('ip-speedtest').innerHTML = '<%:Querying...%>';
198+
$$.getElementById('ip-upaiyun').innerHTML = '<%:Querying...%>';
199199
$$.getElementById('ip-ipsb').innerHTML = '<%:Querying...%>';
200200
let random = parseInt(Math.random() * 100000000);
201201
let IP = {
@@ -259,14 +259,24 @@
259259
IP.parseIPIpip(resp.data.ip, 'ip-ipapi-geo');
260260
})
261261
},
262-
getSpeedIP: () => {
263-
IP.get(`https://forge.speedtest.cn/api/location/info?z=${random}`, 'json')
262+
//getSpeedIP: () => {
263+
// IP.get(`https://forge.speedtest.cn/api/location/info?z=${random}`, 'json')
264+
// .then(resp => {
265+
// if (localStorage.getItem('privacy_my_ip') != 'true') {
266+
// $$.getElementById('ip-speedtest').innerHTML = resp.data.ip;
267+
// };
268+
//$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? '' : resp.data.distinct) + ' ' + (resp.data.isp == "null" ? '' : resp.data.isp);
269+
// IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
270+
// })
271+
//},
272+
getUpaiIP: () => {
273+
IP.get(`https://pubstatic.b0.upaiyun.com/?_upnode&z=${random}`, 'json')
264274
.then(resp => {
265275
if (localStorage.getItem('privacy_my_ip') != 'true') {
266-
$$.getElementById('ip-speedtest').innerHTML = resp.data.ip;
276+
$$.getElementById('ip-upaiyun').innerHTML = resp.data.remote_addr;
267277
};
268-
//$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? '' : resp.data.distinct) + ' ' + (resp.data.isp == "null" ? '' : resp.data.isp);
269-
IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
278+
$$.getElementById('ip-upaiyun-geo').innerHTML = resp.data.remote_addr_location.country + resp.data.remote_addr_location.province + resp.data.remote_addr_location.city + ' ' + resp.data.remote_addr_location.isp;
279+
//IP.parseIPIpip(resp.data.remote_addr, 'ip-upaiyun-geo');
270280
})
271281
},
272282
getIpifyIP: () => {
@@ -383,7 +393,7 @@
383393
mypage.appendChild(sbipScript);
384394

385395
//HTTP.runcheck();
386-
IP.getSpeedIP();
396+
IP.getUpaiIP();
387397
IP.getIpifyIP();
388398
};
389399

@@ -395,11 +405,11 @@
395405
$$.getElementById('eye-icon').alt='<%:Show IP%>';
396406
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
397407
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
398-
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
408+
ip_upaiyun_ip = $$.getElementById('ip-upaiyun').innerHTML;
399409
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
400410
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
401411
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
402-
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
412+
$$.getElementById('ip-upaiyun').innerHTML = '***.***.***.***';
403413
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
404414
}
405415
else {
@@ -419,11 +429,11 @@
419429
imgobj.alt='<%:Show IP%>';
420430
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
421431
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
422-
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
432+
ip_upaiyun_ip = $$.getElementById('ip-upaiyun').innerHTML;
423433
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
424434
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
425435
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
426-
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
436+
$$.getElementById('ip-upaiyun').innerHTML = '***.***.***.***';
427437
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
428438
}
429439
else {
@@ -432,7 +442,7 @@
432442
imgobj.alt='<%:Hide IP%>';
433443
$$.getElementById('ip-pcol').innerHTML = ip_pcol_ip;
434444
$$.getElementById('ip-ipsb').innerHTML = ip_ipsb_ip;
435-
$$.getElementById('ip-speedtest').innerHTML = ip_speedtest_ip;
445+
$$.getElementById('ip-upaiyun').innerHTML = ip_upaiyun_ip;
436446
$$.getElementById('ip-ipify').innerHTML = ip_ipify_ip;
437447
localStorage.removeItem('privacy_my_ip');
438448
myip_Load();
@@ -452,7 +462,7 @@
452462

453463
HTTP.runcheck();
454464
IP.getIpifyIP();
455-
IP.getSpeedIP();
465+
IP.getUpaiIP();
456466
show_my_ip();
457467
</script>
458468
<script type="text/javascript">

luci-app-openclash/root/etc/init.d/openclash

+5-5
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ if [ -n "$FW4" ]; then
15631563

15641564
#intranet allowed
15651565
if [ "$intranet_allowed" -eq 1 ]; then
1566-
if [ -n "$intranet_allowed_wan_name" ]; then
1566+
if [ -n "$intranet_allowed_wan_name" ] && [ "$intranet_allowed_wan_name" != "0" ]; then
15671567
config_load "openclash"
15681568
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
15691569
else
@@ -2213,7 +2213,7 @@ if [ -n "$FW4" ]; then
22132213

22142214
#intranet allowed
22152215
if [ "$intranet_allowed" -eq 1 ]; then
2216-
if [ -n "$intranet_allowed_wan_name" ]; then
2216+
if [ -n "$intranet_allowed_wan_name" ] && [ "$intranet_allowed_wan_name" != "0" ]; then
22172217
config_load "openclash"
22182218
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
22192219
else
@@ -2338,7 +2338,7 @@ if [ -z "$FW4" ]; then
23382338

23392339
#intranet allowed
23402340
if [ "$intranet_allowed" -eq 1 ]; then
2341-
if [ -n "$intranet_allowed_wan_name" ]; then
2341+
if [ -n "$intranet_allowed_wan_name" ] && [ "$intranet_allowed_wan_name" != "0" ]; then
23422342
config_load "openclash"
23432343
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
23442344
else
@@ -3001,7 +3001,7 @@ if [ -z "$FW4" ]; then
30013001

30023002
#intranet allowed
30033003
if [ "$intranet_allowed" -eq 1 ]; then
3004-
if [ -n "$intranet_allowed_wan_name" ]; then
3004+
if [ -n "$intranet_allowed_wan_name" ] && [ "$intranet_allowed_wan_name" != "0" ]; then
30053005
config_load "openclash"
30063006
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
30073007
else
@@ -3192,7 +3192,7 @@ get_config()
31923192
enable_unified_delay=$(uci -q get openclash.config.enable_unified_delay || echo "0")
31933193
keep_alive_interval=$(uci -q get openclash.config.keep_alive_interval || echo "0")
31943194
proxy_dns_group=$(uci -q get openclash.config.proxy_dns_group || echo "Disable")
3195-
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name)
3195+
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name || echo "0")
31963196
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
31973197
uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash
31983198
}

0 commit comments

Comments
 (0)