Skip to content

Commit

Permalink
allow asset url to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
stonedDiscord authored Oct 16, 2024
1 parent 04d9a42 commit c3062bf
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ import "./index.css";
const hintedCharacters = document.getElementById('hintedCharacters')
const hintedBackgrounds = document.getElementById('hintedBackgrounds')

export const BASE_URL = "https://attorneyoffline.de/base/"
/* eslint @typescript-eslint/no-explicit-any: "warn" */

interface QueryParams {
ip: string;
connect: string;
mode: string;
asset: string;
theme: string;
serverName: string;
}

const urlParams = new URLSearchParams(window.location.search);

export const BASE_URL = urlParams.get("asset") || "https://attorneyoffline.de/base/"
export const BASE_CHARACTERS_URL = BASE_URL + "characters/"
export const BASE_BACKGROUND_URL = BASE_URL + "background/"
export const BASE_SOUNDS_URL = BASE_URL + "sounds/"
Expand Down Expand Up @@ -48,8 +61,8 @@ const crawl = async (url, currentDepth, maximumDepth) => {
return validLinks
}

const getAllCharacterNames = async () => {
const response = await fetch(`${BASE_CHARACTERS_URL}`)
const getAllterNames = async () => {
const response = await fetch(`${BASE_TERS_URL}`)
if (response.status === 404) {
return
}
Expand Down Expand Up @@ -266,8 +279,6 @@ document.getElementById('backgroundNameInput').oninput = searchForBackgrounds
createCharactersForDropdown()
createBackgroundsForDropdown()

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if(urlParams.has('char')) {
const characterName = urlParams.get('char')
document.getElementById('characterNameInput').value = characterName
Expand Down

0 comments on commit c3062bf

Please sign in to comment.