From 8dd45fe02ef44fae11bee385d6d226c471b99d26 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 3 Dec 2024 15:21:23 +0200 Subject: Load radio api address from settings --- src/js/arching-kaos-web-ui-settings.js | 9 +++++++++ src/js/radio-emulator.js | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src/js') diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js index ddee8f8..1277eea 100644 --- a/src/js/arching-kaos-web-ui-settings.js +++ b/src/js/arching-kaos-web-ui-settings.js @@ -80,6 +80,14 @@ var default_settings = { ], active: 1 }, + radio: { + list: [ + 'http://127.0.0.1:8010', + 'http://api.radio.z.kaotisk-hund.com', + 'https://api.radio.arching-kaos.com' + ], + active: 2 + }, scan: false } }; @@ -111,6 +119,7 @@ if (( location.origin === "http://z.kaotisk-hund.com") || ( location.origin === "http://[fc59:6076:6299:6776:c13d:fbb2:1226:ead0]")) { settings.ipfs.gateway.active = 1; settings.stellar.horizon.active = 1; + settings.ak.radio.active = 1; } else if ( location.origin === "http://localhost:3000" ) { settings.ipfs.gateway.active = 2; } else { diff --git a/src/js/radio-emulator.js b/src/js/radio-emulator.js index 0926d2a..9c9d27e 100644 --- a/src/js/radio-emulator.js +++ b/src/js/radio-emulator.js @@ -30,14 +30,16 @@ // - show_info // import { makeElement } from "./arching-kaos-generator.js"; +import { getSettings } from "./arching-kaos-web-ui-settings.js"; import { generateImage } from "./image-generator.js"; var debugMode = false; -const apiURL = "http://z.kaotisk-hund.com:8010/"; +const settings = getSettings(); +const apiURL = settings.ak.radio.list[settings.ak.radio.active]; const version = "v0"; -const listRequest = `${apiURL}${version}/list` -const jsonRequest = `${apiURL}${version}/application/json/` -const audioRequest = `${apiURL}${version}/audio/ogg/` +const listRequest = `${apiURL}/${version}/list` +const jsonRequest = `${apiURL}/${version}/application/json/` +const audioRequest = `${apiURL}/${version}/audio/ogg/` const documentTitle = "Radio Station Emulator"; const separator = " :: "; -- cgit v1.2.3