Publish reference layouts as API-authored text and image notes
wiki CI and deployment / verify-and-deploy (push) Successful in 16m28s

This commit is contained in:
2026-10-26 17:20:57 +08:00
parent dd09ae3485
commit 38ec492ca3
669 changed files with 819 additions and 11326 deletions
+3 -1
View File
@@ -14,7 +14,7 @@ export async function getPost(slug: string): Promise<Post | null> {
return serialize(result.rows,await tags())[0] || null;
}
export async function getPostById(id:string,client?:PoolClient):Promise<Post|null>{
const result=await (client||db()).query(`${expand} WHERE p.id=$1`,[id]);
const result=await (client||db()).query(`${expand} WHERE ${/^[0-9a-f]{24}$/.test(id)?'p.public_id':'p.id'}=$1`,[id]);
return serialize(result.rows,await tags(client))[0]||null;
}
export async function feed(options: {kind?: PostKind; path?: string; cursor?: string; q?: string} = {}): Promise<FeedData> {
@@ -31,3 +31,5 @@ export async function feed(options: {kind?: PostKind; path?: string; cursor?: st
const contributions=(await db().query(`SELECT to_char(occurred_at AT TIME ZONE 'Asia/Shanghai','YYYY-MM-DD') AS day,sum(amount)::integer AS total FROM contribution_events WHERE occurred_at>=now()-interval '366 days' GROUP BY day ORDER BY day`)).rows;
return {posts,tags:allTags,contributions,nextCursor:hasMore&&last?encodeCursor(last.created_at,last.id):null};
}
export async function publishedPublicIds():Promise<string[]>{return (await db().query("SELECT public_id FROM posts WHERE public_id IS NOT NULL")).rows.map(p=>p.public_id);}