From c020494cb58768e0fed5fd4c9056b16598846862 Mon Sep 17 00:00:00 2001 From: mango Date: Fri, 17 Apr 2026 00:46:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E8=A2=AB=E8=A7=A3?= =?UTF-8?q?=E9=94=81=E6=9C=BA=E5=8D=B8=E8=BD=BD=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=8E=9F=E7=8A=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/stream-unlock.sh | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/scripts/stream-unlock.sh b/scripts/stream-unlock.sh index ea2245c..0bb4bb7 100644 --- a/scripts/stream-unlock.sh +++ b/scripts/stream-unlock.sh @@ -597,15 +597,40 @@ menu_client() { echo "TikTok: $(dig +short tiktok.com @127.0.0.1 2>/dev/null | head -1)" ;; 5) - echo -e "${RED}确定要卸载 smartdns?(y/n): ${NC}" + echo -e "${RED}确定要卸载并恢复原状?(y/n): ${NC}" read -p "" confirm [[ "$confirm" == "y" ]] && { - systemctl stop smartdns - systemctl disable smartdns + echo -e "${YELLOW}正在卸载 smartdns...${NC}" + systemctl stop smartdns 2>/dev/null || true + systemctl disable smartdns 2>/dev/null || true + pkill -9 smartdns 2>/dev/null || true + + # 恢复原 DNS chattr -i /etc/resolv.conf 2>/dev/null || true - [[ -f /etc/resolv.conf.bak ]] && mv /etc/resolv.conf.bak /etc/resolv.conf + if [[ -f /etc/resolv.conf.bak ]]; then + mv /etc/resolv.conf.bak /etc/resolv.conf + echo -e "${GREEN}已恢复原 DNS 配置${NC}" + else + # 创建默认 DNS 配置 + cat > /etc/resolv.conf << 'EOF' +nameserver 8.8.8.8 +nameserver 1.1.1.1 +EOF + echo -e "${GREEN}已恢复默认 DNS${NC}" + fi + + # 删除 smartdns rm -rf /etc/smartdns - echo -e "${GREEN}smartdns 已卸载${NC}" + rm -f /var/run/smartdns.pid + + # 可选:卸载软件包 + read -p "是否同时卸载 smartdns 软件包?(y/n): " remove_pkg + [[ "$remove_pkg" == "y" ]] && { + apt remove -y smartdns 2>/dev/null || yum remove -y smartdns 2>/dev/null || true + echo -e "${GREEN}smartdns 软件包已卸载${NC}" + } + + echo -e "${GREEN}=== 卸载完成,系统已恢复原状 ===${NC}" } ;; *)