parent
25737e2430
commit
f9e195aa92
@ -40,25 +40,34 @@ fi
|
|||||||
## config
|
## config
|
||||||
\`\`\`json
|
\`\`\`json
|
||||||
`
|
`
|
||||||
ubus call uci get '{"config": "nikki"}' | yq -M -P -p json -o json '
|
ucode -S -e '
|
||||||
.values | to_entries | group_by(.value[".type"]) | map({"key": .[0].value[".type"], "value": [.[].value]}) | from_entries |
|
import { connect } from "ubus";
|
||||||
. |= (
|
const ubus = connect();
|
||||||
del(.status) |
|
const config = ubus.call("uci", "get", { "config": "nikki" });
|
||||||
del(.editor) |
|
const result = {};
|
||||||
del(.log)
|
for (let section_id in config.values) {
|
||||||
) |
|
const section = config.values[section_id];
|
||||||
.*[] |= (
|
const section_type = section[".type"];
|
||||||
del(.[".type"]) |
|
if (result[section_type] == null) {
|
||||||
del(.[".name"]) |
|
result[section_type] = [];
|
||||||
del(.[".index"]) |
|
}
|
||||||
del(.[".anonymous"])
|
push(result[section_type], section);
|
||||||
) |
|
}
|
||||||
.subscription[] |= .url = "*" |
|
for (let section_type in result) {
|
||||||
.lan_access_control[] |= (
|
for (let section in result[section_type]) {
|
||||||
select(has("ip")) |= .ip[] |= "*" |
|
delete section[".anonymous"];
|
||||||
select(has("ip6")) |= .ip6[] |= "*" |
|
delete section[".type"];
|
||||||
select(has("mac")) |= .mac[] |= "*"
|
delete section[".name"];
|
||||||
)
|
delete section[".index"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let x in result["subscription"]) {
|
||||||
|
x["url"] = "*";
|
||||||
|
}
|
||||||
|
delete result["status"];
|
||||||
|
delete result["editor"];
|
||||||
|
delete result["log"];
|
||||||
|
print(result);
|
||||||
'
|
'
|
||||||
`
|
`
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
Loading…
Reference in New Issue
Block a user