update 2026-09-26 11:07:27

This commit is contained in:
action committed 2026-09-26 11:07:27 +08:00
1 parent 7b88b273d0
commit 97ae9f68da
4898 files changed
-1712274

No files matched your search

@@ -1,39 +0,0 @@
#!/bin/sh
# daede-graphql - same-origin GraphQL relay to local daed.
#
# HTTPS LuCI pages can't fetch daed's plain-HTTP :2023 (mixed content),
# so the converter posts here and we relay to 127.0.0.1 over loopback.
# daed still checks its own bearer token; no extra exposure. See #11.
reply() { printf 'Status: %s\r\nContent-Type: application/json\r\n\r\n%s\n' "$1" "$2"; exit 0; }
fail() { reply '502 Bad Gateway' '{"errors":[{"message":"daed relay failed"}]}'; }
[ "$REQUEST_METHOD" = "POST" ] || reply '405 Method Not Allowed' '{"errors":[{"message":"POST only"}]}'
# daed listen port from uci, default 2023
port=$(uci -q get daed.config.listen_addr | sed -n 's/.*:\([0-9]\{1,5\}\)$/\1/p')
[ -n "$port" ] || port=2023
len=${CONTENT_LENGTH:-0}
[ "$len" -gt 0 ] 2>/dev/null || fail
body=$(mktemp /tmp/daede-gql.XXXXXX) || fail
head -c "$len" > "$body"
if [ -n "$HTTP_AUTHORIZATION" ]; then
resp=$(uclient-fetch -q -O - \
--header="Content-Type: ${CONTENT_TYPE:-application/json}" \
--header="Authorization: $HTTP_AUTHORIZATION" \
--post-file="$body" \
"http://127.0.0.1:$port/graphql" 2>/dev/null)
else
resp=$(uclient-fetch -q -O - \
--header="Content-Type: ${CONTENT_TYPE:-application/json}" \
--post-file="$body" \
"http://127.0.0.1:$port/graphql" 2>/dev/null)
fi
rc=$?
rm -f "$body"
[ "$rc" = 0 ] || fail
reply '200 OK' "$resp"
-25
View File
@@ -1,25 +0,0 @@
#!/bin/sh
# daede-sub - serve a converter's staged node list to the local daed only.
#
# daed (dae-wing) can only build a subscription by HTTP-fetching a link, and it
# does not read file:// like dae core. So the converter stores the base64 share
# links in /etc/daed/daede-sub-<token> and points daed's importSubscription at
# http://127.0.0.1/cgi-bin/daede-sub?t=<token>. This CGI is the read side.
#
# Locked to loopback (REMOTE_ADDR), so even though uhttpd listens on the LAN no
# remote client can pull the links. The snapshot remains available for daed's
# own refresh action and is included in daede configuration backups.
deny() { printf 'Status: 403 Forbidden\r\nContent-Type: text/plain\r\n\r\nforbidden\n'; exit 0; }
[ "$REMOTE_ADDR" = "127.0.0.1" ] || deny
# token: only [A-Za-z0-9] so the path can't escape /tmp
t=$(printf '%s' "$QUERY_STRING" | sed -n 's/^.*\bt=\([A-Za-z0-9]\{1,64\}\).*$/\1/p')
[ -n "$t" ] || deny
f="/etc/daed/daede-sub-$t"
[ -f "$f" ] || deny
printf 'Content-Type: text/plain\r\n\r\n'
cat "$f"