mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🤞 Sync 2026-09-30 23:44:05
This commit is contained in:
1 parent
e3fde93105
commit
44bb740ab2
206 files changed
+5736
-2799
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
case "$#:${1:-}:${2:-}" in
|
||||
2:GET:/version|2:GET:/configs|2:GET:/connections) body='' ;;
|
||||
3:PATCH:/configs)
|
||||
mode=$(jsonfilter -s "$3" -e '@.mode')
|
||||
case "$mode" in rule|global|direct) ;; *) echo 'Invalid mode' >&2; exit 1 ;; esac
|
||||
body="{\"mode\":\"$mode\"}"
|
||||
;;
|
||||
*) echo 'Unsupported API request' >&2; exit 1 ;;
|
||||
esac
|
||||
method=$1
|
||||
path=$2
|
||||
port=$(uci -q get meow.main.panel_port || echo 9090)
|
||||
case "$port" in ''|*[!0-9]*) echo 'Invalid API port' >&2; exit 1 ;; esac
|
||||
[ "$port" -ge 1 ] && [ "$port" -le 65535 ] || exit 1
|
||||
secret=$(uci -q get meow.main.secret || true)
|
||||
set -- --noproxy '*' --silent --show-error --fail --connect-timeout 2 --max-time 5 \
|
||||
--request "$method" "http://127.0.0.1:$port$path"
|
||||
[ -z "$secret" ] || set -- "$@" --header "Authorization: Bearer $secret"
|
||||
[ -z "$body" ] || set -- "$@" --header 'Content-Type: application/json' --data-binary "$body"
|
||||
exec curl "$@"
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
[ "$#" -eq 1 ] || exit 1
|
||||
case "$1" in
|
||||
check) scratch=/tmp/meow-luci-check.yaml ;;
|
||||
*)
|
||||
[ "${#1}" -eq 32 ] || exit 1
|
||||
case "$1" in *[!0-9a-f]*) exit 1 ;;
|
||||
esac
|
||||
scratch="/tmp/meow-luci-settings-$1.yaml"
|
||||
;;
|
||||
esac
|
||||
exec /usr/bin/meow --no-external-plugins -d /etc/meow -f "$scratch" -t
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"admin/services/meow": {
|
||||
"title": "meow",
|
||||
"order": 60,
|
||||
"action": { "type": "firstchild" },
|
||||
"depends": { "acl": [ "luci-app-meow" ], "uci": { "meow": true } }
|
||||
},
|
||||
"admin/services/meow/overview": {
|
||||
"title": "Overview",
|
||||
"order": 10,
|
||||
"action": { "type": "view", "path": "meow/overview" }
|
||||
},
|
||||
"admin/services/meow/panel": {
|
||||
"title": "Panel",
|
||||
"order": 20,
|
||||
"action": { "type": "view", "path": "meow/panel" }
|
||||
},
|
||||
"admin/services/meow/config": {
|
||||
"title": "Configuration",
|
||||
"order": 30,
|
||||
"action": { "type": "view", "path": "meow/config" }
|
||||
},
|
||||
"admin/services/meow/clients": {
|
||||
"title": "Clients",
|
||||
"order": 35,
|
||||
"action": { "type": "view", "path": "meow/clients" }
|
||||
},
|
||||
"admin/services/meow/settings": {
|
||||
"title": "Settings",
|
||||
"order": 40,
|
||||
"action": { "type": "view", "path": "meow/settings" }
|
||||
},
|
||||
"admin/services/meow/log": {
|
||||
"title": "Log",
|
||||
"order": 50,
|
||||
"action": { "type": "view", "path": "meow/log" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"luci-app-meow": {
|
||||
"description": "Grant access to meow service configuration",
|
||||
"read": {
|
||||
"uci": [ "meow", "network", "dhcp" ],
|
||||
"ubus": {
|
||||
"luci-rpc": [ "getHostHints", "getDHCPLeases" ],
|
||||
"service": [ "list" ],
|
||||
"file": [ "exec" ],
|
||||
"uci": [ "get", "changes" ]
|
||||
},
|
||||
"file": {
|
||||
"/sbin/logread -e meow": [ "exec" ],
|
||||
"/usr/share/meow/gateway.sh status": [ "exec" ],
|
||||
"/usr/share/meow/arp-hijack.sh clients": [ "exec" ],
|
||||
"/usr/libexec/meow-api GET /version": [ "exec" ],
|
||||
"/usr/libexec/meow-api GET /configs": [ "exec" ],
|
||||
"/usr/libexec/meow-api GET /connections": [ "exec" ],
|
||||
"/etc/meow/config.yaml": [ "read" ]
|
||||
},
|
||||
"cgi-io": [ "download", "exec" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "meow" ],
|
||||
"file": {
|
||||
"/tmp/meow-luci-check.yaml": [ "write" ],
|
||||
"/tmp/meow-luci-settings-*.yaml": [ "write" ],
|
||||
"/etc/init.d/meow start": [ "exec" ],
|
||||
"/etc/init.d/meow stop": [ "exec" ],
|
||||
"/etc/init.d/meow restart": [ "exec" ],
|
||||
"/etc/init.d/meow-arp restart": [ "exec" ],
|
||||
"/usr/libexec/meow-api PATCH /configs *": [ "exec" ],
|
||||
"/etc/meow/config.yaml": [ "write" ],
|
||||
"/usr/libexec/meow-validate *": [ "exec" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec", "remove" ],
|
||||
"uci": [ "add", "apply", "confirm", "delete", "order", "rename", "set" ]
|
||||
},
|
||||
"cgi-io": [ "upload" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user