openclawsetup 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install.sh
CHANGED
|
@@ -217,13 +217,24 @@ show_installed_info() {
|
|
|
217
217
|
IS_VPS=true
|
|
218
218
|
fi
|
|
219
219
|
|
|
220
|
+
# 获取服务器公网 IP
|
|
221
|
+
SERVER_IP=""
|
|
222
|
+
if [ "$IS_VPS" = true ]; then
|
|
223
|
+
# 尝试多种方式获取公网 IP
|
|
224
|
+
SERVER_IP=$(curl -s --connect-timeout 2 ifconfig.me 2>/dev/null || \
|
|
225
|
+
curl -s --connect-timeout 2 icanhazip.com 2>/dev/null || \
|
|
226
|
+
curl -s --connect-timeout 2 ipinfo.io/ip 2>/dev/null || \
|
|
227
|
+
hostname -I 2>/dev/null | awk '{print $1}' || \
|
|
228
|
+
echo "<服务器IP>")
|
|
229
|
+
fi
|
|
230
|
+
|
|
220
231
|
if [ "$IS_VPS" = true ]; then
|
|
221
232
|
echo -e "${CYAN}\n📡 Dashboard 访问 (云服务器):${NC}"
|
|
222
233
|
echo -e "\033[90m Gateway 默认绑定 127.0.0.1,外部无法直接访问(安全设计)\033[0m"
|
|
223
234
|
echo ""
|
|
224
235
|
echo -e "${YELLOW} 方式一:SSH 隧道(推荐,安全)${NC}"
|
|
225
236
|
echo -e "\033[90m 在本地电脑执行以下命令,保持终端窗口打开:\033[0m"
|
|
226
|
-
echo " ssh -N -L ${PORT:-18789}:127.0.0.1:${PORT:-18789} root
|
|
237
|
+
echo " ssh -N -L ${PORT:-18789}:127.0.0.1:${PORT:-18789} root@${SERVER_IP}"
|
|
227
238
|
echo -e "\033[90m 然后在本地浏览器访问:\033[0m"
|
|
228
239
|
echo -e " ${GREEN}http://127.0.0.1:${PORT:-18789}/?token=${TOKEN:-<你的token>}${NC}"
|
|
229
240
|
echo ""
|
|
@@ -234,7 +245,7 @@ show_installed_info() {
|
|
|
234
245
|
echo -e "\033[90m - 腾讯云:安全组 → 入站规则 → 添加 TCP ${PORT:-18789}\033[0m"
|
|
235
246
|
echo -e "\033[90m - 阿里云:安全组 → 配置规则 → 添加 TCP ${PORT:-18789}\033[0m"
|
|
236
247
|
echo -e "\033[90m 3. 重启 Gateway:$cli_name gateway restart\033[0m"
|
|
237
|
-
echo -e "\033[90m 4. 访问:http
|
|
248
|
+
echo -e "\033[90m 4. 访问:http://${SERVER_IP}:${PORT:-18789}/?token=...\033[0m"
|
|
238
249
|
else
|
|
239
250
|
echo -e "${CYAN}\nDashboard 访问:${NC}"
|
|
240
251
|
echo -e " ${YELLOW}http://127.0.0.1:${PORT:-18789}/?token=${TOKEN:-<你的token>}${NC}"
|
|
@@ -261,7 +272,16 @@ show_menu() {
|
|
|
261
272
|
echo -e " ${YELLOW}2${NC}. 卸载后重新安装(会清除配置)"
|
|
262
273
|
echo -e " ${YELLOW}0${NC}. 退出"
|
|
263
274
|
echo ""
|
|
264
|
-
|
|
275
|
+
|
|
276
|
+
# 从 /dev/tty 读取,支持管道环境
|
|
277
|
+
if [ -t 0 ]; then
|
|
278
|
+
# 标准输入是终端
|
|
279
|
+
read -p "请输入选项编号: " choice
|
|
280
|
+
else
|
|
281
|
+
# 管道环境,从 /dev/tty 读取
|
|
282
|
+
echo -n "请输入选项编号: "
|
|
283
|
+
read choice < /dev/tty
|
|
284
|
+
fi
|
|
265
285
|
echo "$choice"
|
|
266
286
|
}
|
|
267
287
|
|
package/package.json
CHANGED
|
@@ -16,12 +16,12 @@ npx --yes openclawsetup@latest
|
|
|
16
16
|
|
|
17
17
|
**Linux / macOS:**
|
|
18
18
|
```bash
|
|
19
|
-
curl -fsSL https://unpkg.com/openclawsetup/install.sh | bash
|
|
19
|
+
curl -fsSL https://unpkg.com/openclawsetup@latest/install.sh | bash
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
**Windows PowerShell:**
|
|
23
23
|
```powershell
|
|
24
|
-
irm https://unpkg.com/openclawsetup/install.ps1 | iex
|
|
24
|
+
irm https://unpkg.com/openclawsetup@latest/install.ps1 | iex
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### 方式三:指定端口
|