From 03410bc052acc978aa81b98ca51043f7eaba6f3b Mon Sep 17 00:00:00 2001 From: ZManak <118371722+ZManak@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:35:33 +0200 Subject: [PATCH 1/5] Create Create deploy-dev.yml Deploy on GitHub Pages --- .github/workflows/Create deploy-dev.yml | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/Create deploy-dev.yml diff --git a/.github/workflows/Create deploy-dev.yml b/.github/workflows/Create deploy-dev.yml new file mode 100644 index 0000000000..ff2308f6aa --- /dev/null +++ b/.github/workflows/Create deploy-dev.yml @@ -0,0 +1,33 @@ +name: "Deploy new pages build" + +on: + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm run build + - uses: actions/upload-pages-artifact@v3 + with: + path: ".app" + - name: Deploy to gh pages + id: deployment + uses: actions/deploy-pages@v4 From 166cfc4325a76007dba0475b33c4017bb97aa139 Mon Sep 17 00:00:00 2001 From: ZManak Date: Tue, 8 Jul 2025 17:40:54 +0200 Subject: [PATCH 2/5] more changes --- src/DarkWeb/DarkWeb.tsx | 8 ++++---- src/Programs/Programs.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/DarkWeb/DarkWeb.tsx b/src/DarkWeb/DarkWeb.tsx index 542d43c3c4..3ec20806a0 100644 --- a/src/DarkWeb/DarkWeb.tsx +++ b/src/DarkWeb/DarkWeb.tsx @@ -60,7 +60,7 @@ export function buyDarkwebItem(itemName: string): void { // return if the player already has it. if (Player.hasProgram(item.program)) { - Terminal.print("You already have the " + item.program + " program"); + Terminal.warn("You already have the " + item.program + " program"); return; } @@ -79,7 +79,7 @@ export function buyDarkwebItem(itemName: string): void { Player.finishWork(true); } - Terminal.print( + Terminal.success( "You have purchased the " + item.program + " program. The new program can be found on your home computer.", ); } @@ -101,12 +101,12 @@ export function buyAllDarkwebItems(): void { } if (itemsToBuy.length === 0) { - Terminal.print("All available programs have been purchased already."); + Terminal.warn("All available programs have been purchased already."); return; } if (itemsToBuy.length > 0) { - Terminal.print("All programs have been purchased."); + Terminal.success("All programs have been purchased."); return; } } diff --git a/src/Programs/Programs.ts b/src/Programs/Programs.ts index 68bb35ed85..74a67d7efb 100644 --- a/src/Programs/Programs.ts +++ b/src/Programs/Programs.ts @@ -43,17 +43,17 @@ export const Programs: Record = { } if (server.hasAdminRights) { Terminal.print("You already have root access to this computer. There is no reason to run NUKE.exe"); - Terminal.print("You can now run scripts on this server."); + Terminal.success("You can now run scripts on this server."); return; } if (server.openPortCount >= server.numOpenPortsRequired) { server.hasAdminRights = true; - Terminal.print("NUKE successful! Gained root access to " + server.hostname); - Terminal.print("You can now run scripts on this server."); + Terminal.success("NUKE successful! Gained root access to " + server.hostname); + Terminal.success("You can now run scripts on this server."); return; } - Terminal.print("NUKE unsuccessful. Not enough ports have been opened"); + Terminal.error("NUKE unsuccessful. Not enough ports have been opened"); }, }), [CompletedProgramName.bruteSsh]: new Program({ @@ -70,12 +70,12 @@ export const Programs: Record = { return; } if (server.sshPortOpen) { - Terminal.print("SSH Port (22) is already open!"); + Terminal.warn("SSH Port (22) is already open!"); return; } server.sshPortOpen = true; - Terminal.print("Opened SSH Port(22)!"); + Terminal.success("Opened SSH Port(22)!"); server.openPortCount++; }, }), @@ -93,12 +93,12 @@ export const Programs: Record = { return; } if (server.ftpPortOpen) { - Terminal.print("FTP Port (21) is already open!"); + Terminal.warn("FTP Port (21) is already open!"); return; } server.ftpPortOpen = true; - Terminal.print("Opened FTP Port (21)!"); + Terminal.success("Opened FTP Port (21)!"); server.openPortCount++; }, }), From 9abaa65ee00086896ee19ab5b8b41e35a8b7f7ca Mon Sep 17 00:00:00 2001 From: ZManak Date: Tue, 8 Jul 2025 21:20:14 +0200 Subject: [PATCH 3/5] MISC: enhance terminal verbosity for API break warnings. CColorize terminal output for commands --- src/Programs/Programs.ts | 60 +++++++++------- src/Terminal/HelpText.ts | 119 ++++++++++++++++++++------------ src/utils/APIBreaks/APIBreak.ts | 13 ++++ 3 files changed, 122 insertions(+), 70 deletions(-) diff --git a/src/Programs/Programs.ts b/src/Programs/Programs.ts index 74a67d7efb..c55dc251d1 100644 --- a/src/Programs/Programs.ts +++ b/src/Programs/Programs.ts @@ -42,7 +42,7 @@ export const Programs: Record = { return; } if (server.hasAdminRights) { - Terminal.print("You already have root access to this computer. There is no reason to run NUKE.exe"); + Terminal.warn("You already have root access to this computer. There is no reason to run NUKE.exe"); Terminal.success("You can now run scripts on this server."); return; } @@ -116,12 +116,12 @@ export const Programs: Record = { return; } if (server.smtpPortOpen) { - Terminal.print("SMTP Port (25) is already open!"); + Terminal.warn("SMTP Port (25) is already open!"); return; } server.smtpPortOpen = true; - Terminal.print("Opened SMTP Port (25)!"); + Terminal.success("Opened SMTP Port (25)!"); server.openPortCount++; }, }), @@ -139,12 +139,12 @@ export const Programs: Record = { return; } if (server.httpPortOpen) { - Terminal.print("HTTP Port (80) is already open!"); + Terminal.warn("HTTP Port (80) is already open!"); return; } server.httpPortOpen = true; - Terminal.print("Opened HTTP Port (80)!"); + Terminal.success("Opened HTTP Port (80)!"); server.openPortCount++; }, }), @@ -162,12 +162,12 @@ export const Programs: Record = { return; } if (server.sqlPortOpen) { - Terminal.print("SQL Port (1433) is already open!"); + Terminal.warn("SQL Port (1433) is already open!"); return; } server.sqlPortOpen = true; - Terminal.print("Opened SQL Port (1433)!"); + Terminal.success("Opened SQL Port (1433)!"); server.openPortCount++; }, }), @@ -180,8 +180,8 @@ export const Programs: Record = { time: CONSTANTS.MillisecondsPerQuarterHour, }, run: (): void => { - Terminal.print("This executable cannot be run."); - Terminal.print("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5."); + Terminal.error("This executable cannot be run."); + Terminal.warn("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5."); }, }), [CompletedProgramName.deepScan2]: new Program({ @@ -193,8 +193,8 @@ export const Programs: Record = { time: CONSTANTS.MillisecondsPer2Hours, }, run: (): void => { - Terminal.print("This executable cannot be run."); - Terminal.print("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10."); + Terminal.error("This executable cannot be run."); + Terminal.warn("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10."); }, }), [CompletedProgramName.serverProfiler]: new Program({ @@ -222,9 +222,21 @@ export const Programs: Record = { return; } - Terminal.print(targetServer.hostname + ":"); + if (targetServer.hasAdminRights) { + Terminal.success("Server has admin rights."); + Terminal.success(targetServer.hostname + ":"); + } else { + Terminal.error("Server has no admin rights."); + Terminal.error(targetServer.hostname + ":"); + } Terminal.print("Server base security level: " + targetServer.baseDifficulty); - Terminal.print("Server current security level: " + targetServer.hackDifficulty); + if (targetServer.hackDifficulty > targetServer.baseDifficulty) { + Terminal.warn("Server security level: " + targetServer.hackDifficulty + " (+" + (targetServer.hackDifficulty - targetServer.baseDifficulty) + ")"); + } if (targetServer.hackDifficulty < targetServer.baseDifficulty) { + Terminal.success("Server security level: " + targetServer.hackDifficulty + " (-" + (targetServer.baseDifficulty - targetServer.hackDifficulty) + ")"); + } else if (targetServer.hackDifficulty === targetServer.baseDifficulty) { + Terminal.print("Server security level: " + targetServer.hackDifficulty); + } Terminal.print("Server growth rate: " + targetServer.serverGrowth); Terminal.print( `Netscript hack() execution time: ${convertTimeMsToTimeElapsedString( @@ -255,9 +267,9 @@ export const Programs: Record = { time: CONSTANTS.MillisecondsPerQuarterHour, }, run: (): void => { - Terminal.print("This executable cannot be run."); - Terminal.print("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'."); - Terminal.print("When using scan-analyze, click on a server's hostname to connect to it."); + Terminal.error("This executable cannot be run."); + Terminal.warn("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'."); + Terminal.warn("When using scan-analyze, click on a server's hostname to connect to it."); }, }), [CompletedProgramName.formulas]: new Program({ @@ -269,8 +281,8 @@ export const Programs: Record = { time: CONSTANTS.MillisecondsPer4Hours, }, run: (): void => { - Terminal.print("This executable cannot be run."); - Terminal.print("Formulas.exe lets you use the formulas API."); + Terminal.error("This executable cannot be run."); + Terminal.warn("Formulas.exe lets you use the formulas API."); }, }), [CompletedProgramName.bitFlume]: new Program({ @@ -300,19 +312,19 @@ export const Programs: Record = { Player.augmentations.length >= numAugReq && Player.money >= 1e11 && Player.skills.hacking >= 2500; if (!fulfilled) { if (Player.augmentations.length >= numAugReq) { - Terminal.print(`[x] Augmentations: ${Player.augmentations.length} / ${numAugReq}`); + Terminal.success(`[x] Augmentations: ${Player.augmentations.length} / ${numAugReq}`); } else { - Terminal.print(`[ ] Augmentations: ${Player.augmentations.length} / ${numAugReq}`); + Terminal.warn(`[ ] Augmentations: ${Player.augmentations.length} / ${numAugReq}`); } if (Player.money >= 1e11) { - Terminal.print(`[x] Money: ${formatMoney(Player.money)} / ${formatMoney(1e11)}`); + Terminal.success(`[x] Money: ${formatMoney(Player.money)} / ${formatMoney(1e11)}`); } else { - Terminal.print(`[ ] Money: ${formatMoney(Player.money)} / ${formatMoney(1e11)}`); + Terminal.warn(`[ ] Money: ${formatMoney(Player.money)} / ${formatMoney(1e11)}`); } if (Player.skills.hacking >= 2500) { - Terminal.print(`[x] Hacking skill: ${Player.skills.hacking} / 2500`); + Terminal.success(`[x] Hacking skill: ${Player.skills.hacking} / 2500`); } else { - Terminal.print(`[ ] Hacking skill: ${Player.skills.hacking} / 2500`); + Terminal.warn(`[ ] Hacking skill: ${Player.skills.hacking} / 2500`); } return; } diff --git a/src/Terminal/HelpText.ts b/src/Terminal/HelpText.ts index 0811bbe013..ddb04c08d1 100644 --- a/src/Terminal/HelpText.ts +++ b/src/Terminal/HelpText.ts @@ -1,51 +1,78 @@ +const colors = { + black: "\x1b[30m", + red: "\x1b[31m", + green: "\x1b[32m", + yellow: "\x1b[33m", + blue: "\x1b[34m", + magenta: "\x1b[35m", + cyan: "\x1b[36m", + white: "\x1b[37m", + reset: "\x1b[0m", +}; + export const TerminalHelpText: string[] = [ "Type 'help name' to learn more about the command ", " ", - ' alias [-g] [name="value"] Create or display Terminal aliases', - " analyze Get information about the current machine ", - " backdoor Install a backdoor on the current machine ", - " buy [-l/-a/program] Purchase a program through the Dark Web", - " cat [file] Display a .msg, .lit, or .txt file", - " cd [dir] Change to a new directory", - " changelog Display changelog", - " check [script] [args...] Print a script's logs to Terminal", - " clear Clear all text on the terminal ", - " cls See 'clear' command ", - " connect [hostname] Connects to a remote server", - " cp [src] [dest] Copy a file", - " download [script/text file] Downloads scripts or text files to your computer", - " expr [math expression] Evaluate a mathematical expression", - " free Check the machine's memory (RAM) usage", - " grep [opts]... pattern [file]... Search for PATTERN (string/regular expression) in each FILE and print results to terminal", - " [-O] [target file]", - " grow Spoof money in a servers bank account, increasing the amount available.", - " hack Hack the current machine", - " help [command] Display this help text, or the help text for a command", - " history [-c] Display the terminal history", - " home Connect to home computer", - " hostname Displays the hostname of the machine", - " ipaddr Displays the IP address of the machine", - " kill [script/pid] [args...] Stops the specified script on the current server ", - " killall Stops all running scripts on the current machine", - " ls [dir] [-l] [-h] [-g pattern] Displays all files on the machine", - " lscpu Displays the number of CPU cores on the machine", - " mem [script] [-t n] Displays the amount of RAM required to run the script", - " mv [src] [dest] Move/rename a text or script file", - " nano [files...] Text editor - Open up and edit one or more scripts or text files", - " ps Display all scripts that are currently running", - " rm [OPTIONS]... [FILE]... Delete a file from the server", - " run [script] [-t n] [--tail] Execute a program or script", - " [--ram-override n] [args...]", - " scan Prints all immediately-available network connections", - " scan-analyze [d] [-a] Prints info for all servers up to d nodes away", - " scp [files...] [server] Copies a file to a destination server", - " sudov Shows whether you have root access on this computer", - " tail [script/pid] [args...] Displays dynamic logs for the specified script", - " top Displays all running scripts and their RAM usage", - " unalias [alias name] Deletes the specified alias", - " vim [files...] Text editor - Open up and edit one or more scripts or text files in vim mode", - " weaken Reduce the security of the current machine", - " wget [url] [target file] Retrieves code/text from a web server", + colors.green + + " alias" + + colors.yellow + + ' [-g] [name="value"] ' + + colors.reset + + "Create or display Terminal aliases", + colors.green + " analyze" + colors.yellow + " " + colors.reset + "Get information about the current machine ", + colors.green + " backdoor" + colors.yellow + " " + colors.reset + "Install a backdoor on the current machine ", + colors.green + " buy" + colors.yellow + " [-l/-a/program] " + colors.reset + "Purchase a program through the Dark Web", + colors.green + " cat" + colors.yellow + " [file] " + colors.reset + "Display a .msg, .lit, or .txt file", + colors.green + " cd" + colors.yellow + " [dir] " + colors.reset + "Change to a new directory", + colors.green + " changelog" + colors.yellow + " " + colors.reset + "Display changelog", + colors.green + " check" + colors.yellow + " [script] [args...] " + colors.reset + "Print a script's logs to Terminal", + colors.green + " clear" + colors.yellow + " " + colors.reset + "Clear all text on the terminal ", + colors.green + " cls" + colors.yellow + " " + colors.reset + "See 'clear' command ", + colors.green + " connect" + colors.yellow + " [hostname] " + colors.reset + "Connects to a remote server", + colors.green + " cp" + colors.yellow + " [src] [dest] " + colors.reset + "Copy a file", + colors.green + " download" + colors.yellow + " [script/text file] " + colors.reset + "Downloads scripts or text files to your computer", + colors.green + " expr" + colors.yellow + " [math expression] " + colors.reset + "Evaluate a mathematical expression", + colors.green + " free" + colors.yellow + " " + colors.reset + "Check the machine's memory (RAM) usage", + colors.green + + " grep" + + colors.yellow + + " [opts]... pattern [file]... " + + colors.reset + + "Search for PATTERN (string/regular expression) in each FILE and print results to terminal", + colors.yellow + " [-O] [target file]" + colors.reset, + colors.green + + " grow" + + colors.yellow + + " " + + colors.reset + + "Spoof money in a servers bank account, increasing the amount available.", + colors.green + " hack" + colors.yellow + " " + colors.reset + "Hack the current machine", + colors.green + " help" + colors.yellow + " [command] " + colors.reset + "Display this help text, or the help text for a command", + colors.green + " history" + colors.yellow + " [-c] " + colors.reset + "Display the terminal history", + colors.green + " home" + colors.yellow + " " + colors.reset + "Connect to home computer", + colors.green + " hostname" + colors.yellow + " " + colors.reset + "Displays the hostname of the machine", + colors.green + " ipaddr" + colors.yellow + " " + colors.reset + "Displays the IP address of the machine", + colors.green + " kill" + colors.yellow + " [script/pid] [args...] " + colors.reset + "Stops the specified script on the current server ", + colors.green + " killall" + colors.yellow + " " + colors.reset + "Stops all running scripts on the current machine", + colors.green + " ls" + colors.yellow + " [dir] [-l] [-h] [-g pattern] " + colors.reset + "Displays all files on the machine", + colors.green + " lscpu" + colors.yellow + " " + colors.reset + "Displays the number of CPU cores on the machine", + colors.green + " mem" + colors.yellow + " [script] [-t n] " + colors.reset + "Displays the amount of RAM required to run the script", + colors.green + " mv" + colors.yellow + " [src] [dest] " + colors.reset + "Move/rename a text or script file", + colors.green + " nano" + colors.yellow + " [files...] " + colors.reset + "Text editor - Open up and edit one or more scripts or text files", + colors.green + " ps" + colors.yellow + " " + colors.reset + "Display all scripts that are currently running", + colors.green + " rm" + colors.yellow + " [OPTIONS]... [FILE]... " + colors.reset + "Delete a file from the server", + colors.green + " run" + colors.yellow + " [script] [-t n] [--tail] " + colors.reset + "Execute a program or script", + colors.yellow + " [--ram-override n] [args...]" + colors.reset, + colors.green + " scan" + colors.yellow + " " + colors.reset + "Prints all immediately-available network connections", + colors.green + " scan-analyze" + colors.yellow + " [d] [-a] " + colors.reset + "Prints info for all servers up to d nodes away", + colors.green + " scp" + colors.yellow + " [files...] [server] " + colors.reset + "Copies a file to a destination server", + colors.green + " sudov" + colors.yellow + " " + colors.reset + "Shows whether you have root access on this computer", + colors.green + " tail" + colors.yellow + " [script/pid] [args...] " + colors.reset + "Displays dynamic logs for the specified script", + colors.green + " top" + colors.yellow + " " + colors.reset + "Displays all running scripts and their RAM usage", + colors.green + " unalias" + colors.yellow + " [alias name] " + colors.reset + "Deletes the specified alias", + colors.green + " vim" + colors.yellow + " [files...] " + colors.reset + "Text editor - Open up and edit one or more scripts or text files in vim mode", + colors.green + " weaken" + colors.yellow + " " + colors.reset + "Reduce the security of the current machine", + colors.green + " wget" + colors.yellow + " [url] [target file] " + colors.reset + "Retrieves code/text from a web server", " ", ]; @@ -75,7 +102,7 @@ const TemplatedHelpTexts: Record string[]> = { export const HelpTexts: Record = { alias: [ - 'Usage: alias [-g] [name="value"] ', + colors.yellow + 'Usage: alias [-g] [name="value"] ', " ", "Create or display aliases. An alias enables a replacement of a word with another string. ", "It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME ", diff --git a/src/utils/APIBreaks/APIBreak.ts b/src/utils/APIBreaks/APIBreak.ts index 8cba9498ee..7353ce0c71 100644 --- a/src/utils/APIBreaks/APIBreak.ts +++ b/src/utils/APIBreaks/APIBreak.ts @@ -9,6 +9,7 @@ import { dialogBoxCreate as dialogBoxCreateOriginal } from "../../ui/React/Dialo import { Terminal } from "../../Terminal"; import { pluralize } from "../I18nUtils"; + // Temporary until fixing alerts manager to store alerts outside of react scope const dialogBoxCreate = (text: string) => setTimeout(() => dialogBoxCreateOriginal(text, { html: false, canBeDismissedEasily: false }), 2000); @@ -155,8 +156,10 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan textFileName, `API BREAK INFO FOR ${version}\n\n${details.map((detail) => detail.text).join("\n\n\n\n")}`, ); + Terminal.warn(`AN API BREAK FROM VERSION ${version} MAY HAVE AFFECTED SOME OF YOUR SCRIPTS.`); Terminal.warn(`INFORMATION ABOUT THIS POTENTIAL IMPACT HAS BEEN LOGGED IN ${textFileName} ON YOUR HOME COMPUTER.`); + dialogBoxCreate( `SOME OF YOUR SCRIPTS HAVE POTENTIALLY BEEN IMPACTED BY AN API BREAK, DUE TO CHANGES IN VERSION ${version}\n\n` + "The following dialog boxes will provide details of the potential impact to your scripts.\n" + @@ -180,6 +183,16 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan ? `\n\nWe found ${pluralize(detail.totalDetectedLines, "affected line")}.` : ""), ); + ++popUpIndex; } + //Made terminal more verbose + for (const detail of details) { + if (detail.totalDetectedLines > 0) { + Terminal.warn("_____________"); + Terminal.warn(`${detail.apiBreakInfo.info}`); + Terminal.error(`We found ${pluralize(detail.totalDetectedLines, "affected line")}.`); + } + } } + From 0ad5adfe30ed28aa753daf1faed49b182425054a Mon Sep 17 00:00:00 2001 From: ZManak Date: Tue, 8 Jul 2025 21:28:22 +0200 Subject: [PATCH 4/5] lint/format --- src/Programs/Programs.ts | 21 ++- src/Terminal/HelpText.ts | 259 +++++++++++++++++++++++++++----- src/utils/APIBreaks/APIBreak.ts | 2 - 3 files changed, 239 insertions(+), 43 deletions(-) diff --git a/src/Programs/Programs.ts b/src/Programs/Programs.ts index c55dc251d1..fc2983afa6 100644 --- a/src/Programs/Programs.ts +++ b/src/Programs/Programs.ts @@ -222,7 +222,7 @@ export const Programs: Record = { return; } - if (targetServer.hasAdminRights) { + if (targetServer.hasAdminRights) { Terminal.success("Server has admin rights."); Terminal.success(targetServer.hostname + ":"); } else { @@ -231,9 +231,22 @@ export const Programs: Record = { } Terminal.print("Server base security level: " + targetServer.baseDifficulty); if (targetServer.hackDifficulty > targetServer.baseDifficulty) { - Terminal.warn("Server security level: " + targetServer.hackDifficulty + " (+" + (targetServer.hackDifficulty - targetServer.baseDifficulty) + ")"); - } if (targetServer.hackDifficulty < targetServer.baseDifficulty) { - Terminal.success("Server security level: " + targetServer.hackDifficulty + " (-" + (targetServer.baseDifficulty - targetServer.hackDifficulty) + ")"); + Terminal.warn( + "Server security level: " + + targetServer.hackDifficulty + + " (+" + + (targetServer.hackDifficulty - targetServer.baseDifficulty) + + ")", + ); + } + if (targetServer.hackDifficulty < targetServer.baseDifficulty) { + Terminal.success( + "Server security level: " + + targetServer.hackDifficulty + + " (-" + + (targetServer.baseDifficulty - targetServer.hackDifficulty) + + ")", + ); } else if (targetServer.hackDifficulty === targetServer.baseDifficulty) { Terminal.print("Server security level: " + targetServer.hackDifficulty); } diff --git a/src/Terminal/HelpText.ts b/src/Terminal/HelpText.ts index ddb04c08d1..b8d276e9dd 100644 --- a/src/Terminal/HelpText.ts +++ b/src/Terminal/HelpText.ts @@ -19,20 +19,75 @@ export const TerminalHelpText: string[] = [ ' [-g] [name="value"] ' + colors.reset + "Create or display Terminal aliases", - colors.green + " analyze" + colors.yellow + " " + colors.reset + "Get information about the current machine ", - colors.green + " backdoor" + colors.yellow + " " + colors.reset + "Install a backdoor on the current machine ", - colors.green + " buy" + colors.yellow + " [-l/-a/program] " + colors.reset + "Purchase a program through the Dark Web", - colors.green + " cat" + colors.yellow + " [file] " + colors.reset + "Display a .msg, .lit, or .txt file", - colors.green + " cd" + colors.yellow + " [dir] " + colors.reset + "Change to a new directory", + colors.green + + " analyze" + + colors.yellow + + " " + + colors.reset + + "Get information about the current machine ", + colors.green + + " backdoor" + + colors.yellow + + " " + + colors.reset + + "Install a backdoor on the current machine ", + colors.green + + " buy" + + colors.yellow + + " [-l/-a/program] " + + colors.reset + + "Purchase a program through the Dark Web", + colors.green + + " cat" + + colors.yellow + + " [file] " + + colors.reset + + "Display a .msg, .lit, or .txt file", + colors.green + + " cd" + + colors.yellow + + " [dir] " + + colors.reset + + "Change to a new directory", colors.green + " changelog" + colors.yellow + " " + colors.reset + "Display changelog", - colors.green + " check" + colors.yellow + " [script] [args...] " + colors.reset + "Print a script's logs to Terminal", - colors.green + " clear" + colors.yellow + " " + colors.reset + "Clear all text on the terminal ", + colors.green + + " check" + + colors.yellow + + " [script] [args...] " + + colors.reset + + "Print a script's logs to Terminal", + colors.green + + " clear" + + colors.yellow + + " " + + colors.reset + + "Clear all text on the terminal ", colors.green + " cls" + colors.yellow + " " + colors.reset + "See 'clear' command ", - colors.green + " connect" + colors.yellow + " [hostname] " + colors.reset + "Connects to a remote server", + colors.green + + " connect" + + colors.yellow + + " [hostname] " + + colors.reset + + "Connects to a remote server", colors.green + " cp" + colors.yellow + " [src] [dest] " + colors.reset + "Copy a file", - colors.green + " download" + colors.yellow + " [script/text file] " + colors.reset + "Downloads scripts or text files to your computer", - colors.green + " expr" + colors.yellow + " [math expression] " + colors.reset + "Evaluate a mathematical expression", - colors.green + " free" + colors.yellow + " " + colors.reset + "Check the machine's memory (RAM) usage", + colors.green + + " download" + + colors.yellow + + " [script/text file] " + + colors.reset + + "Downloads scripts or text files to your computer", + colors.green + + " expr" + + colors.yellow + + " [math expression] " + + colors.reset + + "Evaluate a mathematical expression", + colors.green + + " free" + + colors.yellow + + " " + + colors.reset + + "Check the machine's memory (RAM) usage", colors.green + " grep" + colors.yellow + @@ -46,33 +101,163 @@ export const TerminalHelpText: string[] = [ " " + colors.reset + "Spoof money in a servers bank account, increasing the amount available.", - colors.green + " hack" + colors.yellow + " " + colors.reset + "Hack the current machine", - colors.green + " help" + colors.yellow + " [command] " + colors.reset + "Display this help text, or the help text for a command", - colors.green + " history" + colors.yellow + " [-c] " + colors.reset + "Display the terminal history", - colors.green + " home" + colors.yellow + " " + colors.reset + "Connect to home computer", - colors.green + " hostname" + colors.yellow + " " + colors.reset + "Displays the hostname of the machine", - colors.green + " ipaddr" + colors.yellow + " " + colors.reset + "Displays the IP address of the machine", - colors.green + " kill" + colors.yellow + " [script/pid] [args...] " + colors.reset + "Stops the specified script on the current server ", - colors.green + " killall" + colors.yellow + " " + colors.reset + "Stops all running scripts on the current machine", - colors.green + " ls" + colors.yellow + " [dir] [-l] [-h] [-g pattern] " + colors.reset + "Displays all files on the machine", - colors.green + " lscpu" + colors.yellow + " " + colors.reset + "Displays the number of CPU cores on the machine", - colors.green + " mem" + colors.yellow + " [script] [-t n] " + colors.reset + "Displays the amount of RAM required to run the script", - colors.green + " mv" + colors.yellow + " [src] [dest] " + colors.reset + "Move/rename a text or script file", - colors.green + " nano" + colors.yellow + " [files...] " + colors.reset + "Text editor - Open up and edit one or more scripts or text files", - colors.green + " ps" + colors.yellow + " " + colors.reset + "Display all scripts that are currently running", - colors.green + " rm" + colors.yellow + " [OPTIONS]... [FILE]... " + colors.reset + "Delete a file from the server", - colors.green + " run" + colors.yellow + " [script] [-t n] [--tail] " + colors.reset + "Execute a program or script", + colors.green + + " hack" + + colors.yellow + + " " + + colors.reset + + "Hack the current machine", + colors.green + + " help" + + colors.yellow + + " [command] " + + colors.reset + + "Display this help text, or the help text for a command", + colors.green + + " history" + + colors.yellow + + " [-c] " + + colors.reset + + "Display the terminal history", + colors.green + + " home" + + colors.yellow + + " " + + colors.reset + + "Connect to home computer", + colors.green + + " hostname" + + colors.yellow + + " " + + colors.reset + + "Displays the hostname of the machine", + colors.green + + " ipaddr" + + colors.yellow + + " " + + colors.reset + + "Displays the IP address of the machine", + colors.green + + " kill" + + colors.yellow + + " [script/pid] [args...] " + + colors.reset + + "Stops the specified script on the current server ", + colors.green + + " killall" + + colors.yellow + + " " + + colors.reset + + "Stops all running scripts on the current machine", + colors.green + + " ls" + + colors.yellow + + " [dir] [-l] [-h] [-g pattern] " + + colors.reset + + "Displays all files on the machine", + colors.green + + " lscpu" + + colors.yellow + + " " + + colors.reset + + "Displays the number of CPU cores on the machine", + colors.green + + " mem" + + colors.yellow + + " [script] [-t n] " + + colors.reset + + "Displays the amount of RAM required to run the script", + colors.green + + " mv" + + colors.yellow + + " [src] [dest] " + + colors.reset + + "Move/rename a text or script file", + colors.green + + " nano" + + colors.yellow + + " [files...] " + + colors.reset + + "Text editor - Open up and edit one or more scripts or text files", + colors.green + + " ps" + + colors.yellow + + " " + + colors.reset + + "Display all scripts that are currently running", + colors.green + + " rm" + + colors.yellow + + " [OPTIONS]... [FILE]... " + + colors.reset + + "Delete a file from the server", + colors.green + + " run" + + colors.yellow + + " [script] [-t n] [--tail] " + + colors.reset + + "Execute a program or script", colors.yellow + " [--ram-override n] [args...]" + colors.reset, - colors.green + " scan" + colors.yellow + " " + colors.reset + "Prints all immediately-available network connections", - colors.green + " scan-analyze" + colors.yellow + " [d] [-a] " + colors.reset + "Prints info for all servers up to d nodes away", - colors.green + " scp" + colors.yellow + " [files...] [server] " + colors.reset + "Copies a file to a destination server", - colors.green + " sudov" + colors.yellow + " " + colors.reset + "Shows whether you have root access on this computer", - colors.green + " tail" + colors.yellow + " [script/pid] [args...] " + colors.reset + "Displays dynamic logs for the specified script", - colors.green + " top" + colors.yellow + " " + colors.reset + "Displays all running scripts and their RAM usage", - colors.green + " unalias" + colors.yellow + " [alias name] " + colors.reset + "Deletes the specified alias", - colors.green + " vim" + colors.yellow + " [files...] " + colors.reset + "Text editor - Open up and edit one or more scripts or text files in vim mode", - colors.green + " weaken" + colors.yellow + " " + colors.reset + "Reduce the security of the current machine", - colors.green + " wget" + colors.yellow + " [url] [target file] " + colors.reset + "Retrieves code/text from a web server", + colors.green + + " scan" + + colors.yellow + + " " + + colors.reset + + "Prints all immediately-available network connections", + colors.green + + " scan-analyze" + + colors.yellow + + " [d] [-a] " + + colors.reset + + "Prints info for all servers up to d nodes away", + colors.green + + " scp" + + colors.yellow + + " [files...] [server] " + + colors.reset + + "Copies a file to a destination server", + colors.green + + " sudov" + + colors.yellow + + " " + + colors.reset + + "Shows whether you have root access on this computer", + colors.green + + " tail" + + colors.yellow + + " [script/pid] [args...] " + + colors.reset + + "Displays dynamic logs for the specified script", + colors.green + + " top" + + colors.yellow + + " " + + colors.reset + + "Displays all running scripts and their RAM usage", + colors.green + + " unalias" + + colors.yellow + + " [alias name] " + + colors.reset + + "Deletes the specified alias", + colors.green + + " vim" + + colors.yellow + + " [files...] " + + colors.reset + + "Text editor - Open up and edit one or more scripts or text files in vim mode", + colors.green + + " weaken" + + colors.yellow + + " " + + colors.reset + + "Reduce the security of the current machine", + colors.green + + " wget" + + colors.yellow + + " [url] [target file] " + + colors.reset + + "Retrieves code/text from a web server", " ", ]; diff --git a/src/utils/APIBreaks/APIBreak.ts b/src/utils/APIBreaks/APIBreak.ts index 7353ce0c71..ac91175750 100644 --- a/src/utils/APIBreaks/APIBreak.ts +++ b/src/utils/APIBreaks/APIBreak.ts @@ -9,7 +9,6 @@ import { dialogBoxCreate as dialogBoxCreateOriginal } from "../../ui/React/Dialo import { Terminal } from "../../Terminal"; import { pluralize } from "../I18nUtils"; - // Temporary until fixing alerts manager to store alerts outside of react scope const dialogBoxCreate = (text: string) => setTimeout(() => dialogBoxCreateOriginal(text, { html: false, canBeDismissedEasily: false }), 2000); @@ -195,4 +194,3 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan } } } - From aaf750c6c1f8dab363b1232cc914eb6e45d98365 Mon Sep 17 00:00:00 2001 From: ZManak Date: Wed, 9 Jul 2025 21:50:44 +0200 Subject: [PATCH 5/5] APIBreak output in terminal, reduced popups --- src/Terminal/HelpText.ts | 364 +++++++++----------------------- src/Terminal/commands/help.ts | 2 +- src/utils/APIBreaks/APIBreak.ts | 57 ++--- 3 files changed, 134 insertions(+), 289 deletions(-) diff --git a/src/Terminal/HelpText.ts b/src/Terminal/HelpText.ts index b8d276e9dd..5cf3283435 100644 --- a/src/Terminal/HelpText.ts +++ b/src/Terminal/HelpText.ts @@ -1,265 +1,109 @@ + const colors = { - black: "\x1b[30m", - red: "\x1b[31m", - green: "\x1b[32m", - yellow: "\x1b[33m", - blue: "\x1b[34m", - magenta: "\x1b[35m", - cyan: "\x1b[36m", - white: "\x1b[37m", - reset: "\x1b[0m", + cmd: "\x1b[32m", + args: "\x1b[33m", + txt: "\x1b[0m", }; -export const TerminalHelpText: string[] = [ - "Type 'help name' to learn more about the command ", - " ", - colors.green + - " alias" + - colors.yellow + - ' [-g] [name="value"] ' + - colors.reset + - "Create or display Terminal aliases", - colors.green + - " analyze" + - colors.yellow + - " " + - colors.reset + - "Get information about the current machine ", - colors.green + - " backdoor" + - colors.yellow + - " " + - colors.reset + - "Install a backdoor on the current machine ", - colors.green + - " buy" + - colors.yellow + - " [-l/-a/program] " + - colors.reset + - "Purchase a program through the Dark Web", - colors.green + - " cat" + - colors.yellow + - " [file] " + - colors.reset + - "Display a .msg, .lit, or .txt file", - colors.green + - " cd" + - colors.yellow + - " [dir] " + - colors.reset + - "Change to a new directory", - colors.green + " changelog" + colors.yellow + " " + colors.reset + "Display changelog", - colors.green + - " check" + - colors.yellow + - " [script] [args...] " + - colors.reset + - "Print a script's logs to Terminal", - colors.green + - " clear" + - colors.yellow + - " " + - colors.reset + - "Clear all text on the terminal ", - colors.green + " cls" + colors.yellow + " " + colors.reset + "See 'clear' command ", - colors.green + - " connect" + - colors.yellow + - " [hostname] " + - colors.reset + - "Connects to a remote server", - colors.green + " cp" + colors.yellow + " [src] [dest] " + colors.reset + "Copy a file", - colors.green + - " download" + - colors.yellow + - " [script/text file] " + - colors.reset + - "Downloads scripts or text files to your computer", - colors.green + - " expr" + - colors.yellow + - " [math expression] " + - colors.reset + - "Evaluate a mathematical expression", - colors.green + - " free" + - colors.yellow + - " " + - colors.reset + - "Check the machine's memory (RAM) usage", - colors.green + - " grep" + - colors.yellow + - " [opts]... pattern [file]... " + - colors.reset + - "Search for PATTERN (string/regular expression) in each FILE and print results to terminal", - colors.yellow + " [-O] [target file]" + colors.reset, - colors.green + - " grow" + - colors.yellow + - " " + - colors.reset + - "Spoof money in a servers bank account, increasing the amount available.", - colors.green + - " hack" + - colors.yellow + - " " + - colors.reset + - "Hack the current machine", - colors.green + - " help" + - colors.yellow + - " [command] " + - colors.reset + - "Display this help text, or the help text for a command", - colors.green + - " history" + - colors.yellow + - " [-c] " + - colors.reset + - "Display the terminal history", - colors.green + - " home" + - colors.yellow + - " " + - colors.reset + - "Connect to home computer", - colors.green + - " hostname" + - colors.yellow + - " " + - colors.reset + - "Displays the hostname of the machine", - colors.green + - " ipaddr" + - colors.yellow + - " " + - colors.reset + - "Displays the IP address of the machine", - colors.green + - " kill" + - colors.yellow + - " [script/pid] [args...] " + - colors.reset + - "Stops the specified script on the current server ", - colors.green + - " killall" + - colors.yellow + - " " + - colors.reset + - "Stops all running scripts on the current machine", - colors.green + - " ls" + - colors.yellow + - " [dir] [-l] [-h] [-g pattern] " + - colors.reset + - "Displays all files on the machine", - colors.green + - " lscpu" + - colors.yellow + - " " + - colors.reset + - "Displays the number of CPU cores on the machine", - colors.green + - " mem" + - colors.yellow + - " [script] [-t n] " + - colors.reset + - "Displays the amount of RAM required to run the script", - colors.green + - " mv" + - colors.yellow + - " [src] [dest] " + - colors.reset + - "Move/rename a text or script file", - colors.green + - " nano" + - colors.yellow + - " [files...] " + - colors.reset + - "Text editor - Open up and edit one or more scripts or text files", - colors.green + - " ps" + - colors.yellow + - " " + - colors.reset + - "Display all scripts that are currently running", - colors.green + - " rm" + - colors.yellow + - " [OPTIONS]... [FILE]... " + - colors.reset + - "Delete a file from the server", - colors.green + - " run" + - colors.yellow + - " [script] [-t n] [--tail] " + - colors.reset + - "Execute a program or script", - colors.yellow + " [--ram-override n] [args...]" + colors.reset, - colors.green + - " scan" + - colors.yellow + - " " + - colors.reset + - "Prints all immediately-available network connections", - colors.green + - " scan-analyze" + - colors.yellow + - " [d] [-a] " + - colors.reset + - "Prints info for all servers up to d nodes away", - colors.green + - " scp" + - colors.yellow + - " [files...] [server] " + - colors.reset + - "Copies a file to a destination server", - colors.green + - " sudov" + - colors.yellow + - " " + - colors.reset + - "Shows whether you have root access on this computer", - colors.green + - " tail" + - colors.yellow + - " [script/pid] [args...] " + - colors.reset + - "Displays dynamic logs for the specified script", - colors.green + - " top" + - colors.yellow + - " " + - colors.reset + - "Displays all running scripts and their RAM usage", - colors.green + - " unalias" + - colors.yellow + - " [alias name] " + - colors.reset + - "Deletes the specified alias", - colors.green + - " vim" + - colors.yellow + - " [files...] " + - colors.reset + - "Text editor - Open up and edit one or more scripts or text files in vim mode", - colors.green + - " weaken" + - colors.yellow + - " " + - colors.reset + - "Reduce the security of the current machine", - colors.green + - " wget" + - colors.yellow + - " [url] [target file] " + - colors.reset + - "Retrieves code/text from a web server", - " ", -]; +/* const commands = { + alias:"alias", + analyze:"analyze", + backdoor:"backdoor", + buy:"buy", + cat:"cat", + cd:"cd", + changelog:"changelog", + check:"check", + clear:"clear", + cls:"cls", + connect:"connect", + cp:"cp", + download:"download", + expr:"expr", + free:"free", + grep:"grep", + grow:"grow", + hack:"hack", + help:"help", + history:"history", + home:"home", + hostname:"hostname", + ipaddr:"ipaddr", + kill:"kill", + killall:"killall", + ls:"ls", + lscpu:"lscpu", + mem:"mem", + mv:"mv", + open:"open", + ps:"ps", + pwd:"pwd", + read:"read", + reboot:"reboot", + rebootall:"rebootall", + reload:"reload", + rm:"rm", + scan:"scan", + scananalyze:"scananalyze", + scp:"scp", + sudov:"sudov", + tail:"tail", + top:"top", + unalias:"unalias", + vim:"vim", + weaken:"weaken", + wget:"wget", +}; */ + +// Rewritten as a single string +export const TerminalHelpText: string = `Type 'help name' to learn more about the command + +${colors.cmd} alias ${colors.args}[-g] [name:"value"] ${colors.txt}Create or display Terminal aliases +${colors.cmd} analyze ${colors.args}[script] ${colors.txt}Get information about the current script +${colors.cmd} backdoor ${colors.args} ${colors.txt}Install backdoor on the current machine +${colors.cmd} buy ${colors.args}[-l/-a] ${colors.txt}Purchase programs through the Dark Web +${colors.cmd} cat ${colors.args}[file] ${colors.txt}Display .msg, .lit or .txt files +${colors.cmd} cd ${colors.args}[dir] ${colors.txt}Change to a new directory +${colors.cmd} changelog ${colors.args} ${colors.txt}Display changelog +${colors.cmd} check ${colors.args}[script] [args...] ${colors.txt}Print a script's logs to Terminal +${colors.cmd} clear ${colors.args} ${colors.txt}Clear all text on the terminal +${colors.cmd} cls ${colors.args} ${colors.txt}See 'clear' command +${colors.cmd} connect ${colors.args}[hostname] ${colors.txt}Connects to a remote server +${colors.cmd} cp ${colors.args}[src] [dest] ${colors.txt}Copy a file +${colors.cmd} download ${colors.args}[script/text file] ${colors.txt}Downloads scripts or text files to your computer +${colors.cmd} expr ${colors.args}[math expression] ${colors.txt}Evaluate a mathematical expression +${colors.cmd} free ${colors.args} ${colors.txt}Check the machine's memory (RAM) usage +${colors.cmd} grep ${colors.args}[opts]... pattern [file]... ${colors.txt}Search for PATTERN (string/regular expression) in each FILE and print results to terminal +${colors.args} [-O] [target file] +${colors.cmd} grow ${colors.args} ${colors.txt}Spoof money in a servers bank account, increasing the amount available +${colors.cmd} hack ${colors.args} ${colors.txt}Hack the current machine +${colors.cmd} help ${colors.args}[command] ${colors.txt}Display this help text, or the help text for a command +${colors.cmd} history ${colors.args}[-c] ${colors.txt}Display the terminal history +${colors.cmd} home ${colors.args} ${colors.txt}Connect to home computer +${colors.cmd} hostname ${colors.args} ${colors.txt}Displays the hostname of the machine +${colors.cmd} ipaddr ${colors.args} ${colors.txt}Displays the IP address of the machine +${colors.cmd} kill ${colors.args}[script/pid] [args...] ${colors.txt}Stops the specified script on the current server +${colors.cmd} killall ${colors.args} ${colors.txt}Stops all running scripts on the current machine +${colors.cmd} ls ${colors.args}[dir] [-l] [-h] [-g pattern] ${colors.txt}Displays all files on the machine +${colors.cmd} lscpu ${colors.args} ${colors.txt}Displays the number of CPU cores on the machine +${colors.cmd} mem ${colors.args}[script] [-t n] ${colors.txt}Displays the amount of RAM required to run the script +${colors.cmd} mv ${colors.args}[src] [dest] ${colors.txt}Move/rename a text or script file +${colors.cmd} nano ${colors.args}[files...] ${colors.txt}Text editor - Open up and edit one or more scripts or text files +${colors.cmd} ps ${colors.args} ${colors.txt}Display all scripts that are currently running +${colors.cmd} rm ${colors.args}[OPTIONS]... [FILE]... ${colors.txt}Delete a file from the server +${colors.cmd} run ${colors.args}[script] [-t n] [--tail] ${colors.txt}Execute a program or script +${colors.args} [--ram-override n] [args...] +${colors.cmd} scan ${colors.args} ${colors.txt}Prints all immediately-available network connections +${colors.cmd} scan-analyze${colors.args}[d] [-a] ${colors.txt}Prints info for all servers up to d nodes away +${colors.cmd} scp ${colors.args}[files...] [server] ${colors.txt}Copies a file to a destination server +${colors.cmd} sudov ${colors.args} ${colors.txt}Shows whether you have root access on this computer +${colors.cmd} tail ${colors.args}[script/pid] [args...] ${colors.txt}Displays dynamic logs for the specified script +${colors.cmd} top ${colors.args} ${colors.txt}Displays all running scripts and their RAM usage +${colors.cmd} unalias ${colors.args}[alias name] ${colors.txt}Deletes the specified alias +${colors.cmd} vim ${colors.args}[files...] ${colors.txt}Text editor - Open up and edit one or more scripts or text files in vim mode +${colors.cmd} weaken ${colors.args} ${colors.txt}Reduce the security of the current machine +${colors.cmd} wget ${colors.args}[url] [target file] ${colors.txt}Retrieves code/text from a web server +`; const TemplatedHelpTexts: Record string[]> = { scriptEditor: (command) => { @@ -287,7 +131,7 @@ const TemplatedHelpTexts: Record string[]> = { export const HelpTexts: Record = { alias: [ - colors.yellow + 'Usage: alias [-g] [name="value"] ', + 'Usage: alias [-g] [name="value"] ', " ", "Create or display aliases. An alias enables a replacement of a word with another string. ", "It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME ", diff --git a/src/Terminal/commands/help.ts b/src/Terminal/commands/help.ts index 6bdf2a0d5e..8744784a99 100644 --- a/src/Terminal/commands/help.ts +++ b/src/Terminal/commands/help.ts @@ -7,7 +7,7 @@ export function help(args: (string | number | boolean)[]): void { return; } if (args.length === 0) { - TerminalHelpText.forEach((line) => Terminal.print(line)); + Terminal.print(TerminalHelpText); } else { const cmd = args[0] + ""; const txt = HelpTexts[cmd]; diff --git a/src/utils/APIBreaks/APIBreak.ts b/src/utils/APIBreaks/APIBreak.ts index ac91175750..92a70ccaa1 100644 --- a/src/utils/APIBreaks/APIBreak.ts +++ b/src/utils/APIBreaks/APIBreak.ts @@ -105,7 +105,7 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan totalDetectedLines: number; showPopUp: boolean; }[] = []; - let numberOfPopUps = 0; + //let numberOfPopUps = 0; for (const breakInfo of apiBreakingChanges) { const scanResult = detectImpactAndMigrate(breakInfo.brokenAPIs); const impactMap = scanResult.impactMap; @@ -140,9 +140,9 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan totalDetectedLines: scanResult.totalDetectedLines, showPopUp: breakInfo.showPopUp, }); - if (breakInfo.showPopUp) { - ++numberOfPopUps; - } + //if (breakInfo.showPopUp) { + // ++numberOfPopUps; + //} } if (!details.length) { return; @@ -153,44 +153,45 @@ export function showAPIBreaks(version: string, { additionalText, apiBreakingChan } Player.getHomeComputer().writeToTextFile( textFileName, - `API BREAK INFO FOR ${version}\n\n${details.map((detail) => detail.text).join("\n\n\n\n")}`, + `API BREAK INFO FOR ${version}\n\n${details.map((detail) => detail.text).join("\n\n\n\n")} \n\n${additionalText}`, ); Terminal.warn(`AN API BREAK FROM VERSION ${version} MAY HAVE AFFECTED SOME OF YOUR SCRIPTS.`); Terminal.warn(`INFORMATION ABOUT THIS POTENTIAL IMPACT HAS BEEN LOGGED IN ${textFileName} ON YOUR HOME COMPUTER.`); + + // Show a dialog box with the API break info + dialogBoxCreate( - `SOME OF YOUR SCRIPTS HAVE POTENTIALLY BEEN IMPACTED BY AN API BREAK, DUE TO CHANGES IN VERSION ${version}\n\n` + - "The following dialog boxes will provide details of the potential impact to your scripts.\n" + - `A file with these details has also been saved on your home computer under filename ${textFileName}.` + - (additionalText ? `\n\n${additionalText}` : ""), + `SOME OF YOUR SCRIPTS HAVE POTENTIALLY BEEN IMPACTED BY AN API BREAK, DUE TO CHANGES IN VERSION ${version}` + + (additionalText ? `\n${additionalText}` : "") + + `\n\nPlease check the log file ${textFileName} on your home computer for more details.` + + `\n${details.map((detail) => detail.apiBreakInfo.info).join("\n\n\n\n")}`, ); - let popUpIndex = 0; + + /**let popUpIndex = 0; for (const detail of details) { if (!detail.showPopUp) { continue; } - dialogBoxCreate( - `API BREAK VERSION ${version} DETAILS ${popUpIndex + 1} of ${numberOfPopUps}\n\n${detail.apiBreakInfo.info}` + - /** - * If we can detect the affected lines via apiBreakInfo.brokenAPIs, we will show the number of affected lines. - * However, some breaking changes cannot be reliably detected, so we intentionally leave apiBreakInfo.brokenAPIs - * empty. With these changes, the number of affected lines is always 0, but saying that there are no affected - * lines is misleading, so we won't say anything about the number of affected lines. - */ - (detail.apiBreakInfo.brokenAPIs.length > 0 - ? `\n\nWe found ${pluralize(detail.totalDetectedLines, "affected line")}.` - : ""), - ); + if (popUpIndex >= numberOfPopUps) { + break; + } + */ - ++popUpIndex; - } //Made terminal more verbose - for (const detail of details) { - if (detail.totalDetectedLines > 0) { - Terminal.warn("_____________"); + for (const detail of details) { + Terminal.print(`${details.length >= 1 ? `API Break #${details.indexOf(detail) + 1}:` : "API Break:"}--------------------------------------------`); + if (detail.totalDetectedLines === 0) { + Terminal.warn(`${detail.apiBreakInfo.info}`); + Terminal.print("--------------------------------------------\n"); + + } else { Terminal.warn(`${detail.apiBreakInfo.info}`); - Terminal.error(`We found ${pluralize(detail.totalDetectedLines, "affected line")}.`); + Terminal.error(`We found ${pluralize(detail.totalDetectedLines, "affected line")}.`, + ); + Terminal.print("--------------------------------------------\n"); } } } +