Skip to content

Commit

Permalink
For Wayback Machine, use absolute URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
1j01 committed Jan 2, 2020
1 parent 1ea8301 commit 60ba0df
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/filesystem-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ var __fs_waiting_callbacks = [];

const desktop_folder_path = "/desktop/";

// For Wayback Machine, match URLs like https://web.archive.org/web/20191213113214/https://98.js.org/
// (also match URLs like https://98.js.org/ because why not)
const web_server_root =
location.href.match(/98.js.org/) ?
location.href.match(/.*98.js.org/)[0] + "/" :
"/";

BrowserFS.configure({
fs: "OverlayFS",
options: {
Expand All @@ -18,8 +25,8 @@ BrowserFS.configure({
readable: {
fs: "XmlHttpRequest",
options: {
index: "/filesystem-index.json",
baseUrl: "/"
index: web_server_root + "filesystem-index.json",
baseUrl: web_server_root
}
}
}
Expand Down

0 comments on commit 60ba0df

Please sign in to comment.