From 2599470bb603bbac9da36808f87665876f15c16d Mon Sep 17 00:00:00 2001 From: stackgo Date: Thu, 9 Apr 2026 16:30:17 +0900 Subject: [PATCH] Add stdin flag to console and update copyright app.js: Add a _useStdin flag (via WScript.Arguments.Named.Exists("stdin")) and skip default echoing when stdin is in use; switch WScript.Echo to WScript.StdOut.WriteLine for proper stdout output. Remove separator comment lines before initializeConsole. bootstrap.js: Bump copyright year to 2026 and remove an obsolete/commented CORS-to-ADO registry tweak. These changes improve console output behavior for piped input and clean up bootstrap metadata and comments. --- app.js | 16 +++++++++++----- bootstrap.js | 7 +------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index 57f88eb..1b61072 100644 --- a/app.js +++ b/app.js @@ -36,9 +36,18 @@ var console = { } return res; }, - _echoDefault: function(message) { + _useStdin: (function() { if (typeof WScript !== "undefined") { - WScript.Echo("[*] " + message) + return WScript.Arguments.Named.Exists("stdin"); + } + return false; + })(), + _echoDefault: function(message) { + if (this._useStdin) + return; + + if (typeof WScript !== "undefined") { + WScript.StdOut.WriteLine("[*] " + message); } }, _echoCallback: null, @@ -715,10 +724,7 @@ require._addScriptProvider = function(f) { } }; -///////////////////////////////////////////////////////////////////////////////// // Load script, and call app.main() -///////////////////////////////////////////////////////////////////////////////// - function initializeConsole() { if (typeof WScript === "undefined") { console.error("This is not a console application"); diff --git a/bootstrap.js b/bootstrap.js index 0e7d919..8b5c330 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -1,5 +1,5 @@ // bootstrap.js -// Copyright 2019-2025, Namhyeon Go and the WelsonJS contributors. +// Copyright 2019-2026, Namhyeon Go and the WelsonJS contributors. // SPDX-License-Identifier: GPL-3.0-or-later // https://github.com/gnh1201/welsonjs // @@ -19,11 +19,6 @@ function main(args) { console.log("Starting unlock files..."); PS.execCommand("dir | Unblock-File"); - // Allow CROS to ADO - //console.log("Adjusting CROS policy to ADO..."); - //REG.write(REG.HKCU, "SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Lockdown_Zones\\4", "1406", "00000000", REG.DWORD); - //REG.write(REG.HKLM, "SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Lockdown_Zones\\4", "1406", "00000000", REG.DWORD); - // Register HTA file association console.log("Registering HTA file association..."); REG.execFile("app\\assets\\reg\\Default_HTA.reg");