mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(federation): ✨ Add ActivityPub bridge support with CLI command
This commit is contained in:
parent
153aa061f0
commit
ff315af230
13 changed files with 2337 additions and 15 deletions
|
|
@ -471,13 +471,19 @@ export const configValidator = z.object({
|
|||
software: z.enum(["lysand-ap"]).or(z.string()),
|
||||
allowed_ips: z.array(z.string().trim()).default([]),
|
||||
token: z.string().default(""),
|
||||
url: zUrl.optional(),
|
||||
})
|
||||
.default({
|
||||
enabled: false,
|
||||
software: "lysand-ap",
|
||||
allowed_ips: [],
|
||||
token: "",
|
||||
}),
|
||||
url: "",
|
||||
})
|
||||
.refine(
|
||||
(arg) => (arg.enabled ? arg.url : true),
|
||||
"When bridge is enabled, url must be set",
|
||||
),
|
||||
})
|
||||
.default({
|
||||
blocked: [],
|
||||
|
|
@ -498,6 +504,7 @@ export const configValidator = z.object({
|
|||
software: "lysand-ap",
|
||||
allowed_ips: [],
|
||||
token: "",
|
||||
url: "",
|
||||
},
|
||||
}),
|
||||
instance: z
|
||||
|
|
|
|||
|
|
@ -305,8 +305,14 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
}
|
||||
|
||||
if (instance.data.protocol === "activitypub") {
|
||||
// Placeholder for ActivityPub user fetching
|
||||
throw new Error("ActivityPub user fetching not implemented");
|
||||
const bridgeUri = new URL(
|
||||
`/apbridge/lysand/query?${new URLSearchParams({
|
||||
user_url: uri,
|
||||
})}`,
|
||||
config.federation.bridge.url,
|
||||
);
|
||||
|
||||
return await User.saveFromLysand(bridgeUri.toString(), instance);
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported protocol: ${instance.data.protocol}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue