A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
wip video updates
Christian Fei0f80e5dd62c9
diff --git a/client/components/video-element.js b/client/components/video-element.jsindex 8daae00..67cd79f 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -28,6 +28,7 @@ class VideoElement extends HTMLElement {if (store.includes(store.ignoreVideoKey, this.video.id)) return this.remove()this.classList.add('video')this.dataset['videoId'] = this.video.id+ this.dataset['date'] = this.video.publishedAtthis.innerHTML = /*html*/`${this.video.downloaded? /*html*/`<video controls width="280">diff --git a/client/main.js b/client/main.jsindex abf285a..2a26654 100644--- a/client/main.js+++ b/client/main.js@@ -45,7 +45,15 @@ eventSource.onmessage = (message) => {document.querySelector('channels-list').dataset['list'] = channelsList}if (data.type === 'channel' && data.name && data.videos) {- console.error('UNHANDLED', data)+ // data.videos.forEach(video => {+ // for (const $videoElement of $videosContainer.querySelectorAll('video-element')) {+ // const videoDate = new Date($videoElement.dataset['date'])+ // if (new Date(video.publishedAt) < videoDate) {+ // // $videoElement.prepend(createVideoElement(video))+ // break+ // }+ // }+ // })}if (data.type === 'summary' && data.videoId && data.summary && data.transcript) {;[...document.querySelectorAll(`[data-video-id="${data.videoId}"]`)].forEach($video => {diff --git a/lib/server.js b/lib/server.jsindex 9062b95..205d089 100644--- a/lib/server.js+++ b/lib/server.js@@ -14,7 +14,7 @@ export function createServer ({repo, connections = []}) {updateAndPersistVideos(repo, ({name, videos}) => {broadcastSSE(JSON.stringify({type: 'channel', name, videos}), connections)})- }, 1000 * 60 * 5)+ }, 1000 * 60 * 1)return http.createServer(async (req, res) => {const url = new URL(req.url, `http://${req.headers.host}`)