A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
fix: new videos are filtered by excluded terms
Christian Feibef680cc9299
diff --git a/lib/repository.js b/lib/repository.jsindex e2d3f81..4bf5ec7 100644--- a/lib/repository.js+++ b/lib/repository.js@@ -70,7 +70,7 @@ export default class Repository {getAllVideos() {return this.videos}- filterByExcludedTerms (video, excludedTerms = this.getExcludedTerms()) {+ filterByExcludedTerms (v, excludedTerms = this.getExcludedTerms()) {return !excludedTerms.some(term => v.title?.toLowerCase().includes(term) || v.description?.toLowerCase().includes(term))}getVideos (query = {}) {diff --git a/lib/server.js b/lib/server.jsindex ab5675b..bb02ad1 100644--- a/lib/server.js+++ b/lib/server.js@@ -12,7 +12,9 @@ export function createServer ({repo, state = {}, connections = []} = {}) {function runUpdateVideos(repo, connections) {console.log('update videos')updateAndPersistVideos(repo, ({name, videos}) => {- const newVideos = videos.filter(v => v.addedAt > lastAdded)+ const newVideos = videos+ .filter(v => v.addedAt > lastAdded)+ .filter(v => repo.filterByExcludedTerms(v))lastAdded = Date.now()if (newVideos.length > 0) {console.log('new videos for channel', name, newVideos.length)