Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions luci-app-ssr-plus/root/etc/init.d/shadowsocksr
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ prepare_clash_runtime_config() {
local client_policy_stats
local client_rules
local enable_fake_ip
local socks5_auth
local socks5_user
local socks5_pass

cache_file="$(get_clash_cache_file "$sid")"
workdir="$(get_clash_workdir "$sid")"
Expand All @@ -625,6 +628,16 @@ prepare_clash_runtime_config() {
client_policy_stats=""
client_rules=0
enable_fake_ip="$(uci_get_by_type server_subscribe enable_fake_ip "")"
socks5_auth="$(uci_get_by_type socks5_proxy socks5_auth noauth)"
socks5_user="$(uci_get_by_type socks5_proxy socks5_user "")"
socks5_pass="$(uci_get_by_type socks5_proxy socks5_pass "")"

if [ "$socks5_auth" = "password" ]; then
if [ -z "$socks5_user" ] || [ -z "$socks5_pass" ]; then
echolog "警告:SOCKS5 代理未完整配置用户名或密码,已自动降级为无认证模式 (noauth)。"
socks5_auth="noauth"
fi
fi

[ -s "$cache_file" ] || return 1

Expand Down Expand Up @@ -671,6 +684,12 @@ prepare_clash_runtime_config() {

if [ -n "$socks_port" ] && [ "$socks_port" != "0" ]; then
echo "socks-port: $socks_port" >>"$overlay_file"
if [ "$socks5_auth" = "password" ]; then
cat >>"$overlay_file" <<-EOF
authentication:
- "$socks5_user:$socks5_pass"
EOF
fi
fi

merge_stats="$(/usr/bin/lua "$CLASH_YAML_HELPER" merge "$raw_file" "$overlay_file" "$runtime_file" 2>/dev/null)" || return 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ local function load_yaml(path)
end

local function quote_nameserver_policy_keys(rendered)
rendered = rendered:gsub("[^\n]*", function(line)
rendered = rendered:gsub("[^\n]+", function(line)
local indent = line:match("^(%s*)geosite:geolocation%-!cn:%s*$")
if indent then
return indent .. '"geosite:geolocation-!cn":'
Expand Down
Loading