update
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 检查 jq 命令是否可用
|
||||||
|
if ! command -v jq &> /dev/null
|
||||||
|
then
|
||||||
|
echo "jq 命令未安装,请先安装 jq。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 获取脚本所在目录的上级目录路径
|
||||||
|
script_dir=$(cd "$(dirname "$0")"; pwd)
|
||||||
|
parent_dir=$(dirname "$script_dir")
|
||||||
|
|
||||||
|
# 读取 config.json 文件
|
||||||
|
config=$(cat "$parent_dir/config.json")
|
||||||
|
|
||||||
|
# 提取所需信息
|
||||||
|
password=$(echo "$config" | jq -r '.auth.password')
|
||||||
|
hostname=$(echo "$config" | jq -r '.listen' | cut -d':' -f2)
|
||||||
|
sni=$(echo "$config" | jq -r '.masquerade.proxy.url' | awk -F'/' '{print $3}')
|
||||||
|
|
||||||
|
# 构建分享链接
|
||||||
|
share_link="hysteria2://${password}@${hostname}/?sni=${sni}&insecure=1#RN%E7%BE%8E%E5%9B%BD_hy2"
|
||||||
|
|
||||||
|
# 输出分享链接
|
||||||
|
echo "$share_link"
|
||||||
Reference in New Issue
Block a user