A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
new videos
Christian Fei3abff327243a
diff --git a/client/components/video-element.js b/client/components/video-element.jsindex efc8ed0..8d91b0e 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -96,6 +96,7 @@ class VideoElement extends HTMLElement {Download the video instead <a href="/videos/${this.video.id}" target="_blank">here</a></p></video>`+ this.pauseOtherVideos()this.querySelector('video').play()}downloadVideoHandler (event) {diff --git a/lib/server.js b/lib/server.jsindex ab97932..d33c37f 100644--- a/lib/server.js+++ b/lib/server.js@@ -9,13 +9,17 @@ export function createServer ({repo, connections = []}) {let lastAdded = Date.now()updateAndPersistVideos(repo, ({name, videos}) => {const newVideos = videos.filter(v => v.addedAt > lastAdded)- broadcastSSE(JSON.stringify({type: 'new-videos', name, videos: newVideos}), connections)+ lastAdded = Date.now()+ if (newVideos.length > 0) {+ broadcastSSE(JSON.stringify({type: 'new-videos', name, videos: newVideos}), connections)+ }})setInterval(() => {console.log('update videos')updateAndPersistVideos(repo, ({name, videos}) => {const newVideos = videos.filter(v => v.addedAt > lastAdded)+ lastAdded = Date.now()if (newVideos.length > 0) {console.log('new videos for channel', name, newVideos.length)broadcastSSE(JSON.stringify({type: 'new-videos', name, videos: newVideos}), connections)