scripter-x 1.0.11 → 1.0.13
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/index.js +9 -2
- package/src/ui/App.js +9 -1
- package/src/ui/Shell.js +6 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,10 +9,17 @@ import { ApiClient } from './api.js';
|
|
|
9
9
|
import { paint } from './util.js';
|
|
10
10
|
import { ask, askSecret, confirm, askChoice } from './prompt.js';
|
|
11
11
|
import { REGISTRY } from './commands.js';
|
|
12
|
+
import { readFileSync } from 'node:fs';
|
|
12
13
|
import { App } from './ui/App.js';
|
|
13
14
|
import { FullScreen, enterAltScreen } from './ui/fullscreen.js';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
let VERSION = '1.0.0';
|
|
17
|
+
try {
|
|
18
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
19
|
+
VERSION = pkg.version;
|
|
20
|
+
} catch {
|
|
21
|
+
// Fallback if read fails
|
|
22
|
+
}
|
|
16
23
|
const h = React.createElement;
|
|
17
24
|
|
|
18
25
|
// ── one-shot io: plain stdio, for `scripterx <cmd>` ──
|
|
@@ -81,7 +88,7 @@ async function main() {
|
|
|
81
88
|
let updateNotice = null;
|
|
82
89
|
try { const { checkForUpdate } = await import('./update.js'); const v = await checkForUpdate(VERSION); if (v) updateNotice = v; } catch { /* */ }
|
|
83
90
|
const ctx = {
|
|
84
|
-
username, server: cfg.server_base_url, updateNotice,
|
|
91
|
+
username, server: cfg.server_base_url, updateNotice, version: VERSION,
|
|
85
92
|
dispatch: async (name, io) => {
|
|
86
93
|
const fn = REGISTRY[name] || REGISTRY[name.split(' ')[0]];
|
|
87
94
|
if (!fn) { io.print(` ✗ unknown command: ${name} (type 'help')`); return; }
|
package/src/ui/App.js
CHANGED
|
@@ -144,7 +144,15 @@ export function App({ ctx }) {
|
|
|
144
144
|
// Layout (top → bottom): banner · output · prompt/palette. So command output appears
|
|
145
145
|
// BELOW the banner and ABOVE the prompt — never above the banner.
|
|
146
146
|
return h(Box, { flexDirection: 'column', ref: frameRef },
|
|
147
|
-
h(WelcomeBox, {
|
|
147
|
+
h(WelcomeBox, {
|
|
148
|
+
username: me.username,
|
|
149
|
+
server: me.server,
|
|
150
|
+
version: ctx.version,
|
|
151
|
+
updateNotice: ctx.updateNotice,
|
|
152
|
+
onUpdate: () => runCommand('update'),
|
|
153
|
+
frameRef,
|
|
154
|
+
onLogout: () => runCommand('logout')
|
|
155
|
+
}),
|
|
148
156
|
scroll,
|
|
149
157
|
screen === 'run' && runController ? h(RunView, { controller: runController, embedded: true }) : null,
|
|
150
158
|
screen === 'prompts' && prompt ? h(PromptView, { prompt, frameRef }) : null,
|
package/src/ui/Shell.js
CHANGED
|
@@ -28,18 +28,22 @@ export const COMMANDS = [
|
|
|
28
28
|
{ name: 'exit', desc: 'quit ScripterX' },
|
|
29
29
|
];
|
|
30
30
|
|
|
31
|
-
export function WelcomeBox({ username, server, frameRef, onLogout }) {
|
|
31
|
+
export function WelcomeBox({ username, server, version, updateNotice, onUpdate, frameRef, onLogout }) {
|
|
32
32
|
const logo = logoLines();
|
|
33
33
|
return h(Box, { borderStyle: 'round', borderColor: COLORS.accent, paddingX: 2, paddingY: 1, flexDirection: 'column' },
|
|
34
34
|
// ASCII wordmark with a top→bottom gradient
|
|
35
35
|
...logo.map((l, i) => h(Text, { key: i, color: l.color, bold: true }, l.text)),
|
|
36
|
-
h(Text, { color: 'gray' },
|
|
36
|
+
h(Text, { color: 'gray' }, ` Flipkart session extractor${version ? ` (v${version})` : ''} — runs on your residential IP`),
|
|
37
37
|
h(Box, { marginTop: 1 },
|
|
38
38
|
h(Text, { color: username ? COLORS.success : 'gray' }, username ? ' ● ' : ' ○ '),
|
|
39
39
|
h(Text, { color: 'white' }, username || 'not signed in'),
|
|
40
40
|
h(Text, { color: 'gray' }, ` · ${server}`),
|
|
41
41
|
username ? h(Clickable, { frameRef, onClick: onLogout },
|
|
42
42
|
h(Text, { color: COLORS.accent }, ' [ logout ]')) : null),
|
|
43
|
+
updateNotice ? h(Box, { marginTop: 1 },
|
|
44
|
+
h(Clickable, { frameRef, onClick: onUpdate },
|
|
45
|
+
h(Text, { color: COLORS.warn, bold: true }, ` ⬆ update available: v${updateNotice} — click here or type 'update' to upgrade`))
|
|
46
|
+
) : null,
|
|
43
47
|
h(Text, { color: 'gray' }, " type a command, or / to browse all · 1-9 / ↑↓+enter / click to pick · exit to quit"),
|
|
44
48
|
);
|
|
45
49
|
}
|