mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(federation): ♻️ Replace WebFinger code with @lysand-org/federation logic, add new debug command
This commit is contained in:
parent
38c8ea24a9
commit
cea9452127
15 changed files with 256 additions and 99 deletions
|
|
@ -326,7 +326,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
|||
|
||||
const parsedMentions = [
|
||||
...(data.mentions ?? []),
|
||||
...(await parseTextMentions(plaintextContent)),
|
||||
...(await parseTextMentions(plaintextContent, data.author)),
|
||||
// Deduplicate by .id
|
||||
].filter(
|
||||
(mention, index, self) =>
|
||||
|
|
@ -396,7 +396,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
|||
* @returns The updated note
|
||||
*/
|
||||
async updateFromData(data: {
|
||||
author?: User;
|
||||
author: User;
|
||||
content?: ContentFormat;
|
||||
visibility?: ApiStatus["visibility"];
|
||||
isSensitive?: boolean;
|
||||
|
|
@ -418,7 +418,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
|||
const parsedMentions = [
|
||||
...(data.mentions ?? []),
|
||||
...(plaintextContent
|
||||
? await parseTextMentions(plaintextContent)
|
||||
? await parseTextMentions(plaintextContent, data.author)
|
||||
: []),
|
||||
// Deduplicate by .id
|
||||
].filter(
|
||||
|
|
|
|||
|
|
@ -123,6 +123,56 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
);
|
||||
}
|
||||
|
||||
static getServerActor(): User {
|
||||
return new User({
|
||||
id: "00000000-0000-0000-0000-000000000000",
|
||||
username: "actor",
|
||||
avatar: "",
|
||||
createdAt: "2024-01-01T00:00:00.000Z",
|
||||
displayName: "Server Actor",
|
||||
note: "This is a system actor used for server-to-server communication. It is not a real user.",
|
||||
updatedAt: "2024-01-01T00:00:00.000Z",
|
||||
instanceId: null,
|
||||
publicKey: config.instance.keys.public,
|
||||
source: {
|
||||
fields: [],
|
||||
language: null,
|
||||
note: "",
|
||||
privacy: "public",
|
||||
sensitive: false,
|
||||
},
|
||||
fields: [],
|
||||
isAdmin: false,
|
||||
isBot: false,
|
||||
isLocked: false,
|
||||
isDiscoverable: false,
|
||||
endpoints: {
|
||||
dislikes: "",
|
||||
featured: "",
|
||||
likes: "",
|
||||
followers: "",
|
||||
following: "",
|
||||
inbox: "",
|
||||
outbox: "",
|
||||
},
|
||||
disableAutomoderation: false,
|
||||
email: "",
|
||||
emailVerificationToken: "",
|
||||
emojis: [],
|
||||
followerCount: 0,
|
||||
followingCount: 0,
|
||||
header: "",
|
||||
instance: null,
|
||||
password: "",
|
||||
passwordResetToken: "",
|
||||
privateKey: config.instance.keys.private,
|
||||
roles: [],
|
||||
sanctions: [],
|
||||
statusCount: 0,
|
||||
uri: "",
|
||||
});
|
||||
}
|
||||
|
||||
static getUri(id: string, uri: string | null, baseUrl: string) {
|
||||
return uri || new URL(`/users/${id}`, baseUrl).toString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue