server querystring

This commit is contained in:
Ondrej Zara 2019-10-01 15:36:39 +02:00
parent dc1b414c2d
commit 4855aa5f5a
2 changed files with 6 additions and 2 deletions

View file

@ -26,7 +26,7 @@ npm i
node . node .
``` ```
Point your browser to http://localhost:8080 to open the interface. Point your browser to http://localhost:8080 to open the interface. Specify a custom MPD address via a `server` querystring argument (`?server=localhost:6655`).
## Technology ## Technology

View file

@ -143,7 +143,11 @@ export async function init() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
ws = new WebSocket(`ws://${location.host}/?ticket=${encodeURIComponent(ticket)}`); let url = new URL(location.href);
url.protocol = "ws";
url.hash = "";
url.searchParams.set("ticket", ticket);
ws = new WebSocket(url.href);
} catch (e) { reject(e); } } catch (e) { reject(e); }
current = {resolve, reject}; current = {resolve, reject};