pushnetgo-cli 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pushnetgo-cli.js +2 -2
- package/guide.sh +78 -0
- package/package.json +1 -1
package/bin/pushnetgo-cli.js
CHANGED
|
@@ -109,9 +109,9 @@ if (process.argv.length <= 2) {
|
|
|
109
109
|
Token:
|
|
110
110
|
pushnetgo-cli token check — validate key
|
|
111
111
|
pushnetgo-cli api-url — HTTP endpoint
|
|
112
|
-
pushnetgo-cli --help — all options
|
|
113
112
|
|
|
114
|
-
|
|
113
|
+
Setup guide: curl -s https://flutter-ai-playground-f8e3b.web.app/guide.sh | bash
|
|
114
|
+
Public guide: GET https://flutter-ai-playground-f8e3b.web.app/api
|
|
115
115
|
HTTP endpoint: ${API_URL}
|
|
116
116
|
Auth: x-api-key: pushnetgo-xxx
|
|
117
117
|
|
package/guide.sh
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PushNetGo Setup Guide — for AI agents and users
|
|
3
|
+
# Usage: curl -s https://flutter-ai-playground-f8e3b.web.app/guide.sh | bash
|
|
4
|
+
# or: curl -s https://...web.app/guide.sh | bash -s pushnetgo-xxx
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
KEY="${1:-$MYAPP_API_KEY}"
|
|
9
|
+
CLI="pushnetgo-cli"
|
|
10
|
+
API="https://us-central1-flutter-ai-playground-f8e3b.cloudfunctions.net/unifiedGatewayApi"
|
|
11
|
+
UPLOAD="https://flutter-ai-playground-f8e3b.web.app/api/pushnetgo-upload"
|
|
12
|
+
|
|
13
|
+
echo ""
|
|
14
|
+
echo "=============================================="
|
|
15
|
+
echo " PushNetGo Setup Guide"
|
|
16
|
+
echo "=============================================="
|
|
17
|
+
echo ""
|
|
18
|
+
|
|
19
|
+
# Step 1: Install CLI
|
|
20
|
+
echo "[1/4] Installing $CLI..."
|
|
21
|
+
if command -v $CLI &>/dev/null; then
|
|
22
|
+
echo " Already installed."
|
|
23
|
+
elif command -v npm &>/dev/null; then
|
|
24
|
+
npm install -g pushnetgo-cli 2>/dev/null && echo " Installed." || echo " npm install failed (non-critical)."
|
|
25
|
+
else
|
|
26
|
+
echo " npm not found. Skip CLI install. Use HTTP API directly."
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Step 2: Key setup
|
|
30
|
+
if [ -z "$KEY" ]; then
|
|
31
|
+
echo "[2/4] No key provided. Usage:"
|
|
32
|
+
echo " export MYAPP_API_KEY=\"pushnetgo-xxx\""
|
|
33
|
+
echo " Generate key from: PushNetGo App > Admin > Token Hub"
|
|
34
|
+
echo ""
|
|
35
|
+
else
|
|
36
|
+
echo "[2/4] Using key: ${KEY:0:20}..."
|
|
37
|
+
if [ ! "$KEY" = "pushnetgo-"* ]; then
|
|
38
|
+
echo " WARNING: Key does not start with pushnetgo-. Format should be: pushnetgo-{32-hex}"
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Step 3: Verify key via HTTP API
|
|
43
|
+
if [ -n "$KEY" ] && [ "$KEY" = "pushnetgo-"* ]; then
|
|
44
|
+
echo "[3/4] Verifying key..."
|
|
45
|
+
RESULT=$(curl -sf -X POST "$API" -H "Content-Type: application/json" -H "x-api-key: $KEY" -d '{"action":"token-check"}' 2>/dev/null)
|
|
46
|
+
if echo "$RESULT" | grep -q '"active":true'; then
|
|
47
|
+
echo " Key is ACTIVE."
|
|
48
|
+
elif echo "$RESULT" | grep -q '"active":false'; then
|
|
49
|
+
echo " Key is INACTIVE. Generate a new one from PushNetGo Token Hub."
|
|
50
|
+
else
|
|
51
|
+
echo " Could not verify (network error or invalid key)."
|
|
52
|
+
fi
|
|
53
|
+
elif [ -n "$KEY" ]; then
|
|
54
|
+
echo "[3/4] Skipping verification (invalid format)."
|
|
55
|
+
else
|
|
56
|
+
echo "[3/4] Skipping verification (no key)."
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Step 4: Show menu
|
|
60
|
+
echo "[4/4] Available commands:"
|
|
61
|
+
echo ""
|
|
62
|
+
echo " CLI (npm install -g pushnetgo-cli):"
|
|
63
|
+
echo " $CLI chat \"hello\" — AI chat"
|
|
64
|
+
echo " $CLI music list — list tracks"
|
|
65
|
+
echo " $CLI music get <id> — track info"
|
|
66
|
+
echo " $CLI music download <id> — download to local"
|
|
67
|
+
echo " $CLI music upload --url URL — upload from URL"
|
|
68
|
+
echo " $CLI music delete <id> — delete track"
|
|
69
|
+
echo " $CLI token check — validate key"
|
|
70
|
+
echo " $CLI api-url — show HTTP endpoint"
|
|
71
|
+
echo ""
|
|
72
|
+
echo " HTTP API (any language, no install):"
|
|
73
|
+
echo " curl -X POST $API -H \"x-api-key: YOUR_KEY\" -d '{\"action\":\"token-check\"}'"
|
|
74
|
+
echo " curl -X POST $UPLOAD -H \"x-api-key: YOUR_KEY\" -d '{\"action\":\"sync-music\",\"url\":\"https://...\"}'"
|
|
75
|
+
echo ""
|
|
76
|
+
echo " Public guide: GET https://flutter-ai-playground-f8e3b.web.app/api"
|
|
77
|
+
echo "=============================================="
|
|
78
|
+
echo ""
|
package/package.json
CHANGED