Skip to content

Commit

Permalink
Simplified local override to use local server if not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncabot committed Mar 18, 2024
1 parent 5d5ba8b commit 6352197
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion web/src/jabl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ export const wasmInterop: WasmFunctions = {
},
loadSection: async (identifier: string, callback: (code: string | undefined, error: string | undefined) => void) => {
const sourceId = localStorage.getItem("system:source") ?? "";
const sourceURL = availableSources[sourceId];
let sourceURL = availableSources[sourceId];
if (!sourceURL) {
throw new Error("Invalid source id");
}
if (!sourceURL.startsWith("https") && localStorage.getItem("debug") === "true") {
sourceURL = "http://localhost:3000" + sourceURL;
}
// create custom headers to add to the fetch request
const authFn = authFunctions[sourceId];
try {
Expand Down
4 changes: 1 addition & 3 deletions web/src/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ interface Source {

export const defaultEntrypoint = "entrpoint.jabl";

const localServer = "";

export const sources: Source[] = [
{
id: "1",
Expand All @@ -23,7 +21,7 @@ export const sources: Source[] = [
{
id: "2",
name: "1. The War-Torn Kingdom",
url: `${localServer}/story/1-war-torn-kingdom/`,
url: `/story/1-war-torn-kingdom/`,
entrypoint: "0-choose-character.jabl",
auth: () => {
return Promise.resolve(undefined);
Expand Down

0 comments on commit 6352197

Please sign in to comment.