Skip to content

Commit

Permalink
Merge pull request #3836 from Iam54r1n4/dev-patch38
Browse files Browse the repository at this point in the history
Fix disabling unwanted services in apply/install
  • Loading branch information
hiddify-com authored Mar 19, 2024
2 parents 653b042 + 3ad3f28 commit 6f893ba
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 178 deletions.
10 changes: 5 additions & 5 deletions acme.sh/run.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
source ../common/utils.sh
source ./cert_utils.sh

domains=$(cat ../current.json | jq -r '.domains[] | select(.mode | IN("direct", "cdn", "worker", "relay", "auto_cdn_ip", "old_xtls_direct", "sub_link_only")) | .domain')

for d in $domains; do
get_cert $d
get_cert $d
done

domains=$(cat ../current.json | jq -r '.domains[] | select(.mode | IN("fake")) | .domain')

for d in $domains; do
get_self_signed_cert $d
get_self_signed_cert $d
done

for f in ../ssl/*.crt; do
d=$(basename "$f" .crt)
get_self_signed_cert $d
d=$(basename "$f" .crt)
get_self_signed_cert $d
done
systemctl reload hiddify-haproxy
20 changes: 20 additions & 0 deletions common/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,23 @@ function remove_lock() {
LOCK_FILE=$LOCK_DIR/$1.lock
rm -f $LOCK_FILE >/dev/null 2>&1
}


function hconfig() {
local json_file="/opt/hiddify-manager/current.json"
[ ! -f "$json_file" ] && { error "panel config file not found"; return 1; }

local key=$1
local essential_vars=$(jq -r '.chconfigs["0"] | to_entries[] | .key' "$json_file")
for var in $essential_vars; do
if [ "$key" == "$var" ]; then
local value=$(jq -r --arg var "$var" '.chconfigs["0"][$var]' "$json_file")
echo "$value"
return 0 # Exit the function with success status
fi
done

# If the key is not found, return an error status
error "Error: Key not found: $key"
return 1
}
5 changes: 3 additions & 2 deletions haproxy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# sed -i "s|REALITY_SERVER_NAMES|server $REALITY_SERVER_NAMES_HAPROXY|g" haproxy.cfg

#

source ../common/utils.sh
domains=$(cat ../current.json | jq -r '.domains[] | select(.mode | IN("direct", "cdn", "worker", "relay", "auto_cdn_ip", "old_xtls_direct", "sub_link_only", "fake")) | .domain')

# we need at least one ssl certificate to be able to run haproxy
for d in $domains; do
bash ../acme.sh/generate_self_signed_cert.sh $d
bash ../acme.sh/generate_self_signed_cert.sh $d
done

# systemctl reload hiddify-haproxy
Expand Down
Loading

0 comments on commit 6f893ba

Please sign in to comment.