mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(federation): ♻️ Rewrite federation SDK
This commit is contained in:
parent
ad1dc13a51
commit
d638610361
72 changed files with 2137 additions and 738 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import type { ContentFormat } from "@versia/federation/types";
|
||||
import type { ContentFormatSchema } from "@versia/sdk/schemas";
|
||||
import { htmlToText as htmlToTextLib } from "html-to-text";
|
||||
import { lookup } from "mime-types";
|
||||
import type { z } from "zod";
|
||||
import { config } from "~/config.ts";
|
||||
|
||||
export const getBestContentType = (
|
||||
content?: ContentFormat | null,
|
||||
content?: z.infer<typeof ContentFormatSchema> | null,
|
||||
): {
|
||||
content: string;
|
||||
format: string;
|
||||
|
|
@ -32,7 +33,7 @@ export const getBestContentType = (
|
|||
export const urlToContentFormat = (
|
||||
url: URL,
|
||||
contentType?: string,
|
||||
): ContentFormat | null => {
|
||||
): z.infer<typeof ContentFormatSchema> | null => {
|
||||
if (url.href.startsWith("https://api.dicebear.com/")) {
|
||||
return {
|
||||
"image/svg+xml": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue