Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

cleanup

Christian Fei29e3855cdb0c
diff --git a/lib/server.js b/lib/server.js
index 12d76bd..a873154 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -21,10 +21,10 @@ export function createServer ({repo, connections = []}) {
if (req.headers.accept && req.headers.accept.indexOf('text/event-stream') >= 0) {
handleSSE(res, connections)
- broadcastSSE(JSON.stringify({type: 'all', videos: repo.getVideos()}), [res])
- return
+ return broadcastSSE(JSON.stringify({type: 'all', videos: repo.getVideos()}), [res])
}
+ /* api */
if (url.pathname === '/channels' && req.method === 'POST')
return addChannelHandler(req, res, repo)
if (url.pathname === '/download-video' && req.method === 'POST')
@@ -35,6 +35,8 @@ export function createServer ({repo, connections = []}) {
return ignoreVideoHandler(req, res, connections)
if (url.pathname.match('\/videos\/.*') && req.method === 'GET')
return watchVideoHandler(req, res)
+
+ /* client */
if (url.pathname === '/main.css')
return fileHandler('client/main.css', 'text/css')(req, res)
if (url.pathname === '/normalize.css')