mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-16 04:25:45 +00:00
commit
4fe5269198
1 changed files with 20 additions and 1 deletions
|
|
@ -1,5 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
trim() {
|
||||||
|
local -n ref=$1
|
||||||
|
ref="${ref#"${ref%%[![:space:]]*}"}"
|
||||||
|
ref="${ref%"${ref##*[![:space:]]}"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_gsettings_array() {
|
||||||
|
[[ -z "$1" ]] && echo "[]" && return
|
||||||
|
local host joined hosts=()
|
||||||
|
IFS=',' read -ra parts <<< "$1"
|
||||||
|
for host in "${parts[@]}"; do
|
||||||
|
trim host
|
||||||
|
[[ -n "$host" ]] && hosts+=("$host")
|
||||||
|
done
|
||||||
|
[[ ${#hosts[@]} -eq 0 ]] && echo "[]" && return
|
||||||
|
printf -v joined "'%s'," "${hosts[@]}"
|
||||||
|
echo "[${joined%,}]"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to set proxy for GNOME
|
# Function to set proxy for GNOME
|
||||||
set_gnome_proxy() {
|
set_gnome_proxy() {
|
||||||
local MODE=$1
|
local MODE=$1
|
||||||
|
|
@ -21,7 +40,7 @@ set_gnome_proxy() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Set ignored hosts
|
# Set ignored hosts
|
||||||
gsettings set org.gnome.system.proxy ignore-hosts "['$IGNORE_HOSTS']"
|
gsettings set org.gnome.system.proxy ignore-hosts "$(build_gsettings_array "$IGNORE_HOSTS")"
|
||||||
|
|
||||||
echo "GNOME: Manual proxy settings applied."
|
echo "GNOME: Manual proxy settings applied."
|
||||||
echo "Proxy IP: $PROXY_IP"
|
echo "Proxy IP: $PROXY_IP"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue