feat(federation): Replace old types and federation validators with @lysand-org/federation

This commit is contained in:
Jesse Wierzbinski 2024-05-14 14:35:13 -10:00
parent 25d087a54b
commit 5fd6a4e43d
No known key found for this signature in database
16 changed files with 80 additions and 65 deletions

View file

@ -1,7 +1,9 @@
import type * as Lysand from "lysand-types";
import type { EntityValidator } from "@lysand-org/federation";
import { lookup } from "mime-types";
export const getBestContentType = (content?: Lysand.ContentFormat) => {
export const getBestContentType = (
content?: typeof EntityValidator.$ContentFormat,
) => {
if (!content) return { content: "", format: "text/plain" };
const bestFormatsRanked = [
@ -21,7 +23,7 @@ export const getBestContentType = (content?: Lysand.ContentFormat) => {
export const urlToContentFormat = (
url: string,
): Lysand.ContentFormat | null => {
): typeof EntityValidator.$ContentFormat | null => {
if (!url) return null;
if (url.startsWith("https://api.dicebear.com/")) {
return {