parent
8dfcba0be4
commit
5abf9d8201
Binary file not shown.
14
package.json
14
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "fwdekker.com",
|
"name": "fwdekker.com",
|
||||||
"version": "0.40.6",
|
"version": "0.40.7",
|
||||||
"description": "The source code of [my personal website](https://fwdekker.com/).",
|
"description": "The source code of [my personal website](https://fwdekker.com/).",
|
||||||
"author": "Felix W. Dekker",
|
"author": "Felix W. Dekker",
|
||||||
"browser": "dist/bundle.js",
|
"browser": "dist/bundle.js",
|
||||||
|
@ -24,27 +24,27 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||||
"@types/chai": "^4.2.16",
|
"@types/chai": "^4.2.17",
|
||||||
"@types/js-cookie": "^2.2.6",
|
"@types/js-cookie": "^2.2.6",
|
||||||
"@types/mocha": "^8.2.2",
|
"@types/mocha": "^8.2.2",
|
||||||
"@types/semver": "^6.2.1",
|
"@types/semver": "^6.2.1",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"grunt": "^1.3.0",
|
"grunt": "^1.4.0",
|
||||||
"grunt-cli": "^1.4.2",
|
"grunt-cli": "^1.4.2",
|
||||||
"grunt-contrib-clean": "^2.0.0",
|
"grunt-contrib-clean": "^2.0.0",
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
"grunt-contrib-watch": "^1.1.0",
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
"grunt-focus": "^1.0.0",
|
"grunt-focus": "^1.0.0",
|
||||||
"grunt-text-replace": "^0.4.0",
|
"grunt-text-replace": "^0.4.0",
|
||||||
"grunt-webpack": "^4.0.2",
|
"grunt-webpack": "^4.0.3",
|
||||||
"jsdom": "^16.5.3",
|
"jsdom": "^16.5.3",
|
||||||
"jsdom-global": "^3.0.2",
|
"jsdom-global": "^3.0.2",
|
||||||
"mocha": "^8.3.2",
|
"mocha": "^8.3.2",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"ts-loader": "^8.1.0",
|
"ts-loader": "^9.1.2",
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^4.2.4",
|
||||||
"webpack": "^5.32.0",
|
"webpack": "^5.36.2",
|
||||||
"webpack-cli": "^4.6.0"
|
"webpack-cli": "^4.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -649,7 +649,9 @@ return new Command(
|
||||||
const target = josh.util.isStandalone() ? \`target="_blank"\` : "";
|
const target = josh.util.isStandalone() ? \`target="_blank"\` : "";
|
||||||
streams.out.writeLine(
|
streams.out.writeLine(
|
||||||
\`The source code of this website is ${n}
|
\`The source code of this website is ${n}
|
||||||
<a href="https://git.fwdekker.com/FWDekker/fwdekker.com" \${target}>available on git</a>.
|
<a href="https://git.fwdekker.com/FWDekker/fwdekker.com" \${target}>available on git</a>. ${n}
|
||||||
|
This website also has a <a href="https://fwdekker.com/privacy/">privacy policy</a> to assure you I won't
|
||||||
|
steal your data.
|
||||||
|
|
||||||
<b>List of commands</b>
|
<b>List of commands</b>
|
||||||
\${commandEntries.join("\\n")}
|
\${commandEntries.join("\\n")}
|
||||||
|
|
|
@ -8,52 +8,12 @@ import {HashProvider, User} from "./UserList";
|
||||||
* A file system.
|
* A file system.
|
||||||
*/
|
*/
|
||||||
export class FileSystem {
|
export class FileSystem {
|
||||||
/**
|
|
||||||
* The root of the directory structure defined by the navigation API of fwdekker.com.
|
|
||||||
*
|
|
||||||
* This value is initialized only if `Persistence.hasFileSystem` returns false when the application is loaded.
|
|
||||||
*/
|
|
||||||
static navRoot: Directory;
|
|
||||||
/**
|
/**
|
||||||
* The root directory.
|
* The root directory.
|
||||||
*/
|
*/
|
||||||
readonly root: Directory;
|
readonly root: Directory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the contents of my home directory based on the navigation API of fwdekker.com.
|
|
||||||
*
|
|
||||||
* @return an empty promise :'(
|
|
||||||
*/
|
|
||||||
static async loadNavApi(): Promise<any> {
|
|
||||||
await fetch("https://fwdekker.com/api/nav/")
|
|
||||||
.then(it => it.json())
|
|
||||||
.then(json => this.navRoot = this.unpack(json)[1] as Directory)
|
|
||||||
.catch(e => {
|
|
||||||
console.error("Failed to fetch navigation elements", e);
|
|
||||||
this.navRoot = new Directory();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unpacks the given entry from the navigation API.
|
|
||||||
*
|
|
||||||
* @param entry the entry to unpack
|
|
||||||
* @return the name and the (traversed and filled) node unpacked from the given entry
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private static unpack(entry: any): [string, Node] {
|
|
||||||
const name = entry.name?.toLowerCase()?.replace(/ /g, "-") ?? "";
|
|
||||||
|
|
||||||
if (entry.entries.length === 0)
|
|
||||||
return [`${name}.lnk`, new File(entry.link)];
|
|
||||||
|
|
||||||
const dir = new Directory();
|
|
||||||
entry.entries.forEach((child: any) => dir.add(...(this.unpack(child))));
|
|
||||||
return [name, dir];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new file system.
|
* Constructs a new file system.
|
||||||
*
|
*
|
||||||
|
@ -86,18 +46,16 @@ export class FileSystem {
|
||||||
}),
|
}),
|
||||||
"home": new Directory({
|
"home": new Directory({
|
||||||
"felix": new Directory({
|
"felix": new Directory({
|
||||||
"pgp.pub": new File("https://fwdkr.co/pgp", "lnk"),
|
"pgp-key.pub": new File("https://fwdkr.co/pgp", "lnk"),
|
||||||
"privacy.lnk": new File("https://fwdekker.com/privacy/"),
|
"privacy-policy.lnk": new File("https://fwdekker.com/privacy/"),
|
||||||
"resume.pdf": new File("https://fwdkr.co/cv", "lnk"),
|
"resume.pdf": new File("https://fwdkr.co/cv", "lnk"),
|
||||||
|
"source-code.lnk": new File("https://git.fwdekker.com/FWDekker/fwdekker.com"),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
"root": new Directory({
|
"root": new Directory({
|
||||||
"password.txt": new File("root: g9PjKu"),
|
"password.txt": new File("root: g9PjKu"),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const home = this.get(new Path("home", "felix")) as Directory;
|
|
||||||
Object.keys(FileSystem.navRoot.nodes).forEach(name => home.add(name, FileSystem.navRoot.get(name)!));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import * as semver from "semver";
|
import * as semver from "semver";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const {$, doAfterLoad, nav} = window.fwdekker;
|
const {$, doAfterLoad, nav} = window.fwdekker;
|
||||||
import {FileSystem} from "./FileSystem";
|
|
||||||
import {Persistence} from "./Persistence";
|
import {Persistence} from "./Persistence";
|
||||||
import {ExpectedGoodbyeError} from "./Shared";
|
import {ExpectedGoodbyeError} from "./Shared";
|
||||||
import {Terminal} from "./Terminal";
|
import {Terminal} from "./Terminal";
|
||||||
|
@ -63,8 +62,6 @@ doAfterLoad(() => {
|
||||||
*/
|
*/
|
||||||
doAfterLoad(async () => {
|
doAfterLoad(async () => {
|
||||||
$("#nav").appendChild(nav("/"));
|
$("#nav").appendChild(nav("/"));
|
||||||
if (!Persistence.hasFileSystem())
|
|
||||||
await FileSystem.loadNavApi();
|
|
||||||
|
|
||||||
window.terminal = new Terminal(
|
window.terminal = new Terminal(
|
||||||
$("#terminal"),
|
$("#terminal"),
|
||||||
|
|
Loading…
Reference in New Issue