refactor: simplify auth and subscription links

This commit is contained in:
2026-07-28 10:32:21 +08:00
parent b7a7cd9c71
commit fc8c23beee
41 changed files with 739 additions and 1468 deletions
+6 -16
View File
@@ -38,15 +38,15 @@ curl -s -H "Authorization: Bearer $ADMIN" "$BASE/api/templates" | python3 -c "im
echo ""
echo "=== 8. DOWNLOAD SOURCE (mihomo) ==="
curl -s "$BASE/download/source/test-source?token=$DL" | head -20
curl -s "$BASE/sources/test-source/$DL" | head -20
echo ""
echo "=== 9. DOWNLOAD SOURCE (json) ==="
curl -s "$BASE/download/source/test-source/json?token=$DL" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'proxies count={len(d.get(\"proxies\",[]))}')"
curl -s "$BASE/sources/test-source/$DL?target=json" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'proxies count={len(d.get(\"proxies\",[]))}')"
echo ""
echo "=== 10. DOWNLOAD COLLECTION (mihomo) ==="
curl -s "$BASE/download/collection/test-collection?token=$DL" | head -20
curl -s "$BASE/collections/test-collection/$DL" | head -20
echo ""
echo "=== 11. PREVIEW SOURCE ==="
@@ -67,25 +67,15 @@ curl -s -X POST -H "Authorization: Bearer $ADMIN" -H "Content-Type: application/
"$BASE/api/rule/parse" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'status={d[\"status\"]}, parsed={d[\"data\"].get(\"parsed\")}, emitted={d[\"data\"].get(\"emitted\")}') if d['status']=='success' else print(f'error: {d}')"
echo ""
echo "=== 14. CREATE SHARE ==="
curl -s -X POST -H "Authorization: Bearer $ADMIN" -H "Content-Type: application/json" \
-d '{"resourceType":"source","resourceId":"test-source","target":"mihomo"}' \
"$BASE/api/shares" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'status={d[\"status\"]}, id={d[\"data\"].get(\"id\")}, url={d[\"data\"].get(\"url\",\"\")[:80]}') if d['status']=='success' else print(f'error: {d}')"
echo ""
echo "=== 15. LIST SHARES ==="
curl -s -H "Authorization: Bearer $ADMIN" "$BASE/api/shares" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'count={len(d[\"data\"])}')"
echo ""
echo "=== 16. DELETE SOURCE ==="
echo "=== 14. DELETE SOURCE ==="
curl -s -X DELETE -H "Authorization: Bearer $ADMIN" "$BASE/api/sources/test-source" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'status={d[\"status\"]}')"
echo ""
echo "=== 17. RECYCLE BIN ==="
echo "=== 15. RECYCLE BIN ==="
curl -s -H "Authorization: Bearer $ADMIN" "$BASE/api/recycle-bin" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'count={len(d[\"data\"])}'); [print(f' type={e.get(\"resourceType\")}, id={e.get(\"resourceId\")}') for e in d['data']]"
echo ""
echo "=== 18. EXPORT STORAGE ==="
echo "=== 16. EXPORT STORAGE ==="
curl -s -H "Authorization: Bearer $ADMIN" "$BASE/api/storage" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'sources={len(d.get(\"sources\",[]))}, collections={len(d.get(\"collections\",[]))}, templates={len(d.get(\"templates\",[]))}')"
echo ""