mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
[mastodon-client] GET /v1/accounts/search
This commit is contained in:
parent
c7d62223ef
commit
0f17691f00
@ -5,6 +5,7 @@ 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 { ListHelpers } from "@/server/api/mastodon/helpers/list.js";
|
import { ListHelpers } from "@/server/api/mastodon/helpers/list.js";
|
||||||
import { auth } from "@/server/api/mastodon/middleware/auth.js";
|
import { auth } from "@/server/api/mastodon/middleware/auth.js";
|
||||||
|
import { SearchHelpers } from "@/server/api/mastodon/helpers/search.js";
|
||||||
|
|
||||||
export function setupEndpointsAccount(router: Router): void {
|
export function setupEndpointsAccount(router: Router): void {
|
||||||
router.get("/v1/accounts/verify_credentials",
|
router.get("/v1/accounts/verify_credentials",
|
||||||
@ -33,6 +34,15 @@ export function setupEndpointsAccount(router: Router): void {
|
|||||||
ctx.body = await UserHelpers.getUserRelationhipToMany(ids, ctx.user.id);
|
ctx.body = await UserHelpers.getUserRelationhipToMany(ids, ctx.user.id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
// This must come before /accounts/:id, otherwise that will take precedence
|
||||||
|
router.get("/v1/accounts/search",
|
||||||
|
auth(true, ['read:accounts']),
|
||||||
|
async (ctx) => {
|
||||||
|
const args = normalizeUrlQuery(argsToBools(limitToInt(ctx.query), ['resolve', 'following']));
|
||||||
|
ctx.body = await SearchHelpers.search(args.q, 'accounts', args.resolve, args.following, undefined, false, undefined, undefined, args.limit, args.offset, ctx)
|
||||||
|
.then(p => p.accounts);
|
||||||
|
}
|
||||||
|
);
|
||||||
router.get<{ Params: { id: string } }>("/v1/accounts/:id",
|
router.get<{ Params: { id: string } }>("/v1/accounts/:id",
|
||||||
auth(false),
|
auth(false),
|
||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user