luci-app-mihomo: sync upstream

last commit: d641bfc31c
This commit is contained in:
gitea-action 2024-09-30 11:00:47 +08:00
parent de78dc91c2
commit 722ef65e53
5 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,6 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_VERSION:=1.8.3 PKG_VERSION:=1.8.4
LUCI_TITLE:=LuCI Support for mihomo LUCI_TITLE:=LuCI Support for mihomo
LUCI_DEPENDS:=+luci-base +mihomo LUCI_DEPENDS:=+luci-base +mihomo

View File

@ -8,9 +8,10 @@ const homeDir = '/etc/mihomo';
const profilesDir = `${homeDir}/profiles`; const profilesDir = `${homeDir}/profiles`;
const mixinFilePath = `${homeDir}/mixin.yaml`; const mixinFilePath = `${homeDir}/mixin.yaml`;
const runDir = `${homeDir}/run`; const runDir = `${homeDir}/run`;
const runAppLogPath = `${runDir}/app.log`;
const runCoreLogPath = `${runDir}/core.log`;
const runProfilePath = `${runDir}/config.yaml`; 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 nftDir = `${homeDir}/nftables`;
const reservedIPNFT = `${nftDir}/reserved_ip.nft`; const reservedIPNFT = `${nftDir}/reserved_ip.nft`;
const reservedIP6NFT = `${nftDir}/reserved_ip6.nft`; const reservedIP6NFT = `${nftDir}/reserved_ip6.nft`;
@ -20,8 +21,8 @@ return baseclass.extend({
profilesDir: profilesDir, profilesDir: profilesDir,
mixinFilePath: mixinFilePath, mixinFilePath: mixinFilePath,
runDir: runDir, runDir: runDir,
runAppLogPath: runAppLogPath, appLogPath: appLogPath,
runCoreLogPath: runCoreLogPath, coreLogPath: coreLogPath,
runProfilePath: runProfilePath, runProfilePath: runProfilePath,
reservedIPNFT: reservedIPNFT, reservedIPNFT: reservedIPNFT,
reservedIP6NFT: reservedIP6NFT, reservedIP6NFT: reservedIP6NFT,
@ -34,19 +35,19 @@ return baseclass.extend({
}), }),
getAppLog: function () { getAppLog: function () {
return L.resolveDefault(fs.read_direct(this.runAppLogPath)); return L.resolveDefault(fs.read_direct(this.appLogPath));
}, },
getCoreLog: function () { getCoreLog: function () {
return L.resolveDefault(fs.read_direct(this.runCoreLogPath)); return L.resolveDefault(fs.read_direct(this.coreLogPath));
}, },
clearAppLog: function () { 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 () { 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 () { listProfiles: function () {

View File

@ -111,7 +111,7 @@ return view.extend({
o.depends('scheduled_restart', '1'); o.depends('scheduled_restart', '1');
o = s.option(form.ListValue, 'profile', _('Choose Profile')); o = s.option(form.ListValue, 'profile', _('Choose Profile'));
o.rmempty = false; o.optional = true;
for (const profile of profiles) { for (const profile of profiles) {
o.value('file:' + profile.name, _('File:') + profile.name); o.value('file:' + profile.name, _('File:') + profile.name);

View File

@ -6,13 +6,13 @@ action=$1
shift shift
case "$action" in case "$action" in
clear) clear_log)
case "$1" in case "$1" in
app_log) app)
echo -n > "$RUN_APP_LOG_PATH" echo -n > "$APP_LOG_PATH"
;; ;;
core_log) core)
echo -n > "$RUN_CORE_LOG_PATH" echo -n > "$CORE_LOG_PATH"
;; ;;
esac esac
;; ;;

View File

@ -13,7 +13,7 @@
"/etc/mihomo/run/config.yaml": ["read"], "/etc/mihomo/run/config.yaml": ["read"],
"/etc/mihomo/nftables/reserved_ip.nft": ["read"], "/etc/mihomo/nftables/reserved_ip.nft": ["read"],
"/etc/mihomo/nftables/reserved_ip6.nft": ["read"], "/etc/mihomo/nftables/reserved_ip6.nft": ["read"],
"/etc/mihomo/run/*.log": ["read"], "/var/log/mihomo/*.log": ["read"],
"/usr/libexec/mihomo-call": ["exec"] "/usr/libexec/mihomo-call": ["exec"]
} }
}, },