mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Handle 404 for user accounts
This commit is contained in:
parent
b3edf31afc
commit
59533e5f0c
@ -1,6 +1,7 @@
|
|||||||
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
||||||
import Elysia, { t } from "elysia";
|
import Elysia, { t } from "elysia";
|
||||||
import { createRemoteJWKSet, jwtVerify } from "jose";
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
||||||
|
import { KError } from "./models/error";
|
||||||
|
|
||||||
const jwtSecret = process.env.JWT_SECRET
|
const jwtSecret = process.env.JWT_SECRET
|
||||||
? new TextEncoder().encode(process.env.JWT_SECRET)
|
? new TextEncoder().encode(process.env.JWT_SECRET)
|
||||||
@ -86,7 +87,7 @@ const User = t.Object({
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
const UserC = TypeCompiler.Compile(User);
|
const UserC = TypeCompiler.Compile(t.Union([User, KError]));
|
||||||
|
|
||||||
export async function getUserInfo(
|
export async function getUserInfo(
|
||||||
id: string,
|
id: string,
|
||||||
|
@ -174,6 +174,15 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
|||||||
authorization: t.TemplateLiteral("Bearer ${string}"),
|
authorization: t.TemplateLiteral("Bearer ${string}"),
|
||||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||||
}),
|
}),
|
||||||
|
response: {
|
||||||
|
200: Page(Show),
|
||||||
|
403: KError,
|
||||||
|
404: {
|
||||||
|
...KError,
|
||||||
|
description: "No user found with the specified id/username.",
|
||||||
|
},
|
||||||
|
422: KError,
|
||||||
|
},
|
||||||
permissions: ["users.read"],
|
permissions: ["users.read"],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user