A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
move to client/
Christian Fei5a618e5f3efd
diff --git a/index.html b/client/index.htmlsimilarity index 100%rename from index.htmlrename to client/index.htmldiff --git a/main.css b/client/main.csssimilarity index 100%rename from main.cssrename to client/main.cssdiff --git a/main.js b/client/main.jssimilarity index 100%rename from main.jsrename to client/main.jsdiff --git a/lib/server.js b/lib/server.jsindex 724b260..eb72ed5 100644--- a/lib/server.js+++ b/lib/server.js@@ -34,16 +34,17 @@ export function createServer ({repo, port = 3000, connections = []}) {if (parsedUrl.pathname.match('\/videos\/.*') && req.method === 'GET')return watchVideoHandler(req, res)if (parsedUrl.pathname === '/main.css')- return fileHandler('main.css', 'text/css')+ return fileHandler('client/main.css', 'text/css')(req, res)if (parsedUrl.pathname === '/main.js')- return fileHandler('main.js', 'application/javascript')- return fileHandler('index.html', 'text/html')+ return fileHandler('client/main.js', 'application/javascript')(req, res)+ return fileHandler('client/index.html', 'text/html')(req, res)})function fileHandler (filePath, contentType) {- res.writeHead(200, { 'Content-Type': contentType })- res.end(fs.readFileSync(filePath, 'utf8'))- return+ return (req, res) => {+ res.writeHead(200, { 'Content-Type': contentType })+ res.end(fs.readFileSync(filePath, 'utf8'))+ }}function addChannelHandler(req, res) {diff --git a/lib/youtube.js b/lib/youtube.jsindex 01e364b..9f51e60 100644--- a/lib/youtube.js+++ b/lib/youtube.js@@ -1,4 +1,5 @@import { execa } from 'execa'+import fs from 'fs'export async function downloadVideo(id, repo, callback = () => {}) {try {