diff --git a/LICENSE b/LICENSE index 3792f40..7b1afc9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 F.W. Dekker +Copyright (c) 2018 Florine W. Dekker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package-lock.json b/package-lock.json index 8364bf8..3055309 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 5509f5f..318926e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "fwdekker.com", - "version": "0.40.11", + "version": "0.40.12", "description": "The source code of [my personal website](https://fwdekker.com/).", - "author": "F.W. Dekker", + "author": "Florine W. Dekker", "browser": "dist/bundle.js", "repository": { "type": "git", @@ -18,17 +18,17 @@ "coverage": "nyc npm run test" }, "dependencies": { - "js-cookie": "^2.2.1", + "js-cookie": "^3.0.1", "js-sha256": "^0.9.0", "semver": "^6.3.0" }, "devDependencies": { - "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@types/chai": "^4.2.21", - "@types/js-cookie": "^2.2.7", - "@types/mocha": "^9.0.0", + "@istanbuljs/nyc-config-typescript": "^1.0.2", + "@types/chai": "^4.3.0", + "@types/js-cookie": "^3.0.1", + "@types/mocha": "^9.1.0", "@types/semver": "^6.2.1", - "chai": "^4.3.4", + "chai": "^4.3.6", "grunt": "^1.4.1", "grunt-cli": "^1.4.3", "grunt-contrib-clean": "^2.0.0", @@ -36,15 +36,15 @@ "grunt-contrib-watch": "^1.1.0", "grunt-focus": "^1.0.0", "grunt-text-replace": "^0.4.0", - "grunt-webpack": "^4.0.3", - "jsdom": "^17.0.0", + "grunt-webpack": "^5.0.0", + "jsdom": "^19.0.0", "jsdom-global": "^3.0.2", - "mocha": "^9.1.0", + "mocha": "^9.2.0", "nyc": "^15.1.0", - "ts-loader": "^9.2.5", - "ts-node": "^10.2.1", - "typescript": "^4.3.5", - "webpack": "^5.51.1", - "webpack-cli": "^4.8.0" + "ts-loader": "^9.2.6", + "ts-node": "^10.5.0", + "typescript": "^4.5.5", + "webpack": "^5.69.1", + "webpack-cli": "^4.9.2" } } diff --git a/src/main/index.html b/src/main/index.html index 83e0eca..eab4fa0 100644 --- a/src/main/index.html +++ b/src/main/index.html @@ -3,13 +3,13 @@ - + - + - + FWDekker diff --git a/src/main/js/Commands.ts b/src/main/js/Commands.ts index 0d3d597..a075bd1 100644 --- a/src/main/js/Commands.ts +++ b/src/main/js/Commands.ts @@ -57,6 +57,9 @@ export class Commands { localStreams.out = this.toStream(input.redirectTargets[1]) ?? localStreams.out; localStreams.err = this.toStream(input.redirectTargets[2]) ?? localStreams.err; } catch (error) { + if (!(error instanceof Error)) + throw Error(`Error while processing redirection error:\n${error}`); + streams.err.writeLine(`Error while redirecting output:\n${error.message}`); return ExitCode.MISC; } @@ -136,9 +139,12 @@ export class Commands { } else { return this.interpretBinary(code, this.environment, this.userList, this.fileSystem); } - } catch (e) { - console.error(`Failed to interpret script '${targetName}'.`, code, e); - return e; + } catch (error) { + if (!(error instanceof Error)) + throw Error(`Error while processing interpretation error:\n${error}`); + + console.error(`Failed to interpret script '${targetName}'.`, code, error); + return error; } } diff --git a/src/main/js/FileSystem.ts b/src/main/js/FileSystem.ts index e79d56f..e87c352 100644 --- a/src/main/js/FileSystem.ts +++ b/src/main/js/FileSystem.ts @@ -39,13 +39,13 @@ export class FileSystem { [ new User("root", HashProvider.default.hashPassword("g9PjKu"), "/root", "You're a hacker, Harry!"), - new User("f", HashProvider.default.hashPassword("password"), undefined, + new User("florine", HashProvider.default.hashPassword("password"), undefined, "Who are you?") ].map(it => User.toString(it)).join("\n") + "\n" ), }), "home": new Directory({ - "f": new Directory({ + "florine": new Directory({ "pgp-key.pub": new File("https://fwdkr.co/pgp", "lnk"), "privacy-policy.lnk": new File("https://fwdekker.com/privacy/"), "resume.pdf": new File("https://fwdkr.co/cv", "lnk"), diff --git a/src/main/js/Main.ts b/src/main/js/Main.ts index 5e65f94..019beac 100644 --- a/src/main/js/Main.ts +++ b/src/main/js/Main.ts @@ -32,7 +32,7 @@ doAfterLoad(() => { if (semver.lt(userVersion, latestVersion)) { Persistence.reset(); Persistence.setWasUpdated(true); // Message is displayed after reload - location.reload(true); + location.reload(); throw new ExpectedGoodbyeError("Goodbye"); } diff --git a/src/main/js/Persistence.ts b/src/main/js/Persistence.ts index e1abfd7..f68e73c 100644 --- a/src/main/js/Persistence.ts +++ b/src/main/js/Persistence.ts @@ -1,4 +1,4 @@ -import * as Cookies from "js-cookie"; +import Cookies from "js-cookie"; import {Environment} from "./Environment"; import {Directory, FileSystem, Node} from "./FileSystem"; import {InputHistory} from "./InputHistory"; @@ -161,10 +161,10 @@ export class Persistence { // Check user in environment if (!environment.has("user")) { - environment.set("user", "f"); + environment.set("user", "florine"); } else if (environment.get("user") !== "" && !userList.has(environment.get("user"))) { console.warn(`Invalid user '${environment.get("user")}' in environment.`); - environment.set("user", "f"); + environment.set("user", "florine"); } // Set home directory diff --git a/src/main/js/Shell.ts b/src/main/js/Shell.ts index b465d1e..188bf65 100644 --- a/src/main/js/Shell.ts +++ b/src/main/js/Shell.ts @@ -126,7 +126,7 @@ export class Shell { const inputString = streams.ins.readLine().replace("\n", ""); if (inputString === "factory-reset") { Persistence.reset(); - location.reload(true); + location.reload(); throw new ExpectedGoodbyeError("Goodbye"); } @@ -163,6 +163,9 @@ export class Shell { try { inputs = InputParser.create(this.environment, this.fileSystem).parseCommands(inputString); } catch (error) { + if (!(error instanceof Error)) + throw Error(`Error while processing parsing error:\n${error}`); + streams.err.writeLine(`Could not parse input: ${error.message}`); this.environment.set("status", "" + ExitCode.USAGE); return; diff --git a/tsconfig.json b/tsconfig.json index c32f853..80aea4f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,9 +2,9 @@ "compilerOptions": { "target": "es2019", "strict": true, -// "noUncheckedIndexedAccess": true, + "allowSyntheticDefaultImports": true, "rootDir": "./src/main/js/", - "outDir": "./dist/js/" + "outDir": "./dist/js/", }, "include": [ "src/main/js/**/*.ts"