diff --git a/package.json b/package.json index c4ea237e0..1e7adf8b9 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,11 @@ "version": "1.0.0", "license": "AGPL-3.0-only", "devDependencies": { - "@simplewebauthn/typescript-types": "^7.4.0", - "@types/autocannon": "^7.9.1", - "@types/cross-spawn": "^6.0.2", - "@types/node": "^20.5.6", - "@types/semver": "^7.5.0", + "@simplewebauthn/typescript-types": "^8.0.0", + "@types/autocannon": "^7.12.0", + "@types/cross-spawn": "^6.0.3", + "@types/node": "^20.6.1", + "@types/semver": "^7.5.2", "@types/supertest": "^2.0.12", "autocannon": "^7.12.0", "cac": "^6.7.14", @@ -47,7 +47,7 @@ "css-loader": "^6.8.1", "esbuild": "0.17.10", "esbuild-loader": "^2.21.0", - "eslint": "^8.48.0", + "eslint": "^8.49.0", "eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-webpack": "^0.13.7", "fs-extra": "^11.1.1", @@ -56,7 +56,7 @@ "latest-version": "7.0.0", "mini-css-extract-plugin": "^2.7.6", "monaco-editor-webpack-plugin": "^7.1.0", - "mongodb": "^5.7.0", + "mongodb": "^5.9.0", "mongodb-memory-server": "^8.15.1", "nyc": "^15.1.0", "ora": "^6.3.1", @@ -64,13 +64,13 @@ "semver": "^7.5.4", "simple-git": "^3.19.1", "style-loader": "^3.3.3", - "stylus": "^0.59.0", + "stylus": "^0.60.0", "stylus-loader": "7.1.2", "supertest": "^6.3.3", "ts-loader": "^9.4.4", "typescript": "5.0.2", "webpack": "^5.88.2", - "webpack-bundle-analyzer": "^4.9.0", + "webpack-bundle-analyzer": "^4.9.1", "webpack-dev-server": "^4.15.1", "webpack-manifest-plugin": "^5.0.0", "webpackbar": "^5.0.2", @@ -78,8 +78,8 @@ }, "resolutions": { "@types/node": "18.17.1", - "@types/react": "18.2.16", - "schemastery": "3.11.1", + "@types/react": "18.2.22", + "schemastery": "3.13.0", "prettier": "npm:not-installable-package@1.0.0" } } diff --git a/packages/elastic/package.json b/packages/elastic/package.json index 5e868cac3..63563116a 100644 --- a/packages/elastic/package.json +++ b/packages/elastic/package.json @@ -6,6 +6,6 @@ "author": "undefined ", "license": "AGPL-3.0-or-later", "dependencies": { - "@elastic/elasticsearch": "^8.8.1" + "@elastic/elasticsearch": "^8.9.0" } } diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index f7a9b6fea..00a6843bd 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -4,8 +4,8 @@ "license": "MIT", "main": "react.yaml", "dependencies": { - "@typescript-eslint/eslint-plugin": "^6.4.1", - "@typescript-eslint/parser": "^6.4.1", + "@typescript-eslint/eslint-plugin": "^6.7.2", + "@typescript-eslint/parser": "^6.7.2", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", "eslint-plugin-import": "2.28.1", diff --git a/packages/fps-importer/package.json b/packages/fps-importer/package.json index a0ea48fc3..851cad92f 100644 --- a/packages/fps-importer/package.json +++ b/packages/fps-importer/package.json @@ -12,6 +12,6 @@ "xml2js": "^0.6.2" }, "devDependencies": { - "@types/xml2js": "^0.4.11" + "@types/xml2js": "^0.4.12" } } diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 6e23de2f3..a9adcc80f 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -8,12 +8,12 @@ "dependencies": { "@hydrooj/utils": "workspace:*", "cac": "^6.7.14", - "mongodb": "^5.7.0", - "p-queue": "^7.3.4", - "schemastery": "^3.11.1", + "mongodb": "^5.9.0", + "p-queue": "^7.4.1", + "schemastery": "^3.13.0", "shell-quote": "^1.8.1", - "superagent": "^8.0.9", - "ws": "^8.13.0" + "superagent": "^8.1.2", + "ws": "^8.14.2" }, "preferUnplugged": true, "license": "AGPL-3.0-or-later", diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 30efd6789..6bdd952f0 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -12,22 +12,22 @@ }, "preferUnplugged": true, "dependencies": { - "@aws-sdk/client-s3": "3.357.0", - "@aws-sdk/lib-storage": "3.357.0", - "@aws-sdk/middleware-endpoint": "3.357.0", - "@aws-sdk/s3-presigned-post": "3.357.0", - "@aws-sdk/s3-request-presigner": "3.357.0", + "@aws-sdk/client-s3": "3.414.0", + "@aws-sdk/lib-storage": "3.414.0", + "@aws-sdk/middleware-endpoint": "3.374.0", + "@aws-sdk/s3-presigned-post": "3.414.0", + "@aws-sdk/s3-request-presigner": "3.414.0", "@graphql-tools/schema": "^10.0.0", "@hydrooj/utils": "workspace:*", - "@simplewebauthn/server": "^7.4.0", + "@simplewebauthn/server": "^8.1.1", "adm-zip": "0.5.5", "cac": "^6.7.14", - "cordis": "^2.8.7", + "cordis": "^2.8.8", "detect-browser": "^5.3.0", "emoji-regex": "^10.2.1", "emojis-list": "2.1.0", "fs-extra": "^11.1.1", - "graphql": "^16.8.0", + "graphql": "^16.8.1", "graphql-scalars": "^1.22.2", "js-yaml": "^4.1.0", "koa": "^2.14.2", @@ -40,39 +40,39 @@ "lru-cache": "^9.1.2", "mime-types": "^2.1.35", "moment-timezone": "^0.5.43", - "mongodb": "^5.7.0", - "nanoid": "^4.0.2", - "nodemailer": "^6.9.4", + "mongodb": "^5.9.0", + "nanoid": "^5.0.1", + "nodemailer": "^6.9.5", "notp": "^2.0.3", - "p-queue": "^7.3.4", + "p-queue": "^7.4.1", "path-to-regexp": "^6.2.1", "require-resolve-hook": "^1.1.0", "saslprep": "^1.0.3", - "schemastery": "^3.11.1", + "schemastery": "^3.13.0", "semver": "^7.5.4", "serialize-javascript": "^6.0.1", - "superagent": "^8.0.9", - "tar": "^6.1.15", + "superagent": "^8.1.2", + "tar": "^6.2.0", "thirty-two": "^1.0.2", - "ws": "^8.13.0" + "ws": "^8.14.2" }, "devDependencies": { "@types/adm-zip": "^0.4.34", - "@types/fs-extra": "^11.0.1", - "@types/js-yaml": "^4.0.5", - "@types/koa": "^2.13.8", - "@types/koa-compress": "^4.0.3", - "@types/koa-router": "^7.4.4", - "@types/koa-static-cache": "^5.1.1", - "@types/lodash": "^4.14.197", + "@types/fs-extra": "^11.0.2", + "@types/js-yaml": "^4.0.6", + "@types/koa": "^2.13.9", + "@types/koa-compress": "^4.0.4", + "@types/koa-router": "^7.4.5", + "@types/koa-static-cache": "^5.1.2", + "@types/lodash": "^4.14.198", "@types/mime-types": "^2.1.1", - "@types/nodemailer": "^6.4.9", + "@types/nodemailer": "^6.4.10", "@types/notp": "^2.0.2", "@types/saslprep": "^1.0.1", - "@types/semver": "^7.5.0", + "@types/semver": "^7.5.2", "@types/serialize-javascript": "^5.0.2", "@types/superagent": "^4.1.18", - "@types/tar": "^6.1.5", + "@types/tar": "^6.1.6", "moment": "^2.29.4" } } diff --git a/packages/hydrooj/src/handler/home.ts b/packages/hydrooj/src/handler/home.ts index 1ba97063b..10b5d5ad2 100644 --- a/packages/hydrooj/src/handler/home.ts +++ b/packages/hydrooj/src/handler/home.ts @@ -283,7 +283,7 @@ class HomeSecurityHandler extends Handler { @requireSudo @param('type', Types.Range(['cross-platform', 'platform'])) async postRegister(domainId: string, type: 'cross-platform' | 'platform') { - const options = generateRegistrationOptions({ + const options = await generateRegistrationOptions({ rpName: system.get('server.name'), rpID: this.request.hostname, userID: this.user._id.toString(), diff --git a/packages/hydrooj/src/handler/user.ts b/packages/hydrooj/src/handler/user.ts index 5b98ea23b..2cd18f6a9 100644 --- a/packages/hydrooj/src/handler/user.ts +++ b/packages/hydrooj/src/handler/user.ts @@ -172,7 +172,7 @@ class UserWebauthnHandler extends Handler { const udoc = this.user._id ? this.user : ((await user.getByEmail(domainId, uname)) || await user.getByUname(domainId, uname)); if (!udoc._id) throw new UserNotFoundError(uname || 'user'); if (!udoc.authn) throw new AuthOperationError('authn', 'disabled'); - const options = generateAuthenticationOptions({ + const options = await generateAuthenticationOptions({ allowCredentials: udoc._authenticators.map((authenticator) => ({ id: authenticator.credentialID.buffer, type: 'public-key', @@ -332,6 +332,11 @@ class UserLostPassHandler extends Handler { if (!system.get('smtp.user')) throw new SystemError('Cannot send mail'); const udoc = await user.getByEmail('system', mail); if (!udoc) throw new UserNotFoundError(mail); + await Promise.all([ + this.limitRate('send_mail', 3600, 30, false), + this.limitRate(`user_lostpass_${mail}`, 60, 5, false), + oplog.log(this, 'user.lostpass', {}), + ]); const [tid] = await token.add( token.TYPE_LOSTPASS, system.get('session.unsaved_expire_seconds'), diff --git a/packages/hydrooj/src/interface.ts b/packages/hydrooj/src/interface.ts index 9d0f77c68..fb57e4073 100644 --- a/packages/hydrooj/src/interface.ts +++ b/packages/hydrooj/src/interface.ts @@ -1,5 +1,5 @@ -import { AttestationFormat } from '@simplewebauthn/server/dist/helpers/decodeAttestationObject'; -import { AuthenticationExtensionsAuthenticatorOutputs } from '@simplewebauthn/server/dist/helpers/decodeAuthenticatorExtensions'; +import { AttestationFormat } from '@simplewebauthn/server/script/helpers/decodeAttestationObject'; +import { AuthenticationExtensionsAuthenticatorOutputs } from '@simplewebauthn/server/script/helpers/decodeAuthenticatorExtensions'; import { CredentialDeviceType } from '@simplewebauthn/typescript-types'; import type fs from 'fs'; import type { Dictionary, NumericDictionary } from 'lodash'; diff --git a/packages/migrate/package.json b/packages/migrate/package.json index be15bdd67..ba6574916 100644 --- a/packages/migrate/package.json +++ b/packages/migrate/package.json @@ -6,13 +6,13 @@ "author": "undefined ", "license": "AGPL-3.0-or-later", "dependencies": { - "mariadb": "^3.2.0", - "mongodb": "^5.7.0", + "mariadb": "^3.2.1", + "mongodb": "^5.9.0", "turndown": "^7.1.2", "xml2js": "^0.6.2" }, "devDependencies": { - "@types/turndown": "^5.0.1", - "@types/xml2js": "^0.4.11" + "@types/turndown": "^5.0.2", + "@types/xml2js": "^0.4.12" } } diff --git a/packages/ui-default/api.ts b/packages/ui-default/api.ts index f985c5707..225c78617 100644 --- a/packages/ui-default/api.ts +++ b/packages/ui-default/api.ts @@ -4,7 +4,7 @@ export * from './utils'; export { default as Notification } from './components/notification'; export * from './components/dialog'; export { Context, Service, ctx } from './context'; -export { default as AnsiUp } from 'ansi_up'; +export { AnsiUp } from 'ansi_up'; export { default as loadMonaco } from './components/monaco/loader'; export { default as Socket } from './components/socket/index'; export { default as uploadFiles } from './components/upload'; diff --git a/packages/ui-default/backendlib/misc.ts b/packages/ui-default/backendlib/misc.ts index b6167a86e..238696e6c 100644 --- a/packages/ui-default/backendlib/misc.ts +++ b/packages/ui-default/backendlib/misc.ts @@ -1,4 +1,4 @@ -import AnsiUp from 'ansi_up'; +import { AnsiUp } from 'ansi_up'; import { moment, ObjectId } from 'hydrooj'; export { size, formatSeconds } from 'hydrooj'; diff --git a/packages/ui-default/components/autocomplete/autocomplete.page.styl b/packages/ui-default/components/autocomplete/autocomplete.page.styl index 46233b99f..9eb2ddab7 100644 --- a/packages/ui-default/components/autocomplete/autocomplete.page.styl +++ b/packages/ui-default/components/autocomplete/autocomplete.page.styl @@ -66,7 +66,7 @@ white-space: nowrap text-overflow: ellipsis - &>span.bp4-icon>svg + &>span.bp5-icon>svg font-size: 12px cursor: pointer padding: 4px @@ -91,19 +91,19 @@ &>div flex-grow: 1 - &>span.bp4-icon>svg + &>span.bp5-icon>svg color: transparent &[aria-selected='true'] background-color: #fafafa font-weight: 600 - &>span.bp4-icon>svg + &>span.bp5-icon>svg color: #1890ff &[data-focus='true'] background-color: #e6f7ff cursor: pointer - &>span.bp4-icon>svg + &>span.bp5-icon>svg color: currentColor diff --git a/packages/ui-default/components/problemconfig/ProblemConfigTree.tsx b/packages/ui-default/components/problemconfig/ProblemConfigTree.tsx index def73b43d..87b3a13e2 100644 --- a/packages/ui-default/components/problemconfig/ProblemConfigTree.tsx +++ b/packages/ui-default/components/problemconfig/ProblemConfigTree.tsx @@ -1,5 +1,6 @@ -import { Button, Icon, TreeNode } from '@blueprintjs/core'; -import { Popover2 } from '@blueprintjs/popover2'; +import { + Button, Classes, Icon, Popover, TreeNode, +} from '@blueprintjs/core'; import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/utils/lib/common'; import { TestCaseConfig } from 'hydrooj'; import { isEqual } from 'lodash'; @@ -61,12 +62,12 @@ export function SubtaskNode(props: { subtaskId: number }) { } return ( -
  • - {subtaskId !== -1 &&
    setExpand((e) => !e)}> +
  • + {subtaskId !== -1 &&
    setExpand((e) => !e)}>   - {i18n('Subtask {0}', subtaskId)} - ev.stopPropagation()}> - {i18n('Subtask {0}', subtaskId)} + ev.stopPropagation()}> + {i18n('Are you sure you want to delete this subtask?')}
    @@ -75,10 +76,10 @@ export function SubtaskNode(props: { subtaskId: number }) {
    } > - +
    } -
      +
        {subtaskId !== -1 && } {expand ? @@ -91,10 +92,10 @@ export function SubtaskNode(props: { subtaskId: number }) { path={[0]} />} {!cases.length && ( -
      • -
        - - {subtaskId === -1 +
      • +
        + + {subtaskId === -1 ? i18n('No testcase here') : i18n('Drag and drop testcases here:')}
        @@ -123,23 +124,23 @@ export function SubtaskConfigTree() { }); } return ( -
        -
          -
        • -
          +
          +
            +
          • +
              - {i18n('Auto configure')} + {i18n('Auto configure')}
          • {ids.map((id) => )}
          • dispatch({ type: 'problemconfig/addSubtask' })} > -
            +
              - {i18n('Add new subtask')} + {i18n('Add new subtask')}
          @@ -155,8 +156,8 @@ export function ProblemConfigTree() {
          -
          -
            +
            +
            diff --git a/packages/ui-default/components/problemconfig/ProblemType.tsx b/packages/ui-default/components/problemconfig/ProblemType.tsx index 2781d605e..260520085 100644 --- a/packages/ui-default/components/problemconfig/ProblemType.tsx +++ b/packages/ui-default/components/problemconfig/ProblemType.tsx @@ -1,5 +1,5 @@ import { - Card, Switch, Tab, Tabs, + Card, Classes, Switch, Tab, Tabs, } from '@blueprintjs/core'; import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; @@ -27,7 +27,7 @@ export default function ProblemType() { defaultSelectedTabId="default" renderActiveTabPanelOnly > - {i18n('Problem Type')} + {i18n('Problem Type')} - {i18n('CheckerType')} + {i18n('CheckerType')} -
          • -
            +
          • +
              - {i18n('Auto detect')} + {i18n('Auto detect')}
          • { setInput(''); setOutput(''); @@ -102,9 +99,9 @@ export function AddTestcase() { setOpen(true); }} > -
            +
              - {i18n('Add testcase')} + {i18n('Add testcase')}
          • setOpen(false)}> diff --git a/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx b/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx index f90802be0..6ad8275d6 100644 --- a/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx +++ b/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx @@ -101,35 +101,35 @@ export function SubtaskSettings(props: SubtaskSettingsProps) { } /> -
          • setOpen(true)}> -
            - +
          • setOpen(true)}> +
            +    - {time || props.time || '1s'} + {time || props.time || '1s'}    - {memory || props.memory || '256m'} + {memory || props.memory || '256m'} {' '} - {score || 0} + {score || 0}
          • -
          • setDepsOpen(true)}> -
            - +
          • setDepsOpen(true)}> +
            +    - {i18n('Dependencies')}: {deps.length ? deps.join(', ') : i18n('(None)')} + {i18n('Dependencies')}: {deps.length ? deps.join(', ') : i18n('(None)')}
          • -
          • -
            - +
          • +
            +    - {i18n('Scoring method')} - + {i18n('Scoring method')} +