From 77a48bf3fbf2905ce8a994def3b87e7957cb9349 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 31 Mar 2023 11:45:17 +0800 Subject: [PATCH] a11y: init --- install/install.ts | 6 ++---- packages/a11y/index.ts | 8 ++++++++ packages/a11y/package.json | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 packages/a11y/index.ts create mode 100644 packages/a11y/package.json diff --git a/install/install.ts b/install/install.ts index 1bca2cd0..4525259d 100644 --- a/install/install.ts +++ b/install/install.ts @@ -80,10 +80,8 @@ If you have any questions about the migration process, please add QQ group 10858 const installAsJudge = process.argv.includes('--judge'); const noCaddy = process.argv.includes('--no-caddy'); -const installTarget = installAsJudge - ? '@hydrooj/hydrojudge' - : 'hydrooj @hydrooj/hydrojudge @hydrooj/ui-default @hydrooj/fps-importer'; -const addons = ['@hydrooj/ui-default', '@hydrooj/hydrojudge', '@hydrooj/fps-importer']; +const addons = ['@hydrooj/ui-default', '@hydrooj/hydrojudge', '@hydrooj/fps-importer', '@hydrooj/a11y']; +const installTarget = installAsJudge ? '@hydrooj/hydrojudge' : `hydrooj ${addons.join(' ')}`; const substitutersArg = process.argv.find((i) => i.startsWith('--substituters=')); const substituters = substitutersArg ? substitutersArg.split('=')[1].split(',') : []; diff --git a/packages/a11y/index.ts b/packages/a11y/index.ts new file mode 100644 index 00000000..4d9fc0fc --- /dev/null +++ b/packages/a11y/index.ts @@ -0,0 +1,8 @@ +import { Context, UserModel } from 'hydrooj'; + +export async function apply(ctx: Context) { + // Auto authorize user 2 as super admin + ctx.on('handler/after/UserRegisterWithCode#post', async (that) => { + if (that.session.uid === 2) await UserModel.setSuperAdmin(2); + }); +} diff --git a/packages/a11y/package.json b/packages/a11y/package.json new file mode 100644 index 00000000..afde7a87 --- /dev/null +++ b/packages/a11y/package.json @@ -0,0 +1,4 @@ +{ + "name": "@hydrooj/a11y", + "version": "0.0.1" +}