Co-authored-by: cutls <web-pro@cutls.com>
This commit is contained in:
cutestnekoaqua 2023-02-11 22:50:15 +01:00
parent 254a9e8716
commit c135d16024
No known key found for this signature in database
GPG Key ID: 6BF0964A5069C1E0
3 changed files with 24 additions and 5 deletions

View File

@ -79,7 +79,7 @@
"koa-send": "5.0.1", "koa-send": "5.0.1",
"koa-slow": "2.1.0", "koa-slow": "2.1.0",
"koa-views": "7.0.2", "koa-views": "7.0.2",
"@cutls/megalodon": "5.1.15", "@cutls/megalodon": "5.1.16",
"mfm-js": "0.23.2", "mfm-js": "0.23.2",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"multer": "1.4.4-lts.1", "multer": "1.4.4-lts.1",

View File

@ -4,6 +4,23 @@ import { koaBody } from "koa-body";
import { getClient } from "../ApiMastodonCompatibleService.js"; import { getClient } from "../ApiMastodonCompatibleService.js";
import { toLimitToInt } from "./timeline.js"; import { toLimitToInt } from "./timeline.js";
const relationshopModel = {
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, next) => { router.get("/v1/accounts/verify_credentials", async (ctx, next) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
@ -258,6 +275,8 @@ export function apiAccountMastodon(router: Router): void {
try { try {
const idsRaw = (ctx.query as any)["id[]"]; const idsRaw = (ctx.query as any)["id[]"];
const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw; const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw;
relationshopModel.id = idsRaw || '1'
if (!idsRaw) return [relationshopModel]
const data = (await client.getRelationships(ids)) as any; const data = (await client.getRelationships(ids)) as any;
ctx.body = data.data; ctx.body = data.data;
} catch (e: any) { } catch (e: any) {

View File

@ -57,7 +57,7 @@ importers:
'@bull-board/api': ^4.6.4 '@bull-board/api': ^4.6.4
'@bull-board/koa': ^4.6.4 '@bull-board/koa': ^4.6.4
'@bull-board/ui': ^4.6.4 '@bull-board/ui': ^4.6.4
'@cutls/megalodon': 5.1.15 '@cutls/megalodon': 5.1.16
'@discordapp/twemoji': 14.0.2 '@discordapp/twemoji': 14.0.2
'@elastic/elasticsearch': 7.17.0 '@elastic/elasticsearch': 7.17.0
'@koa/cors': 3.4.3 '@koa/cors': 3.4.3
@ -223,7 +223,7 @@ importers:
'@bull-board/api': 4.10.2 '@bull-board/api': 4.10.2
'@bull-board/koa': 4.10.2_6tybghmia4wsnt33xeid7y4rby '@bull-board/koa': 4.10.2_6tybghmia4wsnt33xeid7y4rby
'@bull-board/ui': 4.10.2 '@bull-board/ui': 4.10.2
'@cutls/megalodon': 5.1.15 '@cutls/megalodon': 5.1.16
'@discordapp/twemoji': 14.0.2 '@discordapp/twemoji': 14.0.2
'@elastic/elasticsearch': 7.17.0 '@elastic/elasticsearch': 7.17.0
'@koa/cors': 3.4.3 '@koa/cors': 3.4.3
@ -847,8 +847,8 @@ packages:
dependencies: dependencies:
'@jridgewell/trace-mapping': 0.3.9 '@jridgewell/trace-mapping': 0.3.9
/@cutls/megalodon/5.1.15: /@cutls/megalodon/5.1.16:
resolution: {integrity: sha512-4+mIKUYYr2CLY3idSxXk56WSTG9ww3opeenmsPRxftTwcjQTYxGntNkWmJWEbzeJ4rPslnvpwD7cFR62bPf41g==} resolution: {integrity: sha512-s2U3qjcs86v0/p0EPwlQqSMh4UhAqTNxu8xUVsPvzrwXr5TrrJ5AVKunBm5582AEkx47nZkqm/98ZF2iHb0GtQ==}
engines: {node: '>=15.0.0'} engines: {node: '>=15.0.0'}
dependencies: dependencies:
'@types/oauth': 0.9.1 '@types/oauth': 0.9.1