A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
cleanup
Christian Feiddbe0bf3b734
diff --git a/lib/server.js b/lib/server.jsindex 967ace0..5fdd283 100644--- a/lib/server.js+++ b/lib/server.js@@ -17,7 +17,7 @@ export function createServer ({repo, port = 3000, connections = []}) {}, 1000 * 60 * 5)return http.createServer(async (req, res) => {- const parsedUrl = new URL(req.url, `http://${req.headers.host}`)+ const url = new URL(req.url, `http://${req.headers.host}`)if (req.headers.accept && req.headers.accept.indexOf('text/event-stream') >= 0) {handleSSE(res, connections)@@ -25,19 +25,19 @@ export function createServer ({repo, port = 3000, connections = []}) {return}- if (parsedUrl.pathname === '/channels' && req.method === 'POST')+ if (url.pathname === '/channels' && req.method === 'POST')return addChannelHandler(req, res)- if (parsedUrl.pathname === '/download-video' && req.method === 'POST')+ if (url.pathname === '/download-video' && req.method === 'POST')return downloadVideoHandler(req, res, connections)- if (parsedUrl.pathname === '/summarize-video' && req.method === 'POST')+ if (url.pathname === '/summarize-video' && req.method === 'POST')return summarizeVideoHandler(req, res, connections)- if (parsedUrl.pathname.match('\/videos\/.*') && req.method === 'GET')+ if (url.pathname.match('\/videos\/.*') && req.method === 'GET')return watchVideoHandler(req, res)- if (parsedUrl.pathname === '/main.css')+ if (url.pathname === '/main.css')return fileHandler('client/main.css', 'text/css')(req, res)- if (parsedUrl.pathname === '/normalize.css')+ if (url.pathname === '/normalize.css')return fileHandler('client/normalize.css', 'text/css')(req, res)- if (parsedUrl.pathname === '/main.js')+ if (url.pathname === '/main.js')return fileHandler('client/main.js', 'application/javascript')(req, res)return fileHandler('client/index.html', 'text/html')(req, res)})