mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
[mastodon-client] GET /v1/accounts/search
This commit is contained in:
parent
c7d62223ef
commit
0f17691f00
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@ import { NoteConverter } from "@/server/api/mastodon/converters/note.js";
|
|||
import { UserHelpers } from "@/server/api/mastodon/helpers/user.js";
|
||||
import { ListHelpers } from "@/server/api/mastodon/helpers/list.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 {
|
||||
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);
|
||||
}
|
||||
);
|
||||
// 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",
|
||||
auth(false),
|
||||
async (ctx) => {
|
||||
|
|
Loading…
Reference in a new issue