MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / apply

Function apply

packages/hydrooj/src/handler/user.ts:630–661  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

628}
629
630export async function apply(ctx: Context) {
631 ctx.Route('user_login', '/login', UserLoginHandler);
632 ctx.Route('user_oauth', '/oauth/:type/login', OauthHandler);
633 ctx.Route('user_sudo', '/user/sudo', UserSudoHandler, PRIV.PRIV_USER_PROFILE);
634 ctx.Route('user_tfa', '/user/tfa', UserTFAHandler);
635 ctx.Route('user_webauthn', '/user/webauthn', UserWebauthnHandler);
636 ctx.Route('user_oauth_callback', '/oauth/:type/callback', OauthCallbackHandler);
637 ctx.Route('user_register', '/register', UserRegisterHandler, PRIV.PRIV_REGISTER_USER);
638 ctx.Route('user_register_with_code', '/register/:code', UserRegisterWithCodeHandler, PRIV.PRIV_REGISTER_USER);
639 ctx.Route('user_logout', '/logout', UserLogoutHandler, PRIV.PRIV_USER_PROFILE);
640 ctx.Route('user_lostpass', '/lostpass', UserLostPassHandler);
641 ctx.Route('user_lostpass_with_code', '/lostpass/:code', UserLostPassWithCodeHandler);
642 ctx.Route('user_delete', '/user/delete', UserDeleteHandler, PRIV.PRIV_USER_PROFILE);
643 ctx.Route('user_detail', '/user/:uid', UserDetailHandler);
644 if (system.get('server.contestmode')) {
645 ctx.Route('contest_mode', '/contestmode', ContestModeHandler, PRIV.PRIV_EDIT_SYSTEM);
646 }
647 ctx.oauth.provide('mail', {
648 text: 'Mail',
649 name: 'mail',
650 hidden: true,
651 async get() {
652 throw new NotFoundError();
653 },
654 async callback() {
655 throw new NotFoundError();
656 },
657 });
658 await ctx.inject(['api'], ({ api }) => {
659 api.provide(UserApi);
660 });
661}

Callers

nothing calls this directly

Calls 3

RouteMethod · 0.80
getMethod · 0.45
provideMethod · 0.45

Tested by

no test coverage detected