A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
chore: cleanup
Christian Fei2c6bf231ab01
diff --git a/lib/server.js b/lib/server.jsindex 86c2989..ff86c6e 100644--- a/lib/server.js+++ b/lib/server.js@@ -160,6 +160,27 @@ export function createServer ({repo, connections = []}) {res.end('Download started')}++ async function ignoreVideoHandler(req, res, repo, connections = []) {+ const body = await getBody(req)+ let { id } = JSON.parse(body)+ res.writeHead(200, { 'Content-Type': 'application/json' })+ return res.end(JSON.stringify(repo.toggleIgnoreVideo(id)))+ }++ async function deleteVideoHandler(req, res, repo, connections = []) {+ const body = await getBody(req)+ let { id } = JSON.parse(body)+ try {+ repo.deleteVideo(id)+ res.writeHead(200)+ res.end()+ } catch (err) {+ res.writeHead(500)+ res.end()+ }+ }+function watchVideoHandler(req, res) {const videoPath = './data' + req.url + '.mp4'if (!fs.existsSync(videoPath)) {@@ -281,23 +302,4 @@ export function createServer ({repo, connections = []}) {}}- async function ignoreVideoHandler(req, res, repo, connections = []) {- const body = await getBody(req)- let { id } = JSON.parse(body)- res.writeHead(200, { 'Content-Type': 'application/json' })- return res.end(JSON.stringify(repo.toggleIgnoreVideo(id)))- }-- async function deleteVideoHandler(req, res, repo, connections = []) {- const body = await getBody(req)- let { id } = JSON.parse(body)- try {- repo.deleteVideo(id)- res.writeHead(200)- res.end()- } catch (err) {- res.writeHead(500)- res.end()- }- }}