Web: auto-detect whether the port number should be overridden

It's a bit clumsy (if the web port is :8081, override it to :8080 for the
API requests), but works in our case.
This commit is contained in:
Sybren A. Stüvel 2022-06-28 17:15:27 +02:00
parent 159e003745
commit cc56e5b22e

View File

@ -2,7 +2,9 @@
let url = new URL(window.location.href); let url = new URL(window.location.href);
// Uncomment this when the web interface is running on a different port than the // Uncomment this when the web interface is running on a different port than the
// API, for example when using the Vite devserver. Set the API port here. // API, for example when using the Vite devserver. Set the API port here.
// url.port = "8080"; if (url.port == "8081") {
url.port = "8080";
}
url.pathname = "/"; url.pathname = "/";
const flamencoAPIURL = url.href; const flamencoAPIURL = url.href;