@gelglx/arjunakey 1.1.0 → 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.
Files changed (3) hide show
  1. package/README.md +29 -9
  2. package/cli.js +27 -11
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -4,8 +4,8 @@ CLI satu akun untuk:
4
4
 
5
5
  1. membuat informasi akun acak,
6
6
  2. register ke `https://dash.arjuna.dev/register`,
7
- 3. mempertahankan session hasil register (login ulang hanya jika server tidak memberi session),
8
- 4. redeem voucher melalui form `Redeem voucher`,
7
+ 3. mempertahankan session hasil register,
8
+ 4. secara opsional mengklaim group code atau redeem voucher,
9
9
  5. mengambil API key dari `/api/me`.
10
10
 
11
11
  Tidak ada dependency npm eksternal.
@@ -16,26 +16,46 @@ Tidak ada dependency npm eksternal.
16
16
  npm install -g @gelglx/arjunakey@latest
17
17
  ```
18
18
 
19
- ## Pemakaian
19
+ ## Membuat akun tanpa klaim kode
20
20
 
21
21
  ```bash
22
22
  arjunakey create
23
23
  ```
24
24
 
25
- Voucher default:
25
+ CLI tidak menyimpan voucher/group code default karena kode dapat kedaluwarsa atau hanya berlaku sekali.
26
+
27
+ ## Klaim group code gratis
28
+
29
+ Kode dari info atau pinned message grup OneStore:
30
+
31
+ ```bash
32
+ arjunakey create --group-code KODE-GROUP-AKTIF
33
+ ```
34
+
35
+ Flag ini hanya memanggil:
26
36
 
27
37
  ```text
28
- ONE-CAC0-209C-55C0-1535-831E
38
+ POST /api/billing/signup-bonus
29
39
  ```
30
40
 
31
- CLI mengirim voucher ke `POST /api/billing/redeem`, sama seperti form `Redeem voucher`. CLI tidak menggunakan form `2. Enter group code` dan tidak memanggil `/api/billing/signup-bonus`.
41
+ ## Redeem voucher berbayar
32
42
 
33
- Ganti voucher jika diperlukan:
43
+ Voucher yang diterbitkan admin setelah pembayaran:
34
44
 
35
45
  ```bash
36
- arjunakey create --voucher-code ONE-CAC0-209C-55C0-1535-831E
46
+ arjunakey create --voucher-code KODE-VOUCHER-AKTIF
37
47
  ```
38
48
 
49
+ Flag ini hanya memanggil:
50
+
51
+ ```text
52
+ POST /api/billing/redeem
53
+ ```
54
+
55
+ `--group-code` dan `--voucher-code` tidak boleh digunakan bersamaan.
56
+
57
+ ## Output dan penyimpanan
58
+
39
59
  Output hanya API key:
40
60
 
41
61
  ```bash
@@ -68,4 +88,4 @@ Lihat semua opsi:
68
88
  arjunakey --help
