Add keyword and URL filtering for posts (#711)

* feat: Add keyword and URL filtering for posts

* impr: add minimizing filters, improve UI, fix some reactivity problems
This commit is contained in:
Kehet authored and GitHub committed 2026-01-29 02:28:50 +00:00
1 parent 21a0baacf9
commit 5630ac3bf8
8 files changed
+232 -42

No files matched your search

+8
View File
@@ -903,6 +903,14 @@
"deleted": "Deleted by user",
"removed": "Removed by moderator"
},
"contentFilter": {
"title": "Content filters",
"description": "Hide or minimize posts matching given strings. Supports regular expressions.",
"hide": "Hide",
"minimize": "Minimize",
"minimized": "Content hidden by your filters",
"disabled": "Off"
},
"nsfwBlur": {
"title": "NSFW blur",
"description": "Blurs images and remove post bodies of NSFW posts."
+6
View File
@@ -47,6 +47,12 @@
}
}
export function rerender() {
requestAnimationFrame(() => {
updateVisibleItems()
})
}
onDestroy(() => {
restore = {
itemHeights: itemHeights,
+6 -2
View File
@@ -1,8 +1,11 @@
import { browser } from '$app/environment'
import { env } from '$env/dynamic/public'
import type { CommentSortType, ListingType, SortType } from '$lib/api/types'
import type { Filter } from '$lib/feature/post/filters'
import { locale } from './i18n'
// TODO extract settings into submodules
export type View = 'cozy' | 'compact'
export const SSR_ENABLED = env.PUBLIC_SSR_ENABLED?.toLowerCase() == 'true'
@@ -89,6 +92,7 @@ interface Settings {
reverseActions: boolean
titleOpensUrl: boolean
}
filters: Filter[]
forms: {
autosubmitAutofill: boolean
}
@@ -97,7 +101,6 @@ interface Settings {
useRtl: boolean
parseTags: boolean
logoColorMonth: number | null
absoluteDates: boolean
messages: {
fullMarkdown: boolean
@@ -106,7 +109,7 @@ interface Settings {
}
export const defaultSettings: Settings = {
settingsVer: 7,
settingsVer: 8,
expandableImages: toBool(env.PUBLIC_EXPANDABLE_IMAGES) ?? true,
markReadPosts: toBool(env.PUBLIC_MARK_READ_POSTS) ?? true,
showInstances: {
@@ -172,6 +175,7 @@ export const defaultSettings: Settings = {
reverseActions: toBool(env.PUBLIC_REVERSE_ACTIONS) ?? false,
titleOpensUrl: toBool(env.PUBLIC_TITLE_OPENS_URL) ?? false,
},
filters: [],
forms: {
autosubmitAutofill: false,
},