Files
op-packages/.github/diy/packages/luci-app-quickstart/root/etc/uci-defaults/50_luci-quickstart
T
2026-11-16 21:58:50 +08:00

31 lines
1.7 KiB
Bash

#!/bin/sh
APP_JS="/www/luci-static/quickstart/app.js"
sed -i -E '
# 1. 去除首页顶部 iStoreOS官网
s/[^[]*\("iStoreOS官网","iStoreOS website"\)\),1\),//
# 2. 主题跟随系统判断 html[data-darkmode="true"] 并监听属性变化
s/\([^()]*\.matches\)!=null\?[^:]*:window\.matchMedia\([^)]*\)\.matches/document.documentElement.dataset.darkmode==="true"/
s/\.addEventListener\("change",([^)]+)\)/&,(new MutationObserver(\1)).observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})/
# 3. 去除网络连接卡片中的软件源检测与配置
s/[a-zA-Z0-9_$]+\.networkInfo/&==="softSourceFailed"?"netSuccess":&/
s/,"softSourceFailed"|,softSourceFailed:\[[^]]*\]|:[^:?]*==="softSourceFailed"\?"source"//g
# 4. 移除指定工具入口(如 tool-source, tool-firmware, tool-sandbox)与“恢复默认八项”按钮
s/,\{id:"tool-(source|firmware|sandbox)"[^}]*\}|,"tool-(source|firmware|sandbox)"//g
s/get favorites\(\)\{return ([^}]*\.favorites)\}/get favorites(){return \1.filter(y=>!["tool-source","tool-firmware","tool-sandbox"].includes(y))}/
s/,[a-zA-Z0-9_$]+\("button",\{[^}]*"data-shortcut-restore":""\},[^}]*\("恢复默认八项","Restore eight defaults"\)\),1\)//
s,admin/store,admin/services/store,
# 5. 自定义链接支持 / 开头的绝对路径(保存时转为 http://localhost/... 以通过后端校验,展示与跳转时还原为 /...)
s/!\/\^https\?:\\\/\\\/\/\.test\(([a-zA-Z0-9_$]+\.url)\)/(\/^\\\/(?!\\\/)\/.test(\1)\&\&(\1="http:\/\/localhost"+\1),&)/
s/path:([a-zA-Z0-9_$]+\.url),/path:\1.replace(\/^http:\\\/\\\/localhost(?=\\\/)\/,""),/
' "$APP_JS"
rm -f /tmp/luci-indexcache /tmp/luci-indexcache.*
exit 0