flotilla/src/app/content.ts

54 lines
1.2 KiB
TypeScript
Raw Normal View History

import {
CLASSIFIED,
COMMENT,
DELETE,
DIRECT_MESSAGE,
DIRECT_MESSAGE_FILE,
EVENT_TIME,
GENERIC_REPOST,
PINBOARD,
2026-08-17 15:42:14 +00:00
LONG_FORM,
POLL,
REACTION,
REPORT,
REPOST,
THREAD,
ZAP_GOAL,
2026-07-28 16:16:26 +00:00
ZAP_RECEIPT,
} from "@welshman/util"
import type {Filter} from "@welshman/util"
import {ENABLE_ZAPS} from "@app/env"
export const IMAGE_CONTENT_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"]
export const VIDEO_CONTENT_TYPES = ["video/quicktime", "video/webm", "video/mp4"]
export const makeCommentFilter = (kinds: number[], extra: Filter = {}) => ({
kinds: [COMMENT],
"#K": kinds.map(String),
...extra,
})
2026-06-22 20:36:57 +00:00
export const makeDeleteFilter = (kinds: number[], extra: Filter = {}) => ({
kinds: [DELETE],
"#k": kinds.map(String),
...extra,
})
export const REPOST_KINDS = [REPOST, GENERIC_REPOST]
export const REACTION_KINDS = [REPORT, DELETE, REACTION]
if (ENABLE_ZAPS) {
2026-07-28 16:16:26 +00:00
REACTION_KINDS.push(ZAP_RECEIPT)
}
2026-08-17 15:42:14 +00:00
export const CONTENT_KINDS = [ZAP_GOAL, EVENT_TIME, THREAD, CLASSIFIED, POLL, PINBOARD, LONG_FORM]
export const DM_KINDS = [DIRECT_MESSAGE, DIRECT_MESSAGE_FILE]
export const displayReaction = (content: string) => {
if (!content || content === "+") return "❤️"
if (content === "-") return "👎"
return content
}