luci-app-nikki: sync upstream

last commit: 277a7d97d9
This commit is contained in:
gitea-action 2025-03-23 17:30:27 +08:00
parent 7c26f5db01
commit ef1cf031f5
4 changed files with 11 additions and 10 deletions

View File

@ -62,6 +62,7 @@ const proxyProvidersDir = `${providersDir}/proxy`;
const logDir = `/var/log/nikki`;
const appLogPath = `${logDir}/app.log`;
const coreLogPath = `${logDir}/core.log`;
const debugLogPath = `${logDir}/debug.log`;
const nftDir = `${homeDir}/nftables`;
const reservedIPNFT = `${nftDir}/reserved_ip.nft`;
const reservedIP6NFT = `${nftDir}/reserved_ip6.nft`;
@ -76,6 +77,7 @@ return baseclass.extend({
runDir: runDir,
appLogPath: appLogPath,
coreLogPath: coreLogPath,
debugLogPath: debugLogPath,
runProfilePath: runProfilePath,
reservedIPNFT: reservedIPNFT,
reservedIP6NFT: reservedIP6NFT,

View File

@ -97,13 +97,13 @@ return view.extend({
o.inputtitle = _('Generate & Download');
o.onclick = function () {
return nikki.debug().then(function () {
fs.read_direct('/var/run/nikki/debug.md', 'blob').then(function (data) {
fs.read_direct(nikki.debugLogPath, 'blob').then(function (data) {
// create url
const url = window.URL.createObjectURL(data, { type: 'text/markdown' });
// create link
const link = document.createElement('a');
link.href = url;
link.download = 'debug.md';
link.download = 'debug.log';
// append to body
document.body.appendChild(link);
// download

View File

@ -18,8 +18,7 @@
"/etc/nikki/run/providers/proxy/*": ["read"],
"/etc/nikki/nftables/reserved_ip.nft": ["read"],
"/etc/nikki/nftables/reserved_ip6.nft": ["read"],
"/var/log/nikki/*.log": ["read"],
"/var/run/nikki/debug.md": ["read"]
"/var/log/nikki/*.log": ["read"]
}
},
"write": {

View File

@ -12,20 +12,20 @@ const methods = {
let app = '';
if (system('command -v opkg') == 0) {
process = popen('opkg list-installed luci-app-nikki | cut -d " " -f 3');
if (process != null) {
if (process) {
app = trim(process.read('all'));
process.close();
}
} else if (system('command -v apk') == 0) {
process = popen('apk list -I luci-app-nikki | cut -d " " -f 1 | cut -d "-" -f 4');
if (process != null) {
if (process) {
app = trim(process.read('all'));
process.close();
}
}
let core = '';
process = popen('mihomo -v | grep Mihomo | cut -d " " -f 3');
if (process != null) {
if (process) {
core = trim(process.read('all'));
process.close();
}
@ -38,8 +38,8 @@ const methods = {
const filepath = '/etc/nikki/run/config.yaml';
if (access(filepath, 'r')) {
const process = popen(`yq -p yaml -o json < ${filepath}`);
if (process != null) {
profile = json(process.read('all'));
if (process) {
profile = json(trim(process.read('all')));
process.close();
}
}
@ -67,7 +67,7 @@ const methods = {
},
debug: {
call: function() {
const success = system('/etc/nikki/scripts/debug.sh > /var/run/nikki/debug.md') == 0;
const success = system('/etc/nikki/scripts/debug.sh > /var/log/nikki/debug.log') == 0;
return { success: success };
}
}