Add new API endpoint (accounts/verify_credentials)

This commit is contained in:
Jesse Wierzbinski 2023-09-21 16:15:12 -10:00
parent e25b745e25
commit ce2ed0754e
11 changed files with 234 additions and 181 deletions

View file

@ -112,7 +112,7 @@ export class RawActor extends BaseEntity {
username: this.data.preferredUsername ?? "",
display_name: this.data.name ?? this.data.preferredUsername ?? "",
note: this.data.summary ?? "",
url: `${config.http.base_url}:${config.http.port}/@${
url: `${config.http.base_url}/@${
this.data.preferredUsername
}@${this.getInstanceDomain()}`,
// @ts-expect-error It actually works

View file

@ -5,7 +5,6 @@ import { appendFile } from "fs/promises";
import { APIStatus } from "~types/entities/status";
import { RawActor } from "./RawActor";
import { APIAccount } from "~types/entities/account";
import { User } from "./User";
/**
* Stores an ActivityPub object as raw JSON-LD data
@ -28,10 +27,6 @@ export class RawObject extends BaseEntity {
.getOne();
}
async isPinned() {
}
async toAPI(): Promise<APIStatus> {
return {
account:

View file

@ -16,6 +16,7 @@ import { APActor } from "activitypub-types";
import { RawObject } from "./RawObject";
import { Token } from "./Token";
import { Status } from "./Status";
import { APISource } from "~types/entities/source";
const config = getConfig();
@ -57,6 +58,9 @@ export class User extends BaseEntity {
})
is_admin!: boolean;
@Column("jsonb")
source!: APISource;
@Column("varchar")
avatar!: string;
@ -124,6 +128,14 @@ export class User extends BaseEntity {
user.avatar = data.avatar ?? config.defaults.avatar;
user.header = data.header ?? config.defaults.avatar;
user.source = {
language: null,
note: "",
privacy: "public",
sensitive: false,
fields: [],
};
user.followers = [];
user.following = [];
@ -257,7 +269,6 @@ export class User extends BaseEntity {
emojis: [],
fields: [],
limited: false,
source: undefined,
statuses_count: 0,
discoverable: undefined,
role: undefined,