mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(federation): 🐛 Correctly validate outbound Collections
This commit is contained in:
parent
42e198ca0e
commit
334c429bfa
|
|
@ -110,7 +110,7 @@
|
|||
"@oclif/core": "^4.0.19",
|
||||
"@sentry/bun": "^8.26.0",
|
||||
"@tufjs/canonical-json": "^2.0.0",
|
||||
"@versia/federation": "^0.1.0-rc.0",
|
||||
"@versia/federation": "^0.1.0-rc.1",
|
||||
"altcha-lib": "^0.5.1",
|
||||
"blurhash": "^2.0.5",
|
||||
"bullmq": "^5.12.10",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import type { Entity } from "@versia/federation/types";
|
||||
import type { Collection } from "@versia/federation/types";
|
||||
import { and, count, eq, inArray } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
import { db } from "~/drizzle/db";
|
||||
|
|
@ -108,14 +108,9 @@ export default apiRoute((app) =>
|
|||
).toString()
|
||||
: null,
|
||||
items: notes.map((note) => note.toVersia()),
|
||||
};
|
||||
} satisfies Collection;
|
||||
|
||||
const { headers } = await author.sign(
|
||||
// @ts-expect-error To fix when I add collections to versia-api
|
||||
json as Entity,
|
||||
context.req.url,
|
||||
"GET",
|
||||
);
|
||||
const { headers } = await author.sign(json, context.req.url, "GET");
|
||||
|
||||
return context.json(json, 200, headers.toJSON());
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { Hono } from "@hono/hono";
|
||||
import type { RouterRoute } from "@hono/hono/types";
|
||||
import type {
|
||||
Collection,
|
||||
Delete,
|
||||
Follow,
|
||||
FollowAccept,
|
||||
|
|
@ -61,4 +62,5 @@ export type KnownEntity =
|
|||
| FollowReject
|
||||
| Unfollow
|
||||
| Delete
|
||||
| LikeExtension;
|
||||
| LikeExtension
|
||||
| Collection;
|
||||
|
|
|
|||
Loading…
Reference in a new issue