diff options
| author | S1m <git@sgougeon.fr> | 2021-09-20 08:58:20 +0200 |
|---|---|---|
| committer | S1m <git@sgougeon.fr> | 2021-09-20 08:58:20 +0200 |
| commit | e0d895f22a2ceb27027f5ed01b270ac9e5dc5a04 (patch) | |
| tree | f4cfcddb4893b66c701220b85d5b84abdd65e40a | |
| parent | 5d3c7d1e2f6d631646ece755d443f59a76dc8f4f (diff) | |
Check packfile protocole scheme + rm semicolons
| -rw-r--r-- | web/src/index.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/web/src/index.js b/web/src/index.js index 0577b1f..4d1aa76 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -22,12 +22,10 @@ import * as frequent from "./frequently-used.js" // then ${PACK_BASE_URL}/${packFile} for each packFile in the packs object of the index.json file. const PACKS_BASE_URL = "packs" -let INDEX = `${PACKS_BASE_URL}/index.json`; -let params = new URLSearchParams(document.location.search); -let REMOTE = false; +let INDEX = `${PACKS_BASE_URL}/index.json` +const params = new URLSearchParams(document.location.search) if (params.has('config')) { - INDEX = params.get("config"); - REMOTE = true; + INDEX = params.get("config") } // This is updated from packs/index.json let HOMESERVER_URL = "https://matrix-client.matrix.org" @@ -137,8 +135,8 @@ class App extends Component { HOMESERVER_URL = indexData.homeserver_url || HOMESERVER_URL // TODO only load pack metadata when scrolled into view? for (const packFile of indexData.packs) { - let packRes; - if (REMOTE) { + let packRes + if (packFile.startsWith("https://") || packFile.startsWith("http://")) { packRes = await fetch(packFile, { cache }) } else { packRes = await fetch(`${PACKS_BASE_URL}/${packFile}`, { cache }) |
