v1.0.0beta14fix3

~修复部分ssr节点不可用的bug
~mac过滤功能增加移除单个设备以及添加全部设备功能
~修复设置本机代理时直接跳出的bug
~优化安装脚本,增加root用户检测
This commit is contained in:
juewuy
2020-10-11 21:30:20 +08:00
parent 156d9193ee
commit 87ae8b78be
14 changed files with 32 additions and 173 deletions

View File

@@ -725,18 +725,16 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
if [ "$local_proxy" = "未开启" ] > /dev/null 2>&1; then
sed -i "1i\local_proxy=已开启" $ccfg
local_proxy=已开启
source $clashdir/start.sh
set_proxy
$clashdir/start.sh set_proxy $mix_port
echo -e "\033[32m已经将代理参数写入环境变量~\033[0m"
echo -e "\033[36m如未生效请重新登录或者重启设备\033[0m"
sleep 1
echo -e "\033[36m如未生效请重新启动终端或重新连接SSH\033[0m"
else
sed -i "1i\local_proxy=未开启" $ccfg
local_proxy=未开启
source $clashdir/start.sh
unset_proxy
$clashdir/start.sh unset_proxy
echo -e "\033[33m已经将代理参数从环境变量移除\033[0m"
fi
sleep 1
clashadv
elif [[ $num == 5 ]]; then
setport

View File

@@ -285,16 +285,6 @@ daemon(){
echo 请进入定时任务菜单手动指定系统定时任务文件路径!!!
fi
}
set_proxy(){
echo 'export http_proxy=http://127.0.0.1:'"$mix_port" >> /etc/profile
echo 'export https_proxy=$http_proxy' >> /etc/profile
echo 'export HTTP_PROXY=$http_proxy' >> /etc/profile
echo 'export HTTPS_PROXY=$http_proxy' >> /etc/profile
}
unset_proxy(){
sed -i '/http*_proxy/'d /etc/profile
sed -i '/HTTP*_PROXY/'d /etc/profile
}
web_save(){
#使用curl获取面板节点设置
curl -s -H "Authorization: Bearer ${secret}" -H "Content-Type:application/json" http://localhost:${db_port}/proxies | awk -F "{" '{for(i=1;i<=NF;i++) print $i}' | grep -E '^"all".*"Selector"' | grep -oE '"name".*"now".*",' | sed 's/"name"://g' | sed 's/"now"://g'| sed 's/"//g' > $clashdir/web_save
@@ -338,7 +328,7 @@ afstart(){
#标记启动时间
mark_time
#设置本机代理
[ "$local_proxy" = "已开启" ] && set_proxy
[ "$local_proxy" = "已开启" ] && $0 set_proxy $mix_port
#启用面板配置自动保存
web_save_auto
#后台还原面板配置
@@ -385,7 +375,7 @@ stop)
#清理iptables
stop_iptables
#禁用本机代理
[ "$local_proxy" = "已开启" ] && unset_proxy
[ "$local_proxy" = "已开启" ] && $0 unset_proxy
;;
restart)
$0 stop
@@ -402,9 +392,13 @@ web_save)
getconfig
web_save
;;
web_restore)
getconfig
web_restore
set_proxy)
echo 'export all_proxy=http://127.0.0.1:'"$2" >> /etc/profile
echo 'export ALL_PROXY=$all_proxy' >> /etc/profile
;;
unset_proxy)
sed -i '/all_proxy/'d /etc/profile
sed -i '/ALL_PROXY/'d /etc/profile
;;
esac