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
PKG_VERSION:=1.8.3
PKG_VERSION:=1.8.4
LUCI_TITLE:=LuCI Support for mihomo
LUCI_DEPENDS:=+luci-base +mihomo

View File

@ -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 () {

View File

@ -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);

View File

@ -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
;;

View File

@ -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"]
}
},