mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-01-26 09:36:02 -07:00
[mastodon-client] Code cleanup
This commit is contained in:
parent
3fd98eb88a
commit
40f89213a5
1 changed files with 2 additions and 23 deletions
|
@ -9,24 +9,6 @@ import authenticate from "@/server/api/authenticate.js";
|
||||||
import { NoteConverter } from "@/server/api/mastodon/converters/note.js";
|
import { NoteConverter } from "@/server/api/mastodon/converters/note.js";
|
||||||
import { UserHelpers } from "@/server/api/mastodon/helpers/user.js";
|
import { UserHelpers } from "@/server/api/mastodon/helpers/user.js";
|
||||||
import { PaginationHelpers } from "@/server/api/mastodon/helpers/pagination.js";
|
import { PaginationHelpers } from "@/server/api/mastodon/helpers/pagination.js";
|
||||||
import { NotificationHelpers } from "@/server/api/mastodon/helpers/notification.js";
|
|
||||||
|
|
||||||
const relationshipModel = {
|
|
||||||
id: "",
|
|
||||||
following: false,
|
|
||||||
followed_by: false,
|
|
||||||
delivery_following: false,
|
|
||||||
blocking: false,
|
|
||||||
blocked_by: false,
|
|
||||||
muting: false,
|
|
||||||
muting_notifications: false,
|
|
||||||
requested: false,
|
|
||||||
domain_blocking: false,
|
|
||||||
showing_reblogs: false,
|
|
||||||
endorsed: false,
|
|
||||||
notifying: false,
|
|
||||||
note: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export function apiAccountMastodon(router: Router): void {
|
export function apiAccountMastodon(router: Router): void {
|
||||||
router.get("/v1/accounts/verify_credentials", async (ctx) => {
|
router.get("/v1/accounts/verify_credentials", async (ctx) => {
|
||||||
|
@ -93,7 +75,6 @@ export function apiAccountMastodon(router: Router): void {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
router.get("/v1/accounts/relationships", async (ctx) => {
|
router.get("/v1/accounts/relationships", async (ctx) => {
|
||||||
let users;
|
|
||||||
try {
|
try {
|
||||||
const auth = await authenticate(ctx.headers.authorization, null);
|
const auth = await authenticate(ctx.headers.authorization, null);
|
||||||
const user = auth[0] ?? null;
|
const user = auth[0] ?? null;
|
||||||
|
@ -109,11 +90,9 @@ export function apiAccountMastodon(router: Router): void {
|
||||||
ctx.body = result.map(rel => convertRelationship(rel));
|
ctx.body = result.map(rel => convertRelationship(rel));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
let data = e.response.data;
|
console.error(e.response.data);
|
||||||
data.users = users;
|
|
||||||
console.error(data);
|
|
||||||
ctx.status = 401;
|
ctx.status = 401;
|
||||||
ctx.body = data;
|
ctx.body = e.response.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
router.get<{ Params: { id: string } }>("/v1/accounts/:id", async (ctx) => {
|
router.get<{ Params: { id: string } }>("/v1/accounts/:id", async (ctx) => {
|
||||||
|
|
Loading…
Reference in a new issue