pushnetgo-cli 1.1.2 → 1.2.0
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/README.md +26 -82
- package/bin/pushnetgo-cli.js +3 -3
- package/guide.sh +2 -2
- package/lib/http-client.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,120 +7,64 @@ Command-line tool for PushNetGo App — sync music, validate API keys.
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g pushnetgo-cli
|
|
9
9
|
export MYAPP_API_KEY="pushnetgo-xxx"
|
|
10
|
-
pushnetgo-cli
|
|
11
|
-
pushnetgo-cli api-url
|
|
12
|
-
pushnetgo-cli sync-music --url "https://..."
|
|
10
|
+
pushnetgo-cli
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
## API Endpoint
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
All operations use one endpoint:
|
|
18
16
|
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g pushnetgo-cli
|
|
21
17
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx pushnetgo-cli token check --key pushnetgo-xxx
|
|
18
|
+
POST https://flutter-ai-playground-f8e3b.web.app/api
|
|
19
|
+
Auth: x-api-key: pushnetgo-xxx
|
|
27
20
|
```
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
### 3 Operations
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|-----|---------|
|
|
33
|
-
| `https://flutter-ai-playground-f8e3b.web.app/api/pushnetgo-upload` | Upload music from URL |
|
|
34
|
-
| `https://us-central1-flutter-ai-playground-f8e3b.cloudfunctions.net/unifiedGatewayApi` | All actions (token-check, sync-music) |
|
|
35
|
-
|
|
36
|
-
Auth: `x-api-key: pushnetgo-xxx`
|
|
37
|
-
|
|
38
|
-
### Actions
|
|
39
|
-
|
|
40
|
-
#### token-check
|
|
24
|
+
#### 1. Verify Key
|
|
41
25
|
|
|
42
26
|
```bash
|
|
43
|
-
curl -X POST https://
|
|
27
|
+
curl -X POST https://flutter-ai-playground-f8e3b.web.app/api \
|
|
44
28
|
-H "Content-Type: application/json" \
|
|
45
29
|
-H "x-api-key: pushnetgo-xxx" \
|
|
46
30
|
-d '{"action":"token-check"}'
|
|
47
31
|
```
|
|
48
32
|
|
|
49
|
-
####
|
|
50
|
-
|
|
51
|
-
Download an MP3 from URL and upload to PushNetGo project.
|
|
33
|
+
#### 2. Upload Music
|
|
52
34
|
|
|
53
35
|
```bash
|
|
54
|
-
curl -X POST https://
|
|
36
|
+
curl -X POST https://flutter-ai-playground-f8e3b.web.app/api \
|
|
55
37
|
-H "Content-Type: application/json" \
|
|
56
38
|
-H "x-api-key: pushnetgo-xxx" \
|
|
57
|
-
-d '{"action":"sync-music","
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## CLI Usage
|
|
61
|
-
|
|
62
|
-
Set your API key as an environment variable:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
export MYAPP_API_KEY="pushnetgo-xxx"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Or pass it with each command:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
pushnetgo-cli --key pushnetgo-xxx <command>
|
|
39
|
+
-d '{"action":"sync-music","url":"https://example.com/track.mp3","title":"My Song"}'
|
|
72
40
|
```
|
|
73
41
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
#### sync-music
|
|
77
|
-
|
|
78
|
-
Upload local MP3 files or import from URL:
|
|
42
|
+
#### 3. Download Music
|
|
79
43
|
|
|
80
44
|
```bash
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
pushnetgo-cli sync-music --project radio99 --url "https://api.mureka.ai/output.mp3"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
#### token check
|
|
89
|
-
|
|
90
|
-
Validate an API key:
|
|
45
|
+
# First get track info
|
|
46
|
+
curl -X POST https://flutter-ai-playground-f8e3b.web.app/api \
|
|
47
|
+
-H "x-api-key: pushnetgo-xxx" \
|
|
48
|
+
-d '{"action":"music_list"}'
|
|
91
49
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
pushnetgo-cli token check --key pushnetgo-xxx
|
|
50
|
+
# Then download from the returned downloadUrl
|
|
51
|
+
curl -O "https://storage.googleapis.com/flutter-ai-playground-f8e3b.firebasestorage.app/music_files/xxx.mp3"
|
|
95
52
|
```
|
|
96
53
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
Do NOT call Firebase Storage REST API directly — requests will be blocked by Security Rules (App Check).
|
|
100
|
-
|
|
101
|
-
Use the Cloud Functions endpoint or CLI instead:
|
|
54
|
+
## Commands
|
|
102
55
|
|
|
103
56
|
```bash
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
pushnetgo-cli sync-music --url "https://api.mureka.ai/output.mp3"
|
|
57
|
+
pushnetgo-cli chat "hello" — AI chat
|
|
58
|
+
pushnetgo-cli music list — list tracks
|
|
59
|
+
pushnetgo-cli music get <id> — track info
|
|
60
|
+
pushnetgo-cli music download <id> — download to local
|
|
61
|
+
pushnetgo-cli music upload --url URL — upload from URL
|
|
62
|
+
pushnetgo-cli music delete <id> — delete track
|
|
63
|
+
pushnetgo-cli token check — validate key
|
|
112
64
|
```
|
|
113
65
|
|
|
114
|
-
Both methods use server-side Firebase Admin SDK to bypass Storage rules.
|
|
115
|
-
|
|
116
66
|
## API Key Format
|
|
117
67
|
|
|
118
|
-
PushNetGo API keys use the format:
|
|
119
|
-
|
|
120
68
|
```
|
|
121
69
|
pushnetgo-{32-character-hex-uuid}
|
|
122
70
|
```
|
|
123
|
-
|
|
124
|
-
Example: `pushnetgo-6d122db2132d4a94a91a46e529fd2752`
|
|
125
|
-
|
|
126
|
-
Keys are generated from the PushNetGo App Token Hub.
|
package/bin/pushnetgo-cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
4
|
const program = new Command();
|
|
5
|
-
const API_URL = 'https://
|
|
5
|
+
const API_URL = 'https://flutter-ai-playground-f8e3b.web.app/api';
|
|
6
6
|
const VERSION = require('../package.json').version;
|
|
7
7
|
|
|
8
8
|
program
|
|
@@ -111,8 +111,8 @@ if (process.argv.length <= 2) {
|
|
|
111
111
|
pushnetgo-cli api-url — HTTP endpoint
|
|
112
112
|
|
|
113
113
|
Setup guide: curl -s https://flutter-ai-playground-f8e3b.web.app/guide.sh | bash
|
|
114
|
-
Public
|
|
115
|
-
|
|
114
|
+
Public API: POST https://flutter-ai-playground-f8e3b.web.app/api
|
|
115
|
+
Auth: x-api-key: pushnetgo-xxx
|
|
116
116
|
Auth: x-api-key: pushnetgo-xxx
|
|
117
117
|
|
|
118
118
|
No Firebase config needed. Any machine.`);
|
package/guide.sh
CHANGED
|
@@ -7,8 +7,8 @@ set -e
|
|
|
7
7
|
|
|
8
8
|
KEY="${1:-$MYAPP_API_KEY}"
|
|
9
9
|
CLI="pushnetgo-cli"
|
|
10
|
-
API="https://
|
|
11
|
-
UPLOAD="https://flutter-ai-playground-f8e3b.web.app/api
|
|
10
|
+
API="https://flutter-ai-playground-f8e3b.web.app/api"
|
|
11
|
+
UPLOAD="https://flutter-ai-playground-f8e3b.web.app/api"
|
|
12
12
|
|
|
13
13
|
echo ""
|
|
14
14
|
echo "=============================================="
|
package/lib/http-client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
2
|
const http = require('http');
|
|
3
3
|
|
|
4
|
-
const API_URL = 'https://
|
|
4
|
+
const API_URL = 'https://flutter-ai-playground-f8e3b.web.app/api';
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
package/package.json
CHANGED