mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
New API route format to make code cleaner
This commit is contained in:
parent
c7b2f5b741
commit
ca7d325cb1
36 changed files with 600 additions and 237 deletions
|
|
@ -193,7 +193,7 @@ export class RawActivity extends BaseEntity {
|
|||
* Returns the ActivityPub representation of the activity.
|
||||
* @returns The ActivityPub representation of the activity.
|
||||
*/
|
||||
makeActivityPubRepresentation() {
|
||||
getActivityPubRepresentation() {
|
||||
return {
|
||||
...this.data,
|
||||
object: this.objects[0].data,
|
||||
|
|
|
|||
|
|
@ -156,6 +156,13 @@ export class User extends BaseEntity {
|
|||
@JoinTable()
|
||||
pinned_notes!: RawObject[];
|
||||
|
||||
static async getFromRequest(req: Request) {
|
||||
// Check auth token
|
||||
const token = req.headers.get("Authorization")?.split(" ")[1] || "";
|
||||
|
||||
return { user: await User.retrieveFromToken(token), token };
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this user data from its actor
|
||||
* @returns The updated user.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue