Skip to content

Commit

Permalink
allow full domain name to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Snawoot committed May 7, 2021
1 parent 9f55cab commit a3a2974
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},

"AppName": {
"description": "App Name filled in at the top to generate the configuration and QR code. If you don’t want to generate it, enter no",
"description": "App Name filled in at the top (or even full domain if there is a custom one) to generate the configuration and QR code. If you don’t want to generate it, enter no",
"value": "no"
},

Expand Down
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ if [[ -z "${QR_Path}" ]]; then
fi
echo ${QR_Path}

case "$AppName" in
*.*)
export DOMAIN="$AppName"
;;
*)
export DOMAIN="$AppName.herokuapp.com"
;;
esac

bash /conf/shadowsocks-libev_config.json > /etc/shadowsocks-libev/config.json
echo /etc/shadowsocks-libev/config.json
cat /etc/shadowsocks-libev/config.json
Expand All @@ -34,8 +43,8 @@ if [ "$AppName" = "no" ]; then
echo "Do not generate QR-code"
else
[ ! -d /wwwroot/${QR_Path} ] && mkdir /wwwroot/${QR_Path}
plugin=$(echo -n "v2ray;path=/${V2_Path};host=${AppName}.herokuapp.com;tls" | sed -e 's/\//%2F/g' -e 's/=/%3D/g' -e 's/;/%3B/g')
ss="ss://$(echo -n ${ENCRYPT}:${PASSWORD} | base64 -w 0)@${AppName}.herokuapp.com:443?plugin=${plugin}"
plugin=$(echo -n "v2ray;path=/${V2_Path};host=${DOMAIN};tls" | sed -e 's/\//%2F/g' -e 's/=/%3D/g' -e 's/;/%3B/g')
ss="ss://$(echo -n ${ENCRYPT}:${PASSWORD} | base64 -w 0)@${DOMAIN}:443?plugin=${plugin}"
echo "${ss}" | tr -d '\n' > /wwwroot/${QR_Path}/index.html
echo -n "${ss}" | qrencode -s 6 -o /wwwroot/${QR_Path}/vpn.png
fi
Expand Down

0 comments on commit a3a2974

Please sign in to comment.