From 628dd1b708cefaf17238f2197a5e3efa5c14aac2 Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Mon, 3 Oct 2022 14:18:46 +0800 Subject: [PATCH] Update menu.sh --- menu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/menu.sh b/menu.sh index bec0d5e..c5ad8b0 100644 --- a/menu.sh +++ b/menu.sh @@ -347,6 +347,8 @@ E[170]="Confirm all uninstallation please press [y], other keys do not uninstall C[170]="确认全部卸载请按y,其他键默认不卸载:" E[171]="Uninstall dependencies were complete." C[171]="依赖卸载成功" +E[172]="No suitable solution was found for modifying the wgcf configuration file wgcf.conf and the script aborted. When you see this message, please send feedback on the bug to:[https://github.com/fscarmen/warp/issues]" +C[172]="没有找到适合的方案用于修改 wgcf 配置文件 wgcf.conf,脚本中止。当你看到此信息,请把该 bug 反馈至:[https://github.com/fscarmen/warp/issues]" # 自定义字体彩色,read 函数,友道翻译函数 warning() { echo -e "\033[31m\033[01m$*\033[0m"; } @@ -936,7 +938,7 @@ stack_switch() { * ) warning " $(text 51) [0-2] "; sleep 1; stack_switch;; esac fi - sh -c "$(eval echo "\$SWITCH$TO")" + [ "${#TO}" != 3 ] && error " $(text 172) " || sh -c "$(eval echo "\$SWITCH$TO")" ${SYSTEMCTL_RESTART[int]} OPTION=n && net } @@ -1404,7 +1406,7 @@ install() { MODIFY11N6='sed -i "s/1.1.1.1/1.1.1.1,8.8.8.8,8.8.4.4,2606:4700:4700::1111,2001:4860:4860::8888,2001:4860:4860::8844/g;7 s/^/PostDown = ip -6 rule delete from '$LAN6' lookup main\n/;7 s/^/PostUp = ip -6 rule add from '$LAN6' lookup main\n/;7 s/^/PostDown = ip -4 rule delete from '$LAN4' lookup main\n/;7 s/^/PostUp = ip -4 rule add from '$LAN4' lookup main\n/;s/engage.cloudflareclient.com/[2606:4700:d0::a29f:c001]/g;s/^.*0\.\0\/0/#&/g" wgcf-profile.conf' MODIFY11ND='sed -i "s/1.1.1.1/1.1.1.1,8.8.8.8,8.8.4.4,2606:4700:4700::1111,2001:4860:4860::8888,2001:4860:4860::8844/g;7 s/^/PostDown = ip -6 rule delete from '$LAN6' lookup main\n/;7 s/^/PostUp = ip -6 rule add from '$LAN6' lookup main\n/;7 s/^/PostDown = ip -4 rule delete from '$LAN4' lookup main\n/;7 s/^/PostUp = ip -4 rule add from '$LAN4' lookup main\n/;s/engage.cloudflareclient.com/[2606:4700:d0::a29f:c001]/g" wgcf-profile.conf' - sh -c "$(eval echo "\$MODIFY$CONF")" + [[ "${#CONF}" != [34] ]] && error " $(text 172) " || sh -c "$(eval echo "\$MODIFY$CONF")" if [[ $OCTEEP = 1 ]]; then # 默认 Endpoint 和 DNS 默认 IPv4 和 双栈的,如是 IPv6 修改默认值 @@ -1521,6 +1523,7 @@ EOF ${SYSTEMCTL_ENABLE[int]} >/dev/null 2>&1 fi fi + # 保存好配置文件 mv -f wgcf-account.toml wgcf-profile.conf menu.sh /etc/wireguard >/dev/null 2>&1