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