forked from 6otho/xray-for-codesandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
70 lines (63 loc) · 2.79 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
UUID=${UUID:-'de04add9-5c68-8bab-950c-08cd5320df18'}
VMESS_WSPATH=${VMESS_WSPATH:-'/vmess'}
VLESS_WSPATH=${VLESS_WSPATH:-'/vless'}
TROJAN_WSPATH=${TROJAN_WSPATH:-'/trojan'}
SS_WSPATH=${SS_WSPATH:-'/shadowsocks'}
URL=${HOSTNAME}-8080.csb.app
sed -i "s#UUID#$UUID#g;s#VMESS_WSPATH#$VMESS_WSPATH#g;s#VLESS_WSPATH#$VLESS_WSPATH#g;s#TROJAN_WSPATH#${TROJAN_WSPATH}#g;s#SS_WSPATH#${SS_WSPATH}#g" /etc/xray/config.json
sed -i "s#VMESS_WSPATH#$VMESS_WSPATH#g;s#VLESS_WSPATH#$VLESS_WSPATH#g;s#TROJAN_WSPATH#${TROJAN_WSPATH}#g;s#SS_WSPATH#${SS_WSPATH}#g" /etc/nginx/nginx.conf
vmlink=vmess://$(echo -n "{\"v\":\"2\",\"ps\":\"repl\",\"add\":\"$URL\",\"port\":\"443\",\"id\":\"$UUID\",\"aid\":\"0\",\"net\":\"ws\",\"type\":\"none\",\"host\":\"$URL\",\"path\":\"$VMESS_WSPATH?ed=2048\",\"tls\":\"tls\"}" | base64 -w 0)
vllink="vless://"$UUID"@"$URL":443?encryption=none&security=tls&type=ws&host="$URL"&path="$VLESS_WSPATH"?ed=2048#codesandbox_vless"
trlink="trojan://"$UUID"@"$URL":443?security=tls&type=ws&host="$URL"&path="$TROJAN_WSPATH"?ed2048#codesandbox_trojan"
rm -rf /usr/share/nginx/*
wget https://gitlab.com/Misaka-blog/xray-paas/-/raw/main/mikutap.zip -O /usr/share/nginx/mikutap.zip
unzip -o "/usr/share/nginx/mikutap.zip" -d /usr/share/nginx/html
rm -f /usr/share/nginx/mikutap.zip
qrencode -o /usr/share/nginx/html/M$UUID.png $vmlink
qrencode -o /usr/share/nginx/html/L$UUID.png $vllink
qrencode -o /usr/share/nginx/html/T$UUID.png $trlink
cat > /usr/share/nginx/html/$UUID.html<<-EOF
<html>
<head>
<title>Codesandbox</title>
<style type="text/css">
body {
font-family: Geneva, Arial, Helvetica, san-serif;
}
div {
margin: 0 auto;
text-align: left;
white-space: pre-wrap;
word-break: break-all;
max-width: 80%;
margin-bottom: 10px;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div><font color="#009900"><b>VMESS协议链接:</b></font></div>
<div>$vmlink</div>
<div><font color="#009900"><b>VMESS协议二维码:</b></font></div>
<div><img src="/M$UUID.png"></div>
<div><font color="#009900"><b>VLESS协议链接:</b></font></div>
<div>$vllink</div>
<div><font color="#009900"><b>VLESS协议二维码:</b></font></div>
<div><img src="/L$UUID.png"></div>
<div><font color="#009900"><b>TROJAN协议链接:</b></font></div>
<div>$trlink</div>
<div><font color="#009900"><b>TROJAN协议二维码:</b></font></div>
<div><img src="/T$UUID.png"></div>
<div><font color="#009900"><b>SS协议明文:</b></font></div>
<div>服务器地址:$URL</div>
<div>端口:443</div>
<div>密码:$UUID</div>
<div>加密方式:chacha20-ietf-poly1305</div>
<div>传输协议:ws</div>
<div>host:$URL</div>
<div>path路径:$SS_WSPATH?ed=2048</div>
<div>TLS:开启</div>
</body>
</html>
EOF
echo "可在此网址查看 xray 节点信息:https://$URL/$UUID.html" > /usr/local/xray/info