From 93316741f2c96ed75bfd8579fc249f392ed7a529 Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Fri, 9 Feb 2024 17:58:34 +0100 Subject: [PATCH] Allow to hide all posts from a domain --- src/App.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4ec701c..66e6961 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,7 +16,6 @@ const config = ref(); const allPosts = ref>([]) const pinned = ref>([]) const hidden = ref>([]) -const banned = ref>([]) const updateInProgress = ref(false) var updateIntervalHandle: number; @@ -148,11 +147,11 @@ const filteredPosts = computed(() => { var posts: Array = JSON.parse(JSON.stringify(allPosts.value)) const pinnedLocal = [...pinned.value] const hiddenLocal = [...hidden.value] - const bannedLocal = [...banned.value] - // Filter hidden posts or banned authors - posts = posts.filter((p) => !hiddenLocal.includes(p.id)) - posts = posts.filter((p) => !p.author?.url || !bannedLocal.includes(p.author.url)) + // Filter hidden posts, authors or domains + posts = posts.filter((p) => !hiddenLocal.some(hide => + p.id == hide || p.author?.profile.endsWith(hide) + )) // Mark pinned posts posts.forEach(p => { p.pinned = pinnedLocal.includes(p.id) }) @@ -182,8 +181,13 @@ const hide = (id: string) => { toggle(hidden.value, id) } -const hideAuthor = (url: string) => { - toggle(banned.value, url) +const hideAuthor = (profile: string) => { + toggle(hidden.value, profile) +} + +const hideDomain = (profile: string) => { + var domain = profile.split("@").pop() + toggle(hidden.value, "@" + domain) } const toggleTheme = () => { @@ -227,9 +231,12 @@ const privacyLink = computed(() => {
  • {{ post.pinned ? "Unpin" : "Pin" }}
  • Hide Post
  • -
  • Hide +
  • Hide Author
  • +
  • Hide + Domain