mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
onsite-toolkit: add auto redirect
This commit is contained in:
8 files changed
+33
-27
No files matched your search
@@ -7,12 +7,12 @@
|
||||
"dependencies": {
|
||||
"@antfu/eslint-config": "^8.3.0",
|
||||
"@eslint-react/eslint-plugin": "^4.2.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.61.0",
|
||||
"@typescript-eslint/parser": "^8.61.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
||||
"@typescript-eslint/parser": "^8.61.1",
|
||||
"eslint-plugin-de-morgan": "^2.1.2",
|
||||
"eslint-plugin-github": "^6.0.0",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"eslint-plugin-react-refresh": "^0.5.3",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"globals": "^17.6.0"
|
||||
},
|
||||
|
||||
+3
-3
@@ -55,12 +55,12 @@
|
||||
"mongodb-memory-server": "11.0.1",
|
||||
"nyc": "^18.0.0",
|
||||
"ora": "^9.4.0",
|
||||
"oxlint": "^1.69.0",
|
||||
"oxlint": "^1.70.0",
|
||||
"package-json": "^10.0.1",
|
||||
"semver": "^7.8.4",
|
||||
"semver": "^7.8.5",
|
||||
"simple-git": "^3.36.0",
|
||||
"supertest": "^7.2.2",
|
||||
"supports-hyperlinks": "^4.4.0",
|
||||
"supports-hyperlinks": "^4.5.0",
|
||||
"typescript": "5.8.3",
|
||||
"wtfnode": "^0.10.1"
|
||||
},
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0",
|
||||
"semver": "^7.8.4"
|
||||
"semver": "^7.8.5"
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
"@types/diff": "^8.0.0",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/lodash": "^4.17.24",
|
||||
"sass": "^1.100.0"
|
||||
"sass": "^1.101.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
"@hydrooj/common": "workspace:^",
|
||||
"@hydrooj/utils": "workspace:^",
|
||||
"@opentelemetry/api": "^1.9.1",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
|
||||
"@opentelemetry/sdk-node": "^0.218.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
|
||||
"@opentelemetry/sdk-node": "^0.219.0",
|
||||
"@zip.js/zip.js": "^2.8.26",
|
||||
"cac": "^7.0.0",
|
||||
"p-queue": "^9.3.0",
|
||||
"schemastery": "^3.18.0",
|
||||
"semver": "^7.8.4",
|
||||
"semver": "^7.8.5",
|
||||
"shell-quote": "^1.8.4",
|
||||
"superagent": "^10.3.0",
|
||||
"ws": "^8.21.0"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"adm-zip": "0.5.16",
|
||||
"cac": "^7.0.0",
|
||||
"cordis": "4.0.0-rc.4",
|
||||
"csv-stringify": "^6.7.0",
|
||||
"csv-stringify": "^6.8.0",
|
||||
"emoji-regex": "^10.6.0",
|
||||
"emojis-list": "2.1.0",
|
||||
"fs-extra": "^11.3.5",
|
||||
@@ -42,13 +42,13 @@
|
||||
"moment-timezone": "^0.6.2",
|
||||
"mongodb": "^7.3.0",
|
||||
"mongodb-uri": "^0.9.7",
|
||||
"nanoid": "^5.1.11",
|
||||
"nanoid": "^5.1.14",
|
||||
"nodemailer": "^8.0.11",
|
||||
"otpauth": "^9.5.1",
|
||||
"p-queue": "^9.3.0",
|
||||
"sanitize-filename": "^1.6.4",
|
||||
"schemastery": "^3.18.0",
|
||||
"semver": "^7.8.4",
|
||||
"semver": "^7.8.5",
|
||||
"shorty.js": "^1.0.1",
|
||||
"superagent": "^10.3.0",
|
||||
"superagent-proxy": "^3.0.0",
|
||||
@@ -64,7 +64,7 @@
|
||||
"@types/lodash": "^4.17.24",
|
||||
"@types/mime-types": "^3.0.1",
|
||||
"@types/mongodb-uri": "^0.9.4",
|
||||
"@types/nodemailer": "^8.0.0",
|
||||
"@types/nodemailer": "^8.0.1",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@types/superagent": "^8.1.10",
|
||||
"@types/superagent-proxy": "^3.0.4",
|
||||
|
||||
@@ -90,6 +90,12 @@ export function apply(ctx: Context, config: ReturnType<typeof Config>) {
|
||||
ctx.on('handler/before', (that) => {
|
||||
if (typeof that.user.contestMode === 'string' && !['system', that.user.contestMode].includes(that.domain._id)) throw new ForbiddenError('Not available');
|
||||
});
|
||||
ctx.on('handler/before/HomeHandler#get', (that) => { // eslint-disable-line
|
||||
if (typeof that.user.contestMode === 'string' && that.domain._id !== that.user.contestMode) {
|
||||
that.response.redirect = `/d/${that.user.contestMode}/`;
|
||||
return 'cleanup';
|
||||
}
|
||||
});
|
||||
|
||||
async function generateCdpZip(tdoc) {
|
||||
let token = 0;
|
||||
@@ -307,7 +313,7 @@ export function apply(ctx: Context, config: ReturnType<typeof Config>) {
|
||||
if (line.member4) line.members.push(line.member4);
|
||||
const set: any = _.pick(line, 'school', 'members', 'coach', 'seat');
|
||||
if (line.school) set.avatar = `url:/avatars/${line.school.replace(/[ ()]/g, '')}.${format}`;
|
||||
set.contestMode = true;
|
||||
set.contestMode = domainId;
|
||||
await UserModel.setById(team._id, set);
|
||||
for (const tdoc of tdocs) {
|
||||
const tsdoc = await ContestModel.getStatus(domainId, tdoc.docId, team._id);
|
||||
@@ -346,7 +352,7 @@ export function apply(ctx: Context, config: ReturnType<typeof Config>) {
|
||||
if (config.contestMode) {
|
||||
ctx.inject(['setting'], (c) => {
|
||||
c.setting.AccountSetting(
|
||||
SettingModel.Setting('setting_info', 'contestMode', null, 'boolean', 'contestMode', 'Contest Mode', SettingModel.FLAG_DISABLED | SettingModel.FLAG_PUBLIC),
|
||||
SettingModel.Setting('setting_info', 'contestMode', null, 'text', 'contestMode', 'Contest Mode', SettingModel.FLAG_DISABLED | SettingModel.FLAG_PUBLIC),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
"@fontsource/source-code-pro": "^5.2.7",
|
||||
"@fontsource/ubuntu-mono": "^5.2.8",
|
||||
"@hydrooj/utils": "workspace:^",
|
||||
"@mantine/core": "^9.3.1",
|
||||
"@mantine/hooks": "^9.3.1",
|
||||
"@mantine/notifications": "^9.3.1",
|
||||
"@sentry/browser": "^10.57.0",
|
||||
"@mantine/core": "^9.3.2",
|
||||
"@mantine/hooks": "^9.3.2",
|
||||
"@mantine/notifications": "^9.3.2",
|
||||
"@sentry/browser": "^10.59.0",
|
||||
"@sentry/webpack-plugin": "^5.3.0",
|
||||
"@simplewebauthn/browser": "13.2.2",
|
||||
"@svgr/webpack": "^8.1.0",
|
||||
@@ -66,7 +66,7 @@
|
||||
"jquery": "^3.7.1",
|
||||
"jquery.easing": "^1.4.1",
|
||||
"jquery.transit": "^0.9.12",
|
||||
"mantine-contextmenu": "^9.2.1",
|
||||
"mantine-contextmenu": "^9.3.1",
|
||||
"matchmedia-polyfill": "^0.3.2",
|
||||
"md-editor-rt": "^6.5.1",
|
||||
"mini-css-extract-plugin": "^2.10.2",
|
||||
@@ -76,7 +76,7 @@
|
||||
"monaco-editor-webpack-plugin": "^7.1.1",
|
||||
"monaco-themes": "0.4.7",
|
||||
"monaco-yaml": "5.4.1",
|
||||
"nanoid": "^5.1.11",
|
||||
"nanoid": "^5.1.14",
|
||||
"normalize.css": "^8.0.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"p-queue": "^9.3.0",
|
||||
@@ -99,7 +99,7 @@
|
||||
"redux-promise-middleware": "^6.2.0",
|
||||
"redux-thunk": "^3.1.0",
|
||||
"rupture": "^0.7.1",
|
||||
"sass": "^1.100.0",
|
||||
"sass": "^1.101.0",
|
||||
"sass-loader": "^16.0.8",
|
||||
"schemastery": "^3.18.0",
|
||||
"shorty.js": "^1.0.1",
|
||||
@@ -112,11 +112,11 @@
|
||||
"tether-drop": "^1.4.2",
|
||||
"timeago-react": "^3.0.7",
|
||||
"timeago.js": "^4.0.2",
|
||||
"ts-loader": "^9.6.0",
|
||||
"ts-loader": "^9.6.1",
|
||||
"web-streams-polyfill": "^4.3.0",
|
||||
"webpack": "^5.107.2",
|
||||
"webpack-bundle-analyzer": "^5.3.0",
|
||||
"webpack-dev-server": "^5.2.4",
|
||||
"webpack-dev-server": "^5.2.5",
|
||||
"webpack-manifest-plugin": "^6.0.1",
|
||||
"webpackbar": "^7.0.0"
|
||||
},
|
||||
@@ -142,7 +142,7 @@
|
||||
"nunjucks": "^3.2.4",
|
||||
"schemastery-jsonschema": "^1.1.1",
|
||||
"streamsaver": "^2.0.6",
|
||||
"uuid": "^14.0.0",
|
||||
"uuid": "^14.0.1",
|
||||
"xss": "^1.0.15"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user