StarrySkyWorld commited on
Commit
167282c
·
verified ·
1 Parent(s): 474eb06

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +56 -5
start.sh CHANGED
@@ -1,9 +1,60 @@
1
- wget \
 
 
 
 
 
2
  --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" \
3
  --header="CF-Access-Client-Id: ${CF_ACCESS_CLIENT_ID}" \
4
  --header="CF-Access-Client-Secret: ${CF_ACCESS_CLIENT_SECRET}" \
5
- https://source.starrysky.ggff.net/sources/cookies.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- echo $(curl https://api.vore.top/api/IPdata?ip=)
8
-
9
- python main.py
 
1
+ #!/bin/bash
2
+
3
+ echo "[INFO] Starting WARP + App..."
4
+
5
+ # 下载 cookies
6
+ wget -q \
7
  --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" \
8
  --header="CF-Access-Client-Id: ${CF_ACCESS_CLIENT_ID}" \
9
  --header="CF-Access-Client-Secret: ${CF_ACCESS_CLIENT_SECRET}" \
10
+ -O cookies.json \
11
+ https://source.starrysky.ggff.net/sources/cookies.json || echo "[]" > cookies.json
12
+
13
+ echo "[INFO] Cookies downloaded"
14
+
15
+ # 检查是否已有 WARP 配置
16
+ if [ ! -f /app/warp/wireproxy.conf ]; then
17
+ echo "[INFO] Registering WARP..."
18
+ mkdir -p /app/warp
19
+ cd /app/warp
20
+
21
+ # 注册 WARP
22
+ wgcf register --accept-tos
23
+
24
+ # 生成 WireGuard 配置
25
+ wgcf generate
26
+
27
+ # 转换为 wireproxy 配置
28
+ cat > wireproxy.conf << 'CONF'
29
+ [Interface]
30
+ PrivateKey = PRIVATE_KEY_PLACEHOLDER
31
+ DNS = 1.1.1.1
32
+ MTU = 1280
33
+
34
+ [Peer]
35
+ PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
36
+ Endpoint = engage.cloudflareclient.com:2408
37
+ AllowedIPs = 0.0.0.0/0, ::/0
38
+
39
+ [Socks5]
40
+ BindAddress = 127.0.0.1:1080
41
+
42
+ [http]
43
+ BindAddress = 127.0.0.1:8080
44
+ CONF
45
+
46
+ # 从生成的配置中提取私钥并替换
47
+ PRIVATE_KEY=$(grep "PrivateKey" wgcf-profile.conf | cut -d' ' -f3)
48
+ sed -i "s|PRIVATE_KEY_PLACEHOLDER|${PRIVATE_KEY}|g" wireproxy.conf
49
+
50
+ cd /app
51
+ fi
52
+
53
+ echo "[INFO] WARP config ready"
54
+
55
+ # 显示当前 IP
56
+ echo "[INFO] Current IP (before WARP):"
57
+ curl -s https://api.vore.top/api/IPdata?ip= || echo "Failed to get IP"
58
 
59
+ # 启动 supervisor(管理 wireproxy 和 python 应用)
60
+ exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf