@savepoint/bridge 1.0.0 → 1.0.2
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/dist/cli.js +1 -1
- package/dist/daemon.js +2 -2
- package/dist/setup.js +22 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
package/dist/daemon.js
CHANGED
|
@@ -7,8 +7,8 @@ import { discoverPrinters } from './discovery.js';
|
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { DATA_PATH } from './logger.js';
|
|
10
|
-
const BASE_URL = process.env.SAVEPOINT_API_URL ?? 'https://
|
|
11
|
-
const VERSION = '1.0.
|
|
10
|
+
const BASE_URL = process.env.SAVEPOINT_APP_URL ?? process.env.SAVEPOINT_API_URL ?? 'https://app.savepointhq.com';
|
|
11
|
+
const VERSION = '1.0.2';
|
|
12
12
|
const DB_PATH = join(DATA_PATH, 'registry.db');
|
|
13
13
|
const CAPS_PATH = fileURLToPath(new URL('../../capabilities/printers.json', import.meta.url));
|
|
14
14
|
const REGISTRY_REFRESH_MS = 5 * 60 * 1000;
|
package/dist/setup.js
CHANGED
|
@@ -4,8 +4,8 @@ import { saveToken } from './token.js';
|
|
|
4
4
|
import { discoverPrinters } from './discovery.js';
|
|
5
5
|
import { installService } from './service.js';
|
|
6
6
|
import { log } from './logger.js';
|
|
7
|
-
const BASE_URL = process.env.SAVEPOINT_API_URL ?? 'https://
|
|
8
|
-
const VERSION = '1.0.
|
|
7
|
+
const BASE_URL = process.env.SAVEPOINT_APP_URL ?? process.env.SAVEPOINT_API_URL ?? 'https://app.savepointhq.com';
|
|
8
|
+
const VERSION = '1.0.2';
|
|
9
9
|
function parseFlags(args) {
|
|
10
10
|
const flags = {};
|
|
11
11
|
for (const arg of args) {
|
|
@@ -21,6 +21,7 @@ export async function runSetup(args) {
|
|
|
21
21
|
const nonInteractive = flags['non-interactive'] === true;
|
|
22
22
|
const noService = flags['no-service'] === true;
|
|
23
23
|
const tokenFlag = typeof flags['token'] === 'string' ? flags['token'] : null;
|
|
24
|
+
const isWindows = process.platform === 'win32';
|
|
24
25
|
console.log();
|
|
25
26
|
console.log(pc.bold('╔══════════════════════════════════════════════════╗'));
|
|
26
27
|
console.log(pc.bold('║ SavePoint Bridge v' + VERSION.padEnd(22) + '║'));
|
|
@@ -40,6 +41,13 @@ What it stores on this computer:
|
|
|
40
41
|
|
|
41
42
|
You can revoke access at any time from:
|
|
42
43
|
SavePoint > Settings > Bridge > Revoke
|
|
44
|
+
|
|
45
|
+
${isWindows ? `Windows setup notes:
|
|
46
|
+
- Open Windows PowerShell as Administrator
|
|
47
|
+
- Do not use Command Prompt
|
|
48
|
+
- If PowerShell blocks scripts, run:
|
|
49
|
+
Set-ExecutionPolicy -Scope Process Bypass -Force
|
|
50
|
+
` : ''}
|
|
43
51
|
`);
|
|
44
52
|
if (!nonInteractive) {
|
|
45
53
|
const proceed = await p.confirm({ message: 'Continue with setup?' });
|
|
@@ -56,7 +64,9 @@ You can revoke access at any time from:
|
|
|
56
64
|
}
|
|
57
65
|
else {
|
|
58
66
|
const input = await p.text({
|
|
59
|
-
message:
|
|
67
|
+
message: isWindows
|
|
68
|
+
? 'Open SavePoint > Settings > Bridge > Add Bridge, then paste your token here (PowerShell only):'
|
|
69
|
+
: 'Open SavePoint > Settings > Bridge > Add Bridge and paste your token:',
|
|
60
70
|
placeholder: 'Paste token here...',
|
|
61
71
|
validate: v => v.length < 32 ? 'Token looks too short -- check you copied the full value' : undefined,
|
|
62
72
|
});
|
|
@@ -79,8 +89,14 @@ You can revoke access at any time from:
|
|
|
79
89
|
body: JSON.stringify({ version: VERSION }),
|
|
80
90
|
});
|
|
81
91
|
if (!res.ok) {
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
const details = await res.text().catch(() => '');
|
|
93
|
+
const suffix = res.status === 401
|
|
94
|
+
? 'The token was not recognized. Generate a fresh token in SavePoint > Settings > Bridge > Add Bridge and copy the full value.'
|
|
95
|
+
: details
|
|
96
|
+
? details.trim()
|
|
97
|
+
: `HTTP ${res.status}`;
|
|
98
|
+
spinner.stop(pc.red(`Token verification failed -- ${suffix}`));
|
|
99
|
+
throw new Error(suffix);
|
|
84
100
|
}
|
|
85
101
|
spinner.stop(pc.green('Token verified'));
|
|
86
102
|
}
|
|
@@ -90,7 +106,7 @@ You can revoke access at any time from:
|
|
|
90
106
|
console.log(pc.yellow('\nSSL error -- if your network uses an SSL proxy, set:'));
|
|
91
107
|
console.log(pc.yellow(' NODE_EXTRA_CA_CERTS=/path/to/proxy-ca.crt savepoint-bridge setup\n'));
|
|
92
108
|
}
|
|
93
|
-
|
|
109
|
+
throw e instanceof Error ? e : new Error('Token verification failed');
|
|
94
110
|
}
|
|
95
111
|
await saveToken(token);
|
|
96
112
|
p.intro(pc.bold('Step 2 of 3 -- Printers'));
|