passwords.json support
This commit is contained in:
parent
6bdfb00b69
commit
4b652590b3
4 changed files with 22 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ node_modules
|
||||||
_youtube/*
|
_youtube/*
|
||||||
!_youtube/.empty
|
!_youtube/.empty
|
||||||
cyp.service
|
cyp.service
|
||||||
|
passwords.json
|
||||||
|
|
12
README.md
12
README.md
|
@ -57,6 +57,18 @@ docker run --network=host -v "$(pwd)"/_youtube:/cyp/_youtube cyp
|
||||||
docker run --network=host -e PORT=12345 cyp
|
docker run --network=host -e PORT=12345 cyp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Password-protected MPD
|
||||||
|
|
||||||
|
Create a `passwords.json` file in CYPs home directory. Specify passwords for available MPD servers:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"localhost:6600": "my-pass-1",
|
||||||
|
"some.other.server.or.ip:12345": "my-pass-2
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure that hostnames and ports match those specified via the `server` querystring argument (defaults to `localhost:6600`).
|
||||||
|
|
||||||
## Technology
|
## Technology
|
||||||
- Connected to MPD via WebSockets (using the [ws2mpd](https://github.com/ondras/ws2mpd/) bridge)
|
- Connected to MPD via WebSockets (using the [ws2mpd](https://github.com/ondras/ws2mpd/) bridge)
|
||||||
|
|
9
index.js
9
index.js
|
@ -124,5 +124,12 @@ function requestValidator(request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let httpServer = require("http").createServer(onRequest).listen(port);
|
let httpServer = require("http").createServer(onRequest).listen(port);
|
||||||
require("ws2mpd").ws2mpd(httpServer, requestValidator);
|
let passwords = {};
|
||||||
|
try {
|
||||||
|
passwords = require("./passwords.json");
|
||||||
|
console.log("loaded passwords.json file");
|
||||||
|
} catch (e) {
|
||||||
|
console.log("no passwords.json found");
|
||||||
|
}
|
||||||
|
require("ws2mpd").ws2mpd(httpServer, requestValidator, passwords);
|
||||||
require("ws2mpd").logging(false);
|
require("ws2mpd").logging(false);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"custom-range": "^1.1.0",
|
"custom-range": "^1.1.0",
|
||||||
"node-static": "^0.7.11",
|
"node-static": "^0.7.11",
|
||||||
"ws2mpd": "^2.2.1"
|
"ws2mpd": "^2.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"less": "^3.9.0",
|
"less": "^3.9.0",
|
||||||
|
|
Loading…
Reference in a new issue