69
89
  ```
70
90
 
71
- CLI sengaja hanya memproses satu akun per eksekusi; tidak menyediakan farm, worker paralel, proxy rotation, atau batch account creation.
91
+ CLI sengaja hanya memproses satu akun per eksekusi; tidak menyediakan brute force, farm, worker paralel, proxy rotation, atau batch account creation.
package/cli.js CHANGED
@@ -8,9 +8,8 @@ const https = require('https');
8
8
  const path = require('path');
9
9
  const { URL } = require('url');
10
10
 
11
- const VERSION = '1.1.0';
11
+ const VERSION = '1.2.0';
12
12
  const DEFAULT_BASE_URL = 'https://dash.arjuna.dev';
13
- const DEFAULT_VOUCHER_CODE = 'ONE-CAC0-209C-55C0-1535-831E';
14
13
 
15
14
  class ApiError extends Error {
16
15
  constructor(message, response = null) {
@@ -146,6 +145,14 @@ async function redeemVoucher(client, code) {
146
145
  throw new ApiError(apiMessage(voucherResponse, 'Voucher ditolak'), voucherResponse);
147
146
  }
148
147
 
148
+ async function claimGroupCode(client, code) {
149
+ const groupResponse = await client.request('POST', '/api/billing/signup-bonus', { code });
150
+ if (groupResponse.status >= 200 && groupResponse.status < 300) {
151
+ return { kind: 'welcome-group', ...groupResponse.data };
152
+ }
153
+ throw new ApiError(apiMessage(groupResponse, 'Group code ditolak'), groupResponse);
154
+ }
155
+
149
156
  async function getAccount(client) {
150
157
  const response = await client.request('GET', '/api/me');
151
158
  const account = assertOk(response, 'Gagal mengambil informasi akun');
@@ -157,7 +164,8 @@ function parseArgs(argv) {
157
164
  const opts = {
158
165
  command: 'create',
159
166
  baseUrl: process.env.ARJUNA_BASE_URL || DEFAULT_BASE_URL,
160
- voucherCode: process.env.ARJUNA_VOUCHER_CODE || DEFAULT_VOUCHER_CODE,
167
+ voucherCode: process.env.ARJUNA_VOUCHER_CODE || '',
168
+ groupCode: process.env.ARJUNA_GROUP_CODE || '',
161
169
  emailDomain: process.env.ARJUNA_EMAIL_DOMAIN || 'example.com',
162
170
  timeout: Number(process.env.ARJUNA_TIMEOUT || 30),
163
171
  json: false,
@@ -168,7 +176,7 @@ function parseArgs(argv) {
168
176
 
169
177
  const input = [...argv];
170
178
  if (input[0] && !input[0].startsWith('-')) opts.command = input.shift();
171
- const valueFlags = new Set(['--base-url', '--voucher-code', '--email-domain', '--name', '--email', '--password', '--save', '--account-out', '--timeout']);
179
+ const valueFlags = new Set(['--base-url', '--voucher-code', '--group-code', '--email-domain', '--name', '--email', '--password', '--save', '--account-out', '--timeout']);
172
180
 
173
181
  for (let i = 0; i < input.length; i++) {
174
182
  let flag = input[i];
@@ -189,6 +197,7 @@ function parseArgs(argv) {
189
197
  switch (flag) {
190
198
  case '--base-url': opts.baseUrl = value; break;
191
199
  case '--voucher-code': opts.voucherCode = value; break;
200
+ case '--group-code': opts.groupCode = value; break;
192
201
  case '--email-domain': opts.emailDomain = value; break;
193
202
  case '--name': opts.name = value; break;
194
203
  case '--email': opts.email = value; break;
@@ -215,6 +224,7 @@ function validateOptions(opts) {
215
224
  opts.baseUrl = base.origin;
216
225
  if (!Number.isFinite(opts.timeout) || opts.timeout < 1 || opts.timeout > 300) throw new Error('Timeout harus 1-300 detik.');
217
226
  if (opts.raw && opts.json) throw new Error('Pilih salah satu: --raw atau --json.');
227
+ if (opts.voucherCode && opts.groupCode) throw new Error('Pilih salah satu: --voucher-code atau --group-code.');
218
228
  if (opts.command === 'login' && !(opts.email || process.env.ARJUNA_EMAIL)) throw new Error('login membutuhkan --email atau ARJUNA_EMAIL.');
219
229
  if (opts.command === 'login' && !(opts.password || process.env.ARJUNA_PASSWORD)) throw new Error('login membutuhkan --password atau ARJUNA_PASSWORD.');
220
230
  }
@@ -260,11 +270,11 @@ Pemakaian:
260
270
  arjunakey create [opsi]
261
271
  arjunakey login --email EMAIL --password PASSWORD [opsi]
262
272
 
263
- create membuat satu akun acak, redeem voucher, lalu mengambil API key.
264
- Voucher default: ${DEFAULT_VOUCHER_CODE}
273
+ create membuat satu akun acak lalu mengambil API key. Klaim kode bersifat opsional.
265
274
 
266
275
  Opsi:
267
- --voucher-code CODE Kode pada form "Redeem voucher"
276
+ --voucher-code CODE Kode berbayar pada form "Redeem voucher"
277
+ --group-code CODE Kode bonus pada form "2. Enter group code"
268
278
  --email-domain HOST Domain email acak (default: example.com)
269
279
  --name NAME Ganti nama acak
270
280
  --email EMAIL Ganti email acak
@@ -281,7 +291,8 @@ Opsi:
281
291
 
282
292
  Environment:
283
293
  ARJUNA_EMAIL, ARJUNA_PASSWORD, ARJUNA_BASE_URL,
284
- ARJUNA_VOUCHER_CODE, ARJUNA_EMAIL_DOMAIN, ARJUNA_TIMEOUT`);
294
+ ARJUNA_VOUCHER_CODE, ARJUNA_GROUP_CODE, ARJUNA_EMAIL_DOMAIN,
295
+ ARJUNA_TIMEOUT`);
285
296
  }
286
297
 
287
298
  async function main() {
@@ -315,10 +326,15 @@ async function main() {
315
326
  await login(client, profile.email, profile.password);
316
327
  }
317
328
 
318
- if (!opts.noClaim && opts.voucherCode) {
319
- if (!opts.quiet && !opts.raw && !opts.json) console.error('Redeem voucher...');
329
+ const claimCode = opts.groupCode || opts.voucherCode;
330
+ if (!opts.noClaim && claimCode) {
331
+ if (!opts.quiet && !opts.raw && !opts.json) {
332
+ console.error(opts.groupCode ? 'Mengisi group code...' : 'Redeem voucher...');
333
+ }
320
334
  try {
321
- claim = await redeemVoucher(client, opts.voucherCode);
335
+ claim = opts.groupCode
336
+ ? await claimGroupCode(client, opts.groupCode)
337
+ : await redeemVoucher(client, opts.voucherCode);
322
338
  } catch (error) {
323
339
  if (opts.command === 'login' && error instanceof ApiError && /already|sudah|claimed/i.test(error.message)) {
324
340
  claim = { kind: 'already-claimed' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gelglx/arjunakey",
3
- "version": "1.1.0",
4
- "description": "Single-account CLI for OneStore registration, voucher redemption, and API-key retrieval",
3
+ "version": "1.2.0",
4
+ "description": "Single-account CLI for OneStore registration, group-code or voucher claiming, and API-key retrieval",
5
5
  "bin": {
6
6
  "arjunakey": "cli.js"
7
7
  },