🍓 Sync 2026-09-15 02:13:06

This commit is contained in:
github-actions[bot] committed 2026-09-15 02:13:06 +08:00
1 parent 0e5393594c
commit 1dd96ac2bb
146 files changed
+26541 -508

No files matched your search

@@ -0,0 +1,37 @@
{
"admin/services/linkback": {
"title": "LinkBack 链路守护",
"order": 90,
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-linkback" ],
"uci": { "linkback": true }
}
},
"admin/services/linkback/overview": {
"title": "Overview",
"order": 10,
"action": {
"type": "view",
"path": "linkback/overview"
}
},
"admin/services/linkback/settings": {
"title": "Settings",
"order": 20,
"action": {
"type": "view",
"path": "linkback/settings"
}
},
"admin/services/linkback/log": {
"title": "Log",
"order": 30,
"action": {
"type": "view",
"path": "linkback/log"
}
}
}
@@ -0,0 +1,19 @@
{
"luci-app-linkback": {
"description": "ACL for LinkBack Multi-WAN Failover application",
"read": {
"uci": [ "linkback", "network" ],
"ubus": {
"luci.linkback": [ "get_status", "get_log" ],
"network.interface": [ "dump" ],
"network.device": [ "status" ]
}
},
"write": {
"uci": [ "linkback", "network" ],
"ubus": {
"luci.linkback": [ "manage_service" ]
}
}
}
}
@@ -0,0 +1,64 @@
'use strict';
import { readfile } from 'fs';
import { popen } from 'fs';
const STATUS_FILE = '/var/run/linkback.json';
const methods = {
get_status: {
call: function() {
let content = readfile(STATUS_FILE);
let status = null;
if (content) {
try {
status = json(content);
} catch (err) {
// Handle JSON parse error gracefully
}
}
if (!status) {
status = {
enabled: false,
check_interval: 5,
active_link: "none",
links: []
};
}
return status;
}
},
get_log: {
call: function() {
// Extract last 100 lines of linkbackd logs from syslog
let p = popen('logread -e linkbackd | tail -n 100', 'r');
let log_content = '';
if (p) {
log_content = p.read('all');
p.close();
}
return { log: log_content || 'No logs available.' };
}
},
manage_service: {
args: { action: 'string' },
call: function(request) {
let action = request.args?.action;
if (action !== 'start' && action !== 'stop' && action !== 'restart') {
return { success: false, error: 'Invalid action' };
}
let cmd = `/etc/init.d/linkback ${action} >/dev/null 2>&1`;
let rc = system(cmd);
return { success: (rc === 0) };
}
}
};
return { 'luci.linkback': methods };