MISC: Remove support for running NS1 scripts (#2083)

This commit is contained in:
catloversg
2025-04-12 03:41:48 +07:00
committed by GitHub
parent 571cc8f886
commit a9900072da
24 changed files with 86 additions and 347 deletions
+3 -3
View File
@@ -7678,7 +7678,7 @@ export interface NS {
* @remarks
* RAM cost: 0 GB
*
* This function can be used to write data to a text file (.txt, .json) or a script (.js, .jsx, .ts, .tsx, .script).
* This function can be used to write data to a text file (.txt, .json) or a script (.js, .jsx, .ts, .tsx).
*
* This function will write data to that file. If the specified file does not exist,
* then it will be created. The third argument mode defines how the data will be written to
@@ -7724,7 +7724,7 @@ export interface NS {
* @remarks
* RAM cost: 0 GB
*
* This function is used to read data from a text file (.txt, .json) or script (.js, .jsx, .ts, .tsx, .script).
* This function is used to read data from a text file (.txt, .json) or script (.js, .jsx, .ts, .tsx).
*
* This function will return the data in the specified file.
* If the file does not exist, an empty string will be returned.
@@ -8206,7 +8206,7 @@ export interface NS {
* RAM cost: 0 GB
*
* Retrieves data from a URL and downloads it to a file on the specified server.
* The data can only be downloaded to a script (.js, .jsx, .ts, .tsx, .script) or a text file (.txt, .json).
* The data can only be downloaded to a script (.js, .jsx, .ts, .tsx) or a text file (.txt, .json).
* If the file already exists, it will be overwritten by this command.
* Note that it will not be possible to download data from many websites because they
* do not allow cross-origin resource sharing (CORS).
+3 -4
View File
@@ -188,14 +188,13 @@ function Root(props: IProps): React.ReactElement {
// this is duplicate code with saving later.
if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) {
//Make sure filename + code properly follow tutorial
if (currentScript.path !== "n00dles.script" && currentScript.path !== "n00dles.js") {
if (currentScript.path !== "n00dles.js") {
dialogBoxCreate("Don't change the script name for now.");
return;
}
const cleanCode = currentScript.code.replace(/\s/g, "");
const ns1 = "while(true){hack('n00dles');}";
const ns2 = `/**@param{NS}ns*/exportasyncfunctionmain(ns){while(true){awaitns.hack("n00dles");}}`;
if (!cleanCode.includes(ns1) && !cleanCode.includes(ns2)) {
const expectedCleanCode = `/**@param{NS}ns*/exportasyncfunctionmain(ns){while(true){awaitns.hack("n00dles");}}`;
if (!cleanCode.includes(expectedCleanCode)) {
dialogBoxCreate("Please copy and paste the code from the tutorial!");
return;
}