Update ssd.mjs

This commit is contained in:
Jay Lee
2026-03-04 16:10:37 -05:00
committed by GitHub
parent dab6272d55
commit 9348f57141

View File

@@ -1,7 +1,7 @@
// Node.js script to launch Simply Sign Desktop app and log a user in // Node.js script to launch Simply Sign Desktop app and log a user in
// using native Windows keystrokes and native PowerShell screenshots. // using native Windows keystrokes and native PowerShell screenshots.
import { exec, execSync } from 'child_process'; import { execSync, spawn } from 'child_process';
import { TOTP } from 'totp-generator'; import { TOTP } from 'totp-generator';
function sleep(ms) { function sleep(ms) {
@@ -14,7 +14,7 @@ function sendKeys(keys) {
execSync(`powershell -Command "${script}"`); execSync(`powershell -Command "${script}"`);
} }
// NEW: Native PowerShell Screen Capture // Native PowerShell Screen Capture
function takeScreenshot(filename) { function takeScreenshot(filename) {
const psScript = ` const psScript = `
Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Windows.Forms;
@@ -33,13 +33,20 @@ function takeScreenshot(filename) {
} }
} }
// Fire and forget application launcher
function launchSSD() {
const child = spawn('C:\\Program Files\\Certum\\SimplySign Desktop\\SimplySignDesktop.exe', [], {
detached: true, // Run in a separate process group
stdio: 'ignore' // Disconnect standard input/output
});
child.unref(); // Tell Node.js not to wait for this process to exit
}
async function runSSD() { async function runSSD() {
console.log('Launching SimplySign Desktop...'); console.log('Launching SimplySign Desktop...');
// Launch the application. // Launch the application detached.
exec('"C:\\Program Files\\Certum\\SimplySign Desktop\\SimplySignDesktop.exe"', (error) => { launchSSD();
if (error) console.error(`exec error: ${error}`);
});
// 1. Handle ARM64 Out-Of-Box experience // 1. Handle ARM64 Out-Of-Box experience
const runner_arch = process.env.RUNNER_ARCH; const runner_arch = process.env.RUNNER_ARCH;
@@ -59,7 +66,7 @@ async function runSSD() {
takeScreenshot('oob6.png'); takeScreenshot('oob6.png');
// Re-execute SSD to open login dialog // Re-execute SSD to open login dialog
exec('"C:\\Program Files\\Certum\\SimplySign Desktop\\SimplySignDesktop.exe"'); launchSSD();
} else { } else {
console.log('NOT running on ARM64'); console.log('NOT running on ARM64');
} }
@@ -110,6 +117,8 @@ async function runSSD() {
takeScreenshot('login11.png'); takeScreenshot('login11.png');
await sleep(500); await sleep(500);
takeScreenshot('login12.png'); takeScreenshot('login12.png');
console.log('Exiting script, leaving SimplySign running in background.');
} }
runSSD(); runSSD();