cyp
1.0.0
CYP是音乐播放器守护程序MPD的基于网络的前端。您可以使用它来控制播放,而无需安装本机应用程序。它在台式机和移动设备的现代网络浏览器中工作。


确保首先使用工作的MPD设置,并且节点版本> = 10
git clone https://github.com/ondras/cyp.git && cd cyp
npm i
node .将浏览器指向http:// localhost:8080以打开接口。指定自定义MPD地址:
MPD_HOST和MPD_PORT环境变量,或server Querystring参数( ?server=localhost:6655 )。 另外,您可以使用Docker运行CYP。
git clone https://github.com/ondras/cyp.git && cd cyp
docker build -t cyp .
docker run --network=host cyp如果您想运行CYP作为服务并通过Apache2代理它,则需要启用几个模块。
# a2enmod proxy
# a2enmod proxy_http
# a2enmod proxy_wstunnel
# a2enmod proxypass
要在名为“音乐”(https://example.com/music/)的VIDAL文件夹中介绍CYP,将以下内容添加到您的网站配置中。
# MPD daemon
RewriteEngine on # Enable the RewriteEngine
RewriteCond %{REQUEST_FILENAME} !-f # If the requested file isn't a file
RewriteCond %{REQUEST_FILENAME} !-d # And if it isn't a directory
RewriteCond %{REQUEST_URI} .*/music$ # And if they only requested /music instead of /music/
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [QSA,L,R=301] # Then append a trailing slash
ProxyPass /music/ http://localhost:3366/ # Proxy all request to /music/ to the CYP server (running on the same server as apache)
ProxyWebsocketFallbackToProxyHttp Off # Don't fallback to http for WebSocket requests
# Rewrite WebSocket requests to CYP WebSocket requets, (also converts wss to ws)
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/music/?(.*) "ws://localhost:3366/$1" [P,L]
location /music/ {
proxy_pass_header Set-Cookie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_pass http://localhost:8080/;
}
您将需要一个工作的YouTube-DL安装。音频文件将下载到_youtube目录中,因此请确保它可用于MPD库(使用SymLink)。
如果使用Docker,则需要将_youtube目录挂载到图像中:
docker run --network=host -v " $( pwd ) " /_youtube:/cyp/_youtube cyp...通过PORT环境变量完成。如果使用Docker, -e开关可以做到这一点:
docker run --network=host -e PORT=12345 cyp在CYPS主目录中创建passwords.json文件。为可用MPD服务器指定密码:
{
"localhost:6600" : " my-pass-1 " ,
"some.other.server.or.ip:12345" : " my-pass-2 "
}确保主机名和端口匹配通过server Querystring参数指定的(默认为localhost:6600 )。
Origin检查更好)