mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 02:01:12 +02:00
22 lines
480 B
TypeScript
22 lines
480 B
TypeScript
export type Post = {
|
|
text: string | undefined;
|
|
cw: string | null;
|
|
localOnly: boolean;
|
|
createdAt: Date;
|
|
visibility: string;
|
|
};
|
|
|
|
export function parse(acct: any): Post {
|
|
return {
|
|
text: acct.text || undefined,
|
|
cw: acct.cw,
|
|
localOnly: acct.localOnly,
|
|
createdAt: new Date(acct.createdAt),
|
|
visibility: `hidden${acct.visibility || ""}`,
|
|
};
|
|
}
|
|
|
|
export function toJson(acct: Post): string {
|
|
return { text: acct.text, cw: acct.cw, localOnly: acct.localOnly }.toString();
|
|
}
|