claude-scionos 4.1.5 → 4.1.6
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/routerlab.js +23 -14
package/package.json
CHANGED
package/src/routerlab.js
CHANGED
|
@@ -386,16 +386,21 @@ function commandExists(command) {
|
|
|
386
386
|
return !result.error;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
function runPowerShell(command,
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
389
|
+
function runPowerShell(command, options = {}) {
|
|
390
|
+
const {
|
|
391
|
+
env = {},
|
|
392
|
+
input,
|
|
393
|
+
} = options;
|
|
394
|
+
const powershell = process.env.SystemRoot
|
|
395
|
+
? path.join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
|
|
396
|
+
: 'powershell.exe';
|
|
397
|
+
|
|
398
|
+
const result = spawnSync(powershell, ['-NoProfile', '-NonInteractive', '-Command', command], {
|
|
399
|
+
encoding: 'utf8',
|
|
400
|
+
input,
|
|
401
|
+
env: {
|
|
402
|
+
...process.env,
|
|
403
|
+
...env,
|
|
399
404
|
},
|
|
400
405
|
});
|
|
401
406
|
|
|
@@ -439,10 +444,12 @@ function storeToken(token, serviceValue = DEFAULT_SERVICE) {
|
|
|
439
444
|
const tokenFile = getWindowsTokenFile(service.value);
|
|
440
445
|
fs.mkdirSync(path.dirname(tokenFile), {recursive: true});
|
|
441
446
|
runPowerShell(
|
|
442
|
-
'$secure = ConvertTo-SecureString $
|
|
447
|
+
'$token = [Console]::In.ReadToEnd(); if ([string]::IsNullOrEmpty($token)) { throw "Token input is empty" }; $secure = ConvertTo-SecureString $token -AsPlainText -Force; $encrypted = ConvertFrom-SecureString $secure; Set-Content -Path $env:SCIONOS_TOKEN_FILE -Value $encrypted -NoNewline',
|
|
443
448
|
{
|
|
444
|
-
|
|
445
|
-
|
|
449
|
+
env: {
|
|
450
|
+
SCIONOS_TOKEN_FILE: tokenFile,
|
|
451
|
+
},
|
|
452
|
+
input: token,
|
|
446
453
|
},
|
|
447
454
|
);
|
|
448
455
|
|
|
@@ -514,7 +521,9 @@ function getStoredToken(serviceValue = DEFAULT_SERVICE) {
|
|
|
514
521
|
const token = runPowerShell(
|
|
515
522
|
'$secure = Get-Content -Path $env:SCIONOS_TOKEN_FILE -Raw | ConvertTo-SecureString; $ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure); try { [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ptr) } finally { [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ptr) }',
|
|
516
523
|
{
|
|
517
|
-
|
|
524
|
+
env: {
|
|
525
|
+
SCIONOS_TOKEN_FILE: tokenFile,
|
|
526
|
+
},
|
|
518
527
|
},
|
|
519
528
|
);
|
|
520
529
|
return token || null;
|