diff --git a/luci-app-mihomo/Makefile b/luci-app-mihomo/Makefile index 0dc3a917e..c6dca4cd6 100644 --- a/luci-app-mihomo/Makefile +++ b/luci-app-mihomo/Makefile @@ -1,6 +1,6 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.8.3 +PKG_VERSION:=1.8.4 LUCI_TITLE:=LuCI Support for mihomo LUCI_DEPENDS:=+luci-base +mihomo diff --git a/luci-app-mihomo/htdocs/luci-static/resources/tools/mihomo.js b/luci-app-mihomo/htdocs/luci-static/resources/tools/mihomo.js index d04476e75..3433ae97c 100644 --- a/luci-app-mihomo/htdocs/luci-static/resources/tools/mihomo.js +++ b/luci-app-mihomo/htdocs/luci-static/resources/tools/mihomo.js @@ -8,9 +8,10 @@ const homeDir = '/etc/mihomo'; const profilesDir = `${homeDir}/profiles`; const mixinFilePath = `${homeDir}/mixin.yaml`; const runDir = `${homeDir}/run`; -const runAppLogPath = `${runDir}/app.log`; -const runCoreLogPath = `${runDir}/core.log`; const runProfilePath = `${runDir}/config.yaml`; +const logDir = `/var/log/mihomo`; +const appLogPath = `${logDir}/app.log`; +const coreLogPath = `${logDir}/core.log`; const nftDir = `${homeDir}/nftables`; const reservedIPNFT = `${nftDir}/reserved_ip.nft`; const reservedIP6NFT = `${nftDir}/reserved_ip6.nft`; @@ -20,8 +21,8 @@ return baseclass.extend({ profilesDir: profilesDir, mixinFilePath: mixinFilePath, runDir: runDir, - runAppLogPath: runAppLogPath, - runCoreLogPath: runCoreLogPath, + appLogPath: appLogPath, + coreLogPath: coreLogPath, runProfilePath: runProfilePath, reservedIPNFT: reservedIPNFT, reservedIP6NFT: reservedIP6NFT, @@ -34,19 +35,19 @@ return baseclass.extend({ }), getAppLog: function () { - return L.resolveDefault(fs.read_direct(this.runAppLogPath)); + return L.resolveDefault(fs.read_direct(this.appLogPath)); }, getCoreLog: function () { - return L.resolveDefault(fs.read_direct(this.runCoreLogPath)); + return L.resolveDefault(fs.read_direct(this.coreLogPath)); }, clearAppLog: function () { - return fs.exec_direct('/usr/libexec/mihomo-call', ['clear', 'app_log']); + return fs.exec_direct('/usr/libexec/mihomo-call', ['clear_log', 'app']); }, clearCoreLog: function () { - return fs.exec_direct('/usr/libexec/mihomo-call', ['clear', 'core_log']); + return fs.exec_direct('/usr/libexec/mihomo-call', ['clear_log', 'core']); }, listProfiles: function () { diff --git a/luci-app-mihomo/htdocs/luci-static/resources/view/mihomo/config.js b/luci-app-mihomo/htdocs/luci-static/resources/view/mihomo/config.js index 2d461bda2..05b732655 100644 --- a/luci-app-mihomo/htdocs/luci-static/resources/view/mihomo/config.js +++ b/luci-app-mihomo/htdocs/luci-static/resources/view/mihomo/config.js @@ -111,7 +111,7 @@ return view.extend({ o.depends('scheduled_restart', '1'); o = s.option(form.ListValue, 'profile', _('Choose Profile')); - o.rmempty = false; + o.optional = true; for (const profile of profiles) { o.value('file:' + profile.name, _('File:') + profile.name); diff --git a/luci-app-mihomo/root/usr/libexec/mihomo-call b/luci-app-mihomo/root/usr/libexec/mihomo-call index bb8a17baf..e5bd65a75 100755 --- a/luci-app-mihomo/root/usr/libexec/mihomo-call +++ b/luci-app-mihomo/root/usr/libexec/mihomo-call @@ -6,13 +6,13 @@ action=$1 shift case "$action" in - clear) + clear_log) case "$1" in - app_log) - echo -n > "$RUN_APP_LOG_PATH" + app) + echo -n > "$APP_LOG_PATH" ;; - core_log) - echo -n > "$RUN_CORE_LOG_PATH" + core) + echo -n > "$CORE_LOG_PATH" ;; esac ;; diff --git a/luci-app-mihomo/root/usr/share/rpcd/acl.d/luci-app-mihomo.json b/luci-app-mihomo/root/usr/share/rpcd/acl.d/luci-app-mihomo.json index d1de3b1c9..9a5931460 100644 --- a/luci-app-mihomo/root/usr/share/rpcd/acl.d/luci-app-mihomo.json +++ b/luci-app-mihomo/root/usr/share/rpcd/acl.d/luci-app-mihomo.json @@ -13,7 +13,7 @@ "/etc/mihomo/run/config.yaml": ["read"], "/etc/mihomo/nftables/reserved_ip.nft": ["read"], "/etc/mihomo/nftables/reserved_ip6.nft": ["read"], - "/etc/mihomo/run/*.log": ["read"], + "/var/log/mihomo/*.log": ["read"], "/usr/libexec/mihomo-call": ["exec"] } },