XJFKKK commited on
Commit
b31fe4b
·
verified ·
1 Parent(s): dfee1b8

Update nezha.sh

Browse files
Files changed (1) hide show
  1. nezha.sh +7 -7
nezha.sh CHANGED
@@ -14,7 +14,7 @@ err() {
14
  }
15
 
16
  warn() {
17
- printf "${red}%s${plain}\n" "$*"
18
  }
19
 
20
  success() {
@@ -80,8 +80,7 @@ init() {
80
  env_check
81
  ## 检测是否为国内IP
82
  if [ -z "$CN" ]; then
83
- geo_check
84
- if [ -n "$isCN" ]; then
85
  CN=true
86
  GITHUB_RAW_URL="gitee.com/naibahq/scripts/raw/main"
87
  GITHUB_URL="gitee.com"
@@ -112,9 +111,10 @@ modify_config() {
112
 
113
  # 设置配置参数,从环境变量读取,如果没有则使用默认值
114
  nz_site_title=${NZ_SITE_TITLE:-"哪吒监控"}
115
- nz_port=${NZ_PORT:-"7860"} # Hugging Face Spaces 默认使用 7860 端口
116
- nz_lang=${NZ_LANG:-"zh_CN"}
117
  nz_tls=${NZ_TLS:-"true"}
 
118
  nz_space_name=${NZ_SPACE_NAME:-"your-space-name"}
119
 
120
  # 生成随机的 csrf token
@@ -127,10 +127,10 @@ site:
127
  url: "https://${nz_space_name}.hf.space"
128
  language: "${nz_lang}"
129
  http:
130
- listen: "0.0.0.0:${nz_port}"
131
  root: "./static"
132
  grpc:
133
- listen: "0.0.0.0:${nz_port}"
134
  tls:
135
  enable: ${nz_tls}
136
  cert: "./server.crt"
 
14
  }
15
 
16
  warn() {
17
+ printf "${yellow}%s${plain}\n" "$*"
18
  }
19
 
20
  success() {
 
80
  env_check
81
  ## 检测是否为国内IP
82
  if [ -z "$CN" ]; then
83
+ if curl -s https://ipinfo.io/country | grep -q 'CN'; then
 
84
  CN=true
85
  GITHUB_RAW_URL="gitee.com/naibahq/scripts/raw/main"
86
  GITHUB_URL="gitee.com"
 
111
 
112
  # 设置配置参数,从环境变量读取,如果没有则使用默认值
113
  nz_site_title=${NZ_SITE_TITLE:-"哪吒监控"}
114
+ nz_dashboard_port=${NZ_DASHBOARD_PORT:-"7860"}
115
+ nz_agent_port=${NZ_AGENT_PORT:-"5555"}
116
  nz_tls=${NZ_TLS:-"true"}
117
+ nz_lang=${NZ_LANG:-"zh_CN"}
118
  nz_space_name=${NZ_SPACE_NAME:-"your-space-name"}
119
 
120
  # 生成随机的 csrf token
 
127
  url: "https://${nz_space_name}.hf.space"
128
  language: "${nz_lang}"
129
  http:
130
+ listen: "0.0.0.0:${nz_dashboard_port}"
131
  root: "./static"
132
  grpc:
133
+ listen: "0.0.0.0:${nz_agent_port}"
134
  tls:
135
  enable: ${nz_tls}
136
  cert: "./server.crt"