@sinch/cli 0.4.14 → 0.4.16
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/scripts/postinstall.js +24 -1
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -14,7 +14,7 @@ const fs = require('fs');
|
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const os = require('os');
|
|
16
16
|
const https = require('https');
|
|
17
|
-
const { spawn } = require('child_process');
|
|
17
|
+
const { spawn, spawnSync } = require('child_process');
|
|
18
18
|
const { getPlatformBinaryInfo } = require('../bin/platform-resolver');
|
|
19
19
|
|
|
20
20
|
const SINCH_DIR = path.join(os.homedir(), '.sinch');
|
|
@@ -286,6 +286,27 @@ async function downloadBinary(version) {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
// Detect-only — never install. We deliberately do NOT shell out to apt/dnf/etc
|
|
290
|
+
// here: needs sudo, distro-specific, and may trigger corporate EDR. The user
|
|
291
|
+
// gets a one-shot hint at install time; from there it's their call.
|
|
292
|
+
function warnIfLinuxKeychainMissing() {
|
|
293
|
+
if (process.platform !== 'linux') return;
|
|
294
|
+
try {
|
|
295
|
+
const probe = spawnSync('secret-tool', ['--version'], { stdio: 'ignore' });
|
|
296
|
+
if (probe.status === 0) return;
|
|
297
|
+
} catch {
|
|
298
|
+
// ENOENT → fall through to warning
|
|
299
|
+
}
|
|
300
|
+
process.stderr.write(
|
|
301
|
+
'\n ⚠️ libsecret-tools is not installed. Sinch CLI needs `secret-tool` to store\n' +
|
|
302
|
+
' credentials securely in the OS keyring on Linux. Without it, secrets will\n' +
|
|
303
|
+
' be written to plaintext config (~/.sinch/profiles/<active>.json).\n\n' +
|
|
304
|
+
' Debian/Ubuntu: sudo apt install libsecret-tools gnome-keyring dbus-x11\n' +
|
|
305
|
+
' Fedora/RHEL: sudo dnf install libsecret gnome-keyring dbus-tools\n' +
|
|
306
|
+
' Arch: sudo pacman -S libsecret gnome-keyring dbus\n\n'
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
289
310
|
async function main() {
|
|
290
311
|
if (process.env.npm_config_global !== 'true' && !process.env.SINCH_FORCE_POSTINSTALL) {
|
|
291
312
|
return;
|
|
@@ -303,6 +324,8 @@ async function main() {
|
|
|
303
324
|
} else {
|
|
304
325
|
installBashZshCompletion();
|
|
305
326
|
}
|
|
327
|
+
|
|
328
|
+
warnIfLinuxKeychainMissing();
|
|
306
329
|
} catch {}
|
|
307
330
|
}
|
|
308
331
|
|