fix: Add missing API functions to resolve module errors
Fixed JavaScript errors in multiple modules by adding missing API functions: 1. auth-guardian: - Added getSessions() alias for listSessions compatibility 2. netifyd-dashboard: - Added getAllData() aggregating status, stats, flows, applications 3. wireguard-dashboard: - Added getAllData() aggregating status, peers, interfaces, traffic 4. network-modes: - Added getAllData() aggregating status, mode, available_modes, interfaces 5. netdata-dashboard: - Fixed ACL permissions: changed ubus object from 'netdata' to 'luci.netdata-dashboard' - Added missing RPC methods to ACL (netdata_status, netdata_alarms, netdata_info) - Added write permissions for service control methods Resolves: - TypeError: api.getSessions is not a function (auth-guardian) - TypeError: api.getAllData is not a function (netifyd, wireguard, network-modes) - RPC error -32002: Access denied (netdata-dashboard) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9a4753e343
commit
0759c748dd
@ -90,6 +90,7 @@ return baseclass.extend({
|
|||||||
deleteVoucher: callDeleteVoucher,
|
deleteVoucher: callDeleteVoucher,
|
||||||
validateVoucher: callValidateVoucher,
|
validateVoucher: callValidateVoucher,
|
||||||
listSessions: callListSessions,
|
listSessions: callListSessions,
|
||||||
|
getSessions: callListSessions, // Alias for compatibility
|
||||||
revokeSession: callRevokeSession,
|
revokeSession: callRevokeSession,
|
||||||
getLogs: callGetLogs
|
getLogs: callGetLogs
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,14 +3,32 @@
|
|||||||
"description": "Grant access to LuCI Netdata Dashboard",
|
"description": "Grant access to LuCI Netdata Dashboard",
|
||||||
"read": {
|
"read": {
|
||||||
"ubus": {
|
"ubus": {
|
||||||
"netdata": [ "stats", "cpu", "memory", "disk", "network", "processes", "sensors", "system" ],
|
"luci.netdata-dashboard": [
|
||||||
|
"stats",
|
||||||
|
"cpu",
|
||||||
|
"memory",
|
||||||
|
"disk",
|
||||||
|
"network",
|
||||||
|
"processes",
|
||||||
|
"sensors",
|
||||||
|
"system",
|
||||||
|
"netdata_status",
|
||||||
|
"netdata_alarms",
|
||||||
|
"netdata_info"
|
||||||
|
],
|
||||||
"system": [ "info", "board" ],
|
"system": [ "info", "board" ],
|
||||||
"luci-rpc": [ "getNetdataStats" ],
|
|
||||||
"file": [ "read", "stat" ]
|
"file": [ "read", "stat" ]
|
||||||
},
|
},
|
||||||
"uci": [ "netdata-dashboard" ]
|
"uci": [ "netdata-dashboard" ]
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
|
"ubus": {
|
||||||
|
"luci.netdata-dashboard": [
|
||||||
|
"restart_netdata",
|
||||||
|
"start_netdata",
|
||||||
|
"stop_netdata"
|
||||||
|
]
|
||||||
|
},
|
||||||
"uci": [ "netdata-dashboard" ]
|
"uci": [ "netdata-dashboard" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,5 +61,22 @@ return baseclass.extend({
|
|||||||
getHosts: callHosts,
|
getHosts: callHosts,
|
||||||
getProtocols: callProtocols,
|
getProtocols: callProtocols,
|
||||||
getStats: callStats,
|
getStats: callStats,
|
||||||
formatBytes: formatBytes
|
formatBytes: formatBytes,
|
||||||
|
|
||||||
|
// Aggregate function for overview page
|
||||||
|
getAllData: function() {
|
||||||
|
return Promise.all([
|
||||||
|
callStatus(),
|
||||||
|
callStats(),
|
||||||
|
callFlows(),
|
||||||
|
callApplications()
|
||||||
|
]).then(function(results) {
|
||||||
|
return {
|
||||||
|
status: results[0] || {},
|
||||||
|
stats: results[1] || {},
|
||||||
|
flows: results[2] || { flows: [] },
|
||||||
|
applications: results[3] || { applications: [] }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -53,5 +53,22 @@ return baseclass.extend({
|
|||||||
getAvailableModes: callGetAvailableModes,
|
getAvailableModes: callGetAvailableModes,
|
||||||
setMode: callSetMode,
|
setMode: callSetMode,
|
||||||
getInterfaces: callGetInterfaces,
|
getInterfaces: callGetInterfaces,
|
||||||
validateConfig: callValidateConfig
|
validateConfig: callValidateConfig,
|
||||||
|
|
||||||
|
// Aggregate function for overview page
|
||||||
|
getAllData: function() {
|
||||||
|
return Promise.all([
|
||||||
|
callStatus(),
|
||||||
|
callGetCurrentMode(),
|
||||||
|
callGetAvailableModes(),
|
||||||
|
callGetInterfaces()
|
||||||
|
]).then(function(results) {
|
||||||
|
return {
|
||||||
|
status: results[0] || {},
|
||||||
|
current_mode: results[1] || { mode: '' },
|
||||||
|
available_modes: results[2] || { modes: [] },
|
||||||
|
interfaces: results[3] || { interfaces: [] }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -104,5 +104,22 @@ return baseclass.extend({
|
|||||||
generateConfig: callGenerateConfig,
|
generateConfig: callGenerateConfig,
|
||||||
generateQR: callGenerateQR,
|
generateQR: callGenerateQR,
|
||||||
formatBytes: formatBytes,
|
formatBytes: formatBytes,
|
||||||
formatLastHandshake: formatLastHandshake
|
formatLastHandshake: formatLastHandshake,
|
||||||
|
|
||||||
|
// Aggregate function for overview page
|
||||||
|
getAllData: function() {
|
||||||
|
return Promise.all([
|
||||||
|
callStatus(),
|
||||||
|
callGetPeers(),
|
||||||
|
callGetInterfaces(),
|
||||||
|
callGetTraffic()
|
||||||
|
]).then(function(results) {
|
||||||
|
return {
|
||||||
|
status: results[0] || {},
|
||||||
|
peers: results[1] || { peers: [] },
|
||||||
|
interfaces: results[2] || { interfaces: [] },
|
||||||
|
traffic: results[3] || {}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user