Just Isolate some codes (not complete)
This commit is contained in:
62
menu.sh
62
menu.sh
@ -241,35 +241,6 @@ modify_users() {
|
||||
python3 "$modify_script"
|
||||
}
|
||||
|
||||
# TODO: remove
|
||||
# Function to uninstall Hysteria2
|
||||
uninstall_hysteria() {
|
||||
echo "Uninstalling Hysteria2..."
|
||||
sleep 1
|
||||
echo "Running uninstallation script..."
|
||||
bash <(curl -fsSL https://get.hy2.sh/) --remove >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Removing Hysteria folder..."
|
||||
rm -rf /etc/hysteria >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Deleting hysteria user..."
|
||||
userdel -r hysteria >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Removing systemd service files..."
|
||||
rm -f /etc/systemd/system/multi-user.target.wants/hysteria-server.service >/dev/null 2>&1
|
||||
rm -f /etc/systemd/system/multi-user.target.wants/hysteria-server@*.service >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Reloading systemd daemon..."
|
||||
systemctl daemon-reload >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Removing cron jobs..."
|
||||
(crontab -l | grep -v "python3 /etc/hysteria/traffic.py" | crontab -) >/dev/null 2>&1
|
||||
(crontab -l | grep -v "/etc/hysteria/users/kick.sh" | crontab -) >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Hysteria2 uninstalled!"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Function to install WARP and update config.json
|
||||
install_warp() {
|
||||
# Check if wg-quick@wgcf.service is active
|
||||
@ -292,39 +263,6 @@ install_warp() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to uninstall WARP and update config.json
|
||||
uninstall_warp() {
|
||||
if systemctl is-active --quiet wg-quick@wgcf.service; then
|
||||
echo "Uninstalling WARP..."
|
||||
bash <(curl -fsSL git.io/warp.sh) dwg
|
||||
|
||||
if [ -f "/etc/hysteria/config.json" ]; then
|
||||
default_config='["reject(geosite:ir)", "reject(geoip:ir)", "reject(geosite:category-ads-all)", "reject(geoip:private)", "reject(geosite:google@ads)"]'
|
||||
|
||||
jq --argjson default_config "$default_config" '
|
||||
.acl.inline |= map(
|
||||
if . == "warps(all)" or . == "warps(geoip:google)" or . == "warps(geosite:google)" or . == "warps(geosite:netflix)" or . == "warps(geosite:spotify)" or . == "warps(geosite:openai)" or . == "warps(geoip:openai)" then
|
||||
"direct"
|
||||
elif . == "warps(geosite:ir)" then
|
||||
"reject(geosite:ir)"
|
||||
elif . == "warps(geoip:ir)" then
|
||||
"reject(geoip:ir)"
|
||||
else
|
||||
.
|
||||
end
|
||||
) | .acl.inline |= ($default_config + (. - $default_config | map(select(. != "direct"))))
|
||||
' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||
jq 'del(.outbounds[] | select(.name == "warps" and .type == "direct" and .direct.mode == 4 and .direct.bindDevice == "wgcf"))' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||
|
||||
restart_hysteria_service >/dev/null 2>&1
|
||||
echo "WARP uninstalled and configurations reset to default."
|
||||
else
|
||||
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
||||
fi
|
||||
else
|
||||
echo "WARP is not active. Skipping uninstallation."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to configure WARP
|
||||
configure_warp() {
|
||||
|
||||
Reference in New Issue
Block a user