scripter-x 1.0.29 → 1.0.30
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/package.json +1 -1
- package/src/commands.js +23 -19
package/package.json
CHANGED
package/src/commands.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as zepto from './providers/zepto.js';
|
|
|
11
11
|
import { checkCouponTier } from './providers/zeptoCoupon.js';
|
|
12
12
|
import { homedir } from 'node:os';
|
|
13
13
|
import { join, dirname } from 'node:path';
|
|
14
|
-
import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
|
|
14
|
+
import { mkdirSync, writeFileSync, appendFileSync, readFileSync, existsSync } from 'node:fs';
|
|
15
15
|
import { Worker } from './worker.js';
|
|
16
16
|
import { RunController } from './controller.js';
|
|
17
17
|
import { STATUS } from './theme.js';
|
|
@@ -289,29 +289,32 @@ export async function recheck(io, _api, args = {}) {
|
|
|
289
289
|
// code → we verify, build the ZAUTH1 envelope, and write {phone}-{timestamp}.txt.
|
|
290
290
|
// LOOPS: after each one it asks for the next number — keep going until the user
|
|
291
291
|
// presses Esc (or double Ctrl+C). Runs entirely on your IP.
|
|
292
|
-
// Resolve the dir
|
|
293
|
-
function
|
|
294
|
-
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
295
|
-
const suffix = tier ? `-${tier}` : '';
|
|
296
|
-
let baseDir;
|
|
292
|
+
// Resolve the base dir for Zepto envelope output.
|
|
293
|
+
function zeptoBaseDir(args) {
|
|
297
294
|
if (args.out) {
|
|
298
295
|
const expanded = args.out.startsWith('~') ? join(homedir(), args.out.slice(1)) : args.out;
|
|
299
|
-
|
|
300
|
-
if (/\.(txt|json)$/i.test(expanded) && !tier) return expanded;
|
|
301
|
-
baseDir = /\.(txt|json)$/i.test(expanded) ? dirname(expanded) : expanded;
|
|
302
|
-
} else {
|
|
303
|
-
const downloads = join(homedir(), 'Downloads');
|
|
304
|
-
baseDir = join(existsSync(downloads) ? downloads : homedir(), 'scripterx', 'zepto');
|
|
296
|
+
return /\.(txt|json)$/i.test(expanded) ? dirname(expanded) : expanded;
|
|
305
297
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
mkdirSync(dir, { recursive: true });
|
|
309
|
-
return join(dir, `${number}-${stamp}.txt`);
|
|
298
|
+
const downloads = join(homedir(), 'Downloads');
|
|
299
|
+
return join(existsSync(downloads) ? downloads : homedir(), 'scripterx', 'zepto');
|
|
310
300
|
}
|
|
311
301
|
|
|
312
|
-
//
|
|
302
|
+
// Save one envelope. With a tier → APPEND to {tier}.txt (one envelope per block,
|
|
303
|
+
// blank-line separated, so the file is readable + paste-friendly). Without a tier →
|
|
304
|
+
// a single per-number timestamped file (legacy behaviour). Returns the path written.
|
|
313
305
|
function saveZeptoEnvelope(args, number, envelope, tier) {
|
|
314
|
-
const
|
|
306
|
+
const baseDir = zeptoBaseDir(args);
|
|
307
|
+
if (tier) {
|
|
308
|
+
mkdirSync(baseDir, { recursive: true });
|
|
309
|
+
const dest = join(baseDir, `${tier}.txt`);
|
|
310
|
+
// append with a blank-line separator if the file already has content
|
|
311
|
+
const block = (existsSync(dest) ? '\n' : '') + envelope + '\n';
|
|
312
|
+
appendFileSync(dest, block);
|
|
313
|
+
return dest;
|
|
314
|
+
}
|
|
315
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
316
|
+
const dest = join(baseDir, `${number}-${stamp}.txt`);
|
|
317
|
+
mkdirSync(baseDir, { recursive: true });
|
|
315
318
|
writeFileSync(dest, envelope + '\n');
|
|
316
319
|
return dest;
|
|
317
320
|
}
|
|
@@ -496,7 +499,8 @@ export async function zeptoCmd(io, api, args = {}) {
|
|
|
496
499
|
const dir = zeptoTierDir(args, name);
|
|
497
500
|
const dest = join(dir, `${tier}.txt`);
|
|
498
501
|
mkdirSync(dir, { recursive: true });
|
|
499
|
-
|
|
502
|
+
// one envelope per block, separated by a blank line — readable + paste-friendly
|
|
503
|
+
writeFileSync(dest, tiers[tier].join('\n\n') + '\n');
|
|
500
504
|
io.print(` ${TIER_LABEL[tier]} (${tiers[tier].length}) → ${dest}`, 'accent');
|
|
501
505
|
}
|
|
502
506
|
} else {
|