You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 22, 2021. It is now read-only.
The above command will download the script, save it to `/usr/local/bin/v2script`, make it excutable and start it. To run the script again once installed, just use the following command:
if [[ $(read_json /usr/local/etc/v2script/config.json '.v2ray.install')!="true" ]];then
95
-
local V2_DOMAIN="$(read_json /usr/local/etc/v2script/config.json '.v2ray.tlsHeader')"
96
-
local uuid="$(read_json /etc/v2ray/config.json '.inbounds[0].settings.clients[0].id')"
97
-
local json="{\"add\":\"${V2_DOMAIN}\",\"aid\":\"0\",\"host\":\"\",\"id\":\"${uuid}\",\"net\":\"\",\"path\":\"\",\"port\":\"443\",\"ps\":\"${V2_DOMAIN}:443\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
98
-
local uri="$(printf "${json}"| base64)"
99
-
echo"vmess://${uri}"| tr -d '\n'&&printf"\n"
95
+
if [[ $(read_json /usr/local/etc/v2script/config.json '.v2ray.installed')=="true" ]];then
local V2_DOMAIN="$(read_json /usr/local/etc/v2script/config.json '.v2ray.tlsHeader')"
117
117
local uuid="$(read_json /etc/v2ray/config.json '.inbounds[0].settings.clients[0].id')"
118
-
local json="{\"add\":\"${V2_DOMAIN}\",\"aid\":\"0\",\"host\":\"\",\"id\":\"${uuid}\",\"net\":\"\",\"path\":\"\",\"port\":\"443\",\"ps\":\"${V2_DOMAIN}:443\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
local json="{\"add\":\"${V2_DOMAIN}\",\"aid\":\"0\",\"host\":\"\",\"id\":\"${uuid}\",\"net\":\"\",\"path\":\"\",\"port\":\"443\",\"ps\":\"${V2_DOMAIN}\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
119
+
local uri="$(printf %s "${json}"| base64| tr -d '\n')"
local json="{\"add\":\"${V2_DOMAIN}\",\"aid\":\"0\",\"host\":\"\",\"id\":\"${uuid}\",\"net\":\"\",\"path\":\"\",\"port\":\"443\",\"ps\":\"${remark}\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
155
-
local uri="$(printf "${json}"| base64)"
156
-
local sub="$(printf "vmess://${uri}"| tr -d '\n'| base64)"
155
+
local uri="$(printf %s "${json}"| base64| tr -d '\n')"
156
+
local sub="$(printf %s "vmess://${uri}"|base64 |tr -d '\n')"
157
157
158
-
local randomName="$(cat '/proc/sys/kernel/random/uuid'| sed -e 's/-//g'| tr '[:upper:]''[:lower:]'| head -c 16)"#random file name for subscription
158
+
local randomName="$(uuidgen| sed -e 's/-//g'| tr '[:upper:]''[:lower:]'| head -c 16)"#random file name for subscription
printf %s "${sub}"| tr -d '\n'|${sudoCmd} tee /var/www/html/$(read_json /usr/local/etc/v2script/config.json '.sub.uri')>/dev/null
163
+
164
+
if [[ "$(read_json /usr/local/etc/v2script/config.json '.v2ray.cloudflare')"=="true" ]];then
165
+
local cfUrl="amp.cloudflare.com"
166
+
local currentRemark="$(read_json /usr/local/etc/v2script/config.json '.sub.nodesList.tcp'| sed 's/^vmess:\/\///g'| base64 -d | jq --raw-output '.ps'| tr -d '\n')"
167
+
local json="{\"add\":\"${cfUrl}\",\"aid\":\"0\",\"host\":\"${sni}\",\"id\":\"${uuid}\",\"net\":\"ws\",\"path\":\"/${wssPath}\",\"port\":\"${port}\",\"ps\":\"${currentRemark} (CDN)\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
168
+
local uri="$(printf %s "${json}"| base64 | tr -d '\n')"
local currentRemark="$(read_json /usr/local/etc/v2script/config.json '.sub.nodesList.tcp'| sed 's/^vmess:\/\///g'| base64 -d | jq --raw-output '.ps'| tr -d '\n')"
284
+
local json="{\"add\":\"${cfUrl}\",\"aid\":\"0\",\"host\":\"${sni}\",\"id\":\"${uuid}\",\"net\":\"ws\",\"path\":\"/${wssPath}\",\"port\":\"443\",\"ps\":\"${currentRemark} (CDN)\",\"tls\":\"tls\",\"type\":\"none\",\"v\":\"2\"}"
285
+
local uri="$(printf %s "${json}"| base64 | tr -d '\n')"
286
+
287
+
# updating subscription
288
+
if [[ $(read_json /usr/local/etc/v2script/config.json '.sub.enabled')=="true" ]];then
0 commit comments