diff --git a/README.md b/README.md index 2ba44b1..c62760b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ npm i 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 diff --git a/app/js/lib/mpd.js b/app/js/lib/mpd.js index 2feeadb..49afefe 100644 --- a/app/js/lib/mpd.js +++ b/app/js/lib/mpd.js @@ -143,7 +143,11 @@ export async function init() { return new Promise((resolve, reject) => { 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); } current = {resolve, reject};