kiddin9 / Kwrt

一分钟在线定制编译 X86/64, NanoPi R2S R4S R5S R6S, 斐讯 Phicomm N1 K2P, 树莓派 Raspberry Pi, 香橙派 Orange Pi, 红米AX6, 小米AX3600, 小米AX9000, 红米AX6S 小米AX3200, 红米AC2100, 华硕ASUS, 网件NETGEAR 等主流软硬路由
https://openwrt.ai
MIT License
7.73k stars 3.07k forks source link

7.26以后的新版本快捷访问不可用,希望可以重新添加这个功能 #1841

Open kingfingerpro opened 2 months ago

kingfingerpro commented 2 months ago

检查脚本之后发现是新版本修改了 /etc/init.d/dnsmasq ,删除了一段代码导致的

    network_get_ipaddr lanaddr "lan"
    if [ -n $lanaddr ]; then
    lanaddr="$(echo "$lanaddr" | sed -e "s/\/24//")"
    echo "
    $lanaddr op" >/tmp/hosts/shortcuts
    if [ -f /etc/nginx/conf.d/shortcuts.conf ]; then
    if [[ "$lanaddr" != "`grep "set \$ip" /etc/nginx/conf.d/shortcuts.conf | head -n1 | cut -f 3 -d " " | sed -e 's/;//'`" ]]; then
        sed -i "/set \$ip/c\set \$ip $lanaddr;" /etc/nginx/conf.d/shortcuts.conf
        /etc/init.d/nginx reload
    fi
    cat /etc/nginx/conf.d/shortcuts.conf | tr "\n" "\r" |grep -oE 'server_name [a-z.-]*;[^;]*set \$ip [0-9.]*;' | sed -e 's/server_name \(.*\);.*location.*set $ip \(.*\);/\2 \1/' >>/tmp/hosts/shortcuts
    cat /etc/nginx/conf.d/shortcuts.conf | tr "\n" "\r" |grep -oE 'server_name [a-z.-]*;[^;]*return 301 \$scheme://op' | sed -e 's/server_name \(.*\?\);.*/\1/' | sed -e "s/^/$lanaddr /">>/tmp/hosts/shortcuts
    fi
    fi

image 希望大佬能把这个功能加回来