[READ ONLY MIRROR] Spark Social AppView Server
github.com/sprksocial/server
atproto
deno
hono
lexicon
1import { formatLabelerHeader, ParsedLabelers } from "../util.ts";
2
3export const SPRK_USER_AGENT = "SprkAppView";
4export const ATPROTO_CONTENT_LABELERS = "Atproto-Content-Labelers";
5export const ATPROTO_REPO_REV = "Atproto-Repo-Rev";
6
7type ResHeaderOpts = {
8 labelers: ParsedLabelers;
9 repoRev: string | null;
10};
11
12export const resHeaders = (
13 opts: Partial<ResHeaderOpts>,
14): Record<string, string> => {
15 const headers: Record<string, string> = {};
16 if (opts.labelers) {
17 headers[ATPROTO_CONTENT_LABELERS] = formatLabelerHeader(opts.labelers);
18 }
19 if (opts.repoRev) {
20 headers[ATPROTO_REPO_REV] = opts.repoRev;
21 }
22 return headers;
23};
24
25export const clearlyBadCursor = (cursor?: string) => {
26 return !!cursor?.includes("::");
27};