mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 03:13:56 +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
|
||||
Reference in new issue
Block a user