Merge pull request #7 from ondras/mpd-address

server querystring
This commit is contained in:
Ondřej Žára 2019-10-01 15:37:41 +02:00 committed by GitHub
commit b193d2d1e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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};