charis-cli 1.0.1 ā 1.0.3
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/.github/FUNDING.yml +1 -0
- package/.github/workflows/publish.yml +22 -0
- package/LICENSE +7 -0
- package/README.md +44 -0
- package/login.js +23 -15
- package/package.json +13 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: [CharisID, agcrisbp]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: charis-cli
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- 'v*'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
registry-url: https://registry.npmjs.org/
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm publish
|
|
21
|
+
env:
|
|
22
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Charis Production
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# charis-cli
|
|
2
|
+
|
|
3
|
+
šµ Command-line tool to manage your Spotify account via the Charis Web Services.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g charis-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Login to Spotify
|
|
19
|
+
charis login
|
|
20
|
+
|
|
21
|
+
# Logout and delete your Spotify tokens
|
|
22
|
+
charis logout
|
|
23
|
+
|
|
24
|
+
# Uninstall the CLI
|
|
25
|
+
charis remove
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Notes
|
|
29
|
+
|
|
30
|
+
* After logging out, you **cannot use Charis Spotify services** with that account anymore.
|
|
31
|
+
* Make sure you have your **Spotify User ID, Client ID, and Client Secret** ready before logging in.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
* Node.js v18+
|
|
38
|
+
* NPM
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
ISC Ā© Charis Production
|
package/login.js
CHANGED
|
@@ -101,30 +101,38 @@ async function logoutFlow() {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
).trim().toLowerCase();
|
|
104
|
+
console.log(`\nā ļø WARNING: Logging out will delete your Spotify tokens for userId "${userId}"`);
|
|
105
|
+
console.log(" You will NO LONGER be able to use our Spotify service.\n");
|
|
106
|
+
|
|
107
|
+
const confirm = prompt("Are you sure you want to proceed? [y/N]: ").trim().toLowerCase();
|
|
109
108
|
if (confirm !== "y" && confirm !== "yes") {
|
|
110
109
|
console.log(chalk.yellow("ā ļø Logout canceled."));
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
|
-
|
|
112
|
+
|
|
113
|
+
console.log("ā³ Logging out and deleting your tokens...");
|
|
114
|
+
|
|
114
115
|
try {
|
|
115
|
-
const res = await fetch(
|
|
116
|
-
|
|
117
|
-
headers: { "Content-Type": "application/json" }
|
|
118
|
-
|
|
116
|
+
const res = await fetch(
|
|
117
|
+
`https://api.charisprod.xyz/v1/spotify/delete?userId=${userId}`,
|
|
118
|
+
{ method: "DELETE", headers: { "Content-Type": "application/json" } }
|
|
119
|
+
);
|
|
119
120
|
|
|
121
|
+
// Ambil response dari API apa adanya
|
|
120
122
|
const data = await res.json();
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
// Selalu tampilkan message dari API
|
|
125
|
+
if (data.message) {
|
|
126
|
+
if (res.ok) {
|
|
127
|
+
console.log(chalk.green(`ā
${data.message}`));
|
|
128
|
+
} else {
|
|
129
|
+
console.log(chalk.yellow(`ā ļø ${data.message}`));
|
|
130
|
+
}
|
|
131
|
+
} else if (data.error) {
|
|
132
|
+
console.log(chalk.red(`ā ${data.error}`));
|
|
133
|
+
} else {
|
|
134
|
+
console.log(chalk.red("ā Unknown response from API"));
|
|
125
135
|
}
|
|
126
|
-
|
|
127
|
-
console.log(chalk.green(`ā
${data.message || "Successfully logged out."}`));
|
|
128
136
|
} catch (err) {
|
|
129
137
|
console.log(chalk.red(`ā Logout failed: ${err.message}`));
|
|
130
138
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charis-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "login.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "echo \"
|
|
7
|
+
"test": "echo \"No tests yet\"",
|
|
8
|
+
"start": "node login.js",
|
|
9
|
+
"login": "node login.js login",
|
|
10
|
+
"logout": "node login.js logout"
|
|
8
11
|
},
|
|
9
12
|
"bin": {
|
|
10
13
|
"charis": "./login.js"
|
|
11
14
|
},
|
|
12
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"spotify",
|
|
17
|
+
"cli",
|
|
18
|
+
"charis",
|
|
19
|
+
"music",
|
|
20
|
+
"api"
|
|
21
|
+
],
|
|
13
22
|
"author": "Charis Production",
|
|
14
23
|
"license": "ISC",
|
|
15
|
-
"description": "CLI for managing Spotify accounts via Charis
|
|
24
|
+
"description": "CLI for managing Spotify accounts via Charis Web Services",
|
|
16
25
|
"dependencies": {
|
|
17
26
|
"chalk": "^5.6.2",
|
|
18
27
|
"open": "^11.0.0",
|