Merge commit 'de7e69dbe3' as 'luci-app-einat'

This commit is contained in:
bgme 2025-04-21 13:54:00 +08:00
commit bb6c79b701
11 changed files with 775 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{
"admin/network/einat": {
"title": "einat-ebpf",
"order": 60,
"action": {
"type": "view",
"path": "einat"
},
"depends": {
"acl": [ "luci-app-einat" ]
}
}
}

View file

@ -0,0 +1,21 @@
{
"luci-app-einat": {
"description": "Grant access to LuCI app einat",
"read": {
"file": {
"/etc/init.d/einat reload": [ "exec" ]
},
"ubus": {
"service": [ "list" ],
"luci.einat": [ "*" ]
},
"uci": ["einat"]
},
"write": {
"ubus": {
"rc": [ "init" ]
},
"uci": ["einat"]
}
}
}

View file

@ -0,0 +1,38 @@
#!/usr/bin/ucode
'use strict';
import { access, popen } from 'fs';
const methods = {
get_features: {
call: function() {
let features = {
version: null,
features: [],
build_features: []
};
const fd = popen('/usr/bin/einat -v');
if (fd) {
for (let line = fd.read('line'); length(line); line = fd.read('line')) {
let ver = match(trim(line), /version: (\S+)/);
if (ver)
features.version = ver[1];
let feats = match(trim(line), /features: (\S+)/);
if (feats)
features.features = split(feats[1], ',');
let build_feats = match(trim(line), /build_features: (\S+)/);
if (build_feats)
features.build_features = split(build_feats[1], ',');
}
fd.close();
}
return features;
}
}
};
return { 'luci.einat': methods };