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.
This commit is contained in:
Namhyeon Go 2026-04-09 16:30:17 +09:00
parent f1456e304c
commit 2599470bb6
2 changed files with 12 additions and 11 deletions

16
app.js
View File

@ -36,9 +36,18 @@ var console = {
} }
return res; return res;
}, },
_echoDefault: function(message) { _useStdin: (function() {
if (typeof WScript !== "undefined") { 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, _echoCallback: null,
@ -715,10 +724,7 @@ require._addScriptProvider = function(f) {
} }
}; };
/////////////////////////////////////////////////////////////////////////////////
// Load script, and call app.main() // Load script, and call app.main()
/////////////////////////////////////////////////////////////////////////////////
function initializeConsole() { function initializeConsole() {
if (typeof WScript === "undefined") { if (typeof WScript === "undefined") {
console.error("This is not a console application"); console.error("This is not a console application");

7
bootstrap.js vendored
View File

@ -1,5 +1,5 @@
// bootstrap.js // bootstrap.js
// Copyright 2019-2025, Namhyeon Go <gnh1201@catswords.re.kr> and the WelsonJS contributors. // Copyright 2019-2026, Namhyeon Go <gnh1201@catswords.re.kr> and the WelsonJS contributors.
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// https://github.com/gnh1201/welsonjs // https://github.com/gnh1201/welsonjs
// //
@ -19,11 +19,6 @@ function main(args) {
console.log("Starting unlock files..."); console.log("Starting unlock files...");
PS.execCommand("dir | Unblock-File"); 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 // Register HTA file association
console.log("Registering HTA file association..."); console.log("Registering HTA file association...");
REG.execFile("app\\assets\\reg\\Default_HTA.reg"); REG.execFile("app\\assets\\reg\\Default_HTA.reg");