Skip to content

Commit de07935

Browse files
committed
Update.
1 parent 2b819de commit de07935

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

resource/template/component/server.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@
5454
<div class="ui message">
5555
{{if .Conf.GRPCHost}}
5656
<div class="ui top attached tabular menu">
57-
<a class="item active" data-tab="global-script">Global</a>
58-
<a class="item" data-tab="china-script">China</a>
57+
<a class="item active" data-tab="china-script">China (默认)</a>
58+
<a class="item" data-tab="global-script">Global</a>
5959
</div>
60-
<div class="ui bottom attached tab segment active" data-tab="global-script">
61-
curl -L https://raw.githubusercontent.com/xos/serverstatus/master/script/server-status.sh -o server-status.sh && chmod +x server-status.sh && sudo ./server-status.sh install_agent <code class="command">{{.Conf.GRPCHost}}</code> <code
60+
<div class="ui bottom attached tab segment active" data-tab="china-script">
61+
curl -L https://gitee.com/ten/ServerStatus/raw/master/script/server-status.sh -o server-status.sh && chmod +x server-status.sh && sudo ./server-status.sh install_agent <code class="command">{{.Conf.GRPCHost}}</code> <code
6262
class="command">{{if .Conf.ProxyGRPCPort}}{{.Conf.ProxyGRPCPort}}{{else}}{{.Conf.GRPCPort}}{{end}}</code> <code
6363
class="command hostSecret"></code> <code class="command">{{if .Conf.TLS}}--tls{{end}}</code>
6464
</div>
65-
<div class="ui bottom attached tab segment" data-tab="china-script">
66-
curl -L https://gitee.com/ten/ServerStatus/raw/master/script/server-status.sh -o server-status.sh && chmod +x server-status.sh && sudo ./server-status.sh install_agent <code class="command">{{.Conf.GRPCHost}}</code> <code
65+
<div class="ui bottom attached tab segment" data-tab="global-script">
66+
curl -L https://raw.githubusercontent.com/xos/serverstatus/master/script/server-status.sh -o server-status.sh && chmod +x server-status.sh && sudo ./server-status.sh install_agent <code class="command">{{.Conf.GRPCHost}}</code> <code
6767
class="command">{{if .Conf.ProxyGRPCPort}}{{.Conf.ProxyGRPCPort}}{{else}}{{.Conf.GRPCPort}}{{end}}</code> <code
6868
class="command hostSecret"></code> <code class="command">{{if .Conf.TLS}}--tls{{end}}</code>
6969
</div>

resource/template/dashboard-default/server.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@
112112
console.log('检测到用户地区:', userLocation);
113113
return userLocation;
114114
} catch (error) {
115-
console.warn('IP地址检测失败,使用默认设置:', error);
115+
console.warn('IP地址检测失败,使用默认设置(gitee):', error);
116+
userLocation = 'DEFAULT'; // 标记为默认状态
116117
return null;
117118
}
118119
}
119120

120121
// 生成安装脚本
121-
function generateInstallScript(secret, isChinaUser = false) {
122+
function generateInstallScript(secret) {
122123
const host = '{{.Conf.GRPCHost}}';
123124
const port = '{{if .Conf.ProxyGRPCPort}}{{.Conf.ProxyGRPCPort}}{{else}}{{.Conf.GRPCPort}}{{end}}';
124125
const tls = '{{if .Conf.TLS}} --tls{{end}}';
@@ -127,9 +128,13 @@
127128
return '{{tr "NoDomainAlert"}}';
128129
}
129130

130-
const baseUrl = isChinaUser ?
131-
'https://gitee.com/ten/ServerStatus/raw/master' :
132-
'https://raw.githubusercontent.com/xos/serverstatus/master';
131+
// 默认使用gitee,只有明确检测到非中国大陆IP才使用github
132+
let baseUrl = 'https://gitee.com/ten/ServerStatus/raw/master'; // 默认gitee
133+
134+
// 只有明确检测到非中国大陆IP才使用github
135+
if (userLocation && userLocation !== 'CN' && userLocation !== 'DEFAULT') {
136+
baseUrl = 'https://raw.githubusercontent.com/xos/serverstatus/master';
137+
}
133138

134139
return `curl -L ${baseUrl}/script/server-status.sh -o server-status.sh && chmod +x server-status.sh && sudo ./server-status.sh install_agent ${host} ${port} ${secret}${tls}`;
135140
}
@@ -147,9 +152,7 @@
147152
await detectUserLocation();
148153
}
149154

150-
// 判断是否为中国用户
151-
const isChinaUser = userLocation === 'CN';
152-
const script = generateInstallScript(secret, isChinaUser);
155+
const script = generateInstallScript(secret);
153156

154157
// 复制到剪贴板
155158
try {

0 commit comments

Comments
 (0)