Skip to content

Commit

Permalink
Merge branch 'master' into edit_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined-moe authored Sep 20, 2023
2 parents 59f9a8e + 385d90f commit af8a8f4
Show file tree
Hide file tree
Showing 27 changed files with 179 additions and 177 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -56,30 +56,30 @@
"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",
"postcss-loader": "7.3.2",
"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",
"wtfnode": "^0.9.1"
},
"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"
}
}
2 changes: 1 addition & 1 deletion packages/elastic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@elastic/elasticsearch": "^8.8.1"
"@elastic/elasticsearch": "^8.9.0"
}
}
4 changes: 2 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/fps-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"xml2js": "^0.6.2"
},
"devDependencies": {
"@types/xml2js": "^0.4.11"
"@types/xml2js": "^0.4.12"
}
}
10 changes: 5 additions & 5 deletions packages/hydrojudge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
52 changes: 26 additions & 26 deletions packages/hydrooj/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion packages/hydrooj/src/handler/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
7 changes: 6 additions & 1 deletion packages/hydrooj/src/handler/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'),
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrooj/src/interface.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
8 changes: 4 additions & 4 deletions packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"author": "undefined <i@undefined.moe>",
"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"
}
}
2 changes: 1 addition & 1 deletion packages/ui-default/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-default/backendlib/misc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AnsiUp from 'ansi_up';
import { AnsiUp } from 'ansi_up';
import { moment, ObjectId } from 'hydrooj';

export { size, formatSeconds } from 'hydrooj';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
47 changes: 24 additions & 23 deletions packages/ui-default/components/problemconfig/ProblemConfigTree.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -61,12 +62,12 @@ export function SubtaskNode(props: { subtaskId: number }) {
}

return (
<li className="bp4-tree-node bp4-tree-node-expanded">
{subtaskId !== -1 && <div className="bp4-tree-node-content" onClick={() => setExpand((e) => !e)}>
<li className={`${Classes.TREE_NODE} ${Classes.TREE_NODE_EXPANDED}`}>
{subtaskId !== -1 && <div className={Classes.TREE_NODE_CONTENT} onClick={() => setExpand((e) => !e)}>
<Icon icon={expand ? 'folder-open' : 'folder-close'} />&nbsp;
<span className="bp4-tree-node-label">{i18n('Subtask {0}', subtaskId)}</span>
<span className="bp4-tree-node-secondary-label" onClick={(ev) => ev.stopPropagation()}>
<Popover2
<span className={Classes.TREE_NODE_LABEL}>{i18n('Subtask {0}', subtaskId)}</span>
<span className={Classes.TREE_NODE_SECONDARY_LABEL} onClick={(ev) => ev.stopPropagation()}>
<Popover
content={<div style={{ padding: 20 }}>
<b>{i18n('Are you sure you want to delete this subtask?')}</b>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 15 }}>
Expand All @@ -75,10 +76,10 @@ export function SubtaskNode(props: { subtaskId: number }) {
</div>}
>
<Icon icon="trash" />
</Popover2>
</Popover>
</span>
</div>}
<ul className="bp4-tree-node-list" ref={drop}>
<ul className={Classes.TREE_NODE_LIST} ref={drop}>
{subtaskId !== -1 && <SubtaskSettings subtaskId={subtaskId} subtaskIds={subtaskIds} time={time} memory={memory} />}
{expand
? <SelectionManager subtaskId={subtaskId} subtaskIds={subtaskIds} />
Expand All @@ -91,10 +92,10 @@ export function SubtaskNode(props: { subtaskId: number }) {
path={[0]}
/>}
{!cases.length && (
<li className="bp4-tree-node">
<div className="bp4-tree-node-content">
<span className="bp4-tree-node-caret-none bp4-icon-standard"></span>
<span className="bp4-tree-node-label text-gray">{subtaskId === -1
<li className={Classes.TREE_NODE}>
<div className={Classes.TREE_NODE_CONTENT}>
<span className={`${Classes.TREE_NODE_CARET_NONE} ${Classes.ICON_STANDARD}`}></span>
<span className={`${Classes.TREE_NODE_LABEL} text-gray`}>{subtaskId === -1
? i18n('No testcase here')
: i18n('Drag and drop testcases here:')}</span>
</div>
Expand Down Expand Up @@ -123,23 +124,23 @@ export function SubtaskConfigTree() {
});
}
return (
<div className="bp4-tree">
<ul className="bp4-tree-node-list bp4-tree-root">
<li className="bp4-tree-node" onClick={autoConfigure}>
<div className="bp4-tree-node-content bp4-tree-node-content-0">
<div className={Classes.TREE}>
<ul className={`${Classes.TREE_NODE_LIST} ${Classes.TREE_ROOT}`}>
<li className={Classes.TREE_NODE} onClick={autoConfigure}>
<div className={`${Classes.TREE_NODE_CONTENT} bp5-tree-node-content-0`}>
<Icon icon="clean" />&nbsp;
<span className="bp4-tree-node-label">{i18n('Auto configure')}</span>
<span className={Classes.TREE_NODE_LABEL}>{i18n('Auto configure')}</span>
</div>
</li>
<GlobalSettings />
{ids.map((id) => <SubtaskNode key={id} subtaskId={id} />)}
<li
className="bp4-tree-node"
className={Classes.TREE_NODE}
onClick={() => dispatch({ type: 'problemconfig/addSubtask' })}
>
<div className="bp4-tree-node-content bp4-tree-node-content-0">
<div className={`${Classes.TREE_NODE_CONTENT} bp5-tree-node-content-0`}>
<Icon icon="folder-new" />&nbsp;
<span className="bp4-tree-node-label">{i18n('Add new subtask')}</span>
<span className={Classes.TREE_NODE_LABEL}>{i18n('Add new subtask')}</span>
</div>
</li>
</ul>
Expand All @@ -155,8 +156,8 @@ export function ProblemConfigTree() {
<SubtaskConfigTree />
</div>
<div className="medium-6 columns">
<div className="bp4-tree">
<ul className="bp4-tree-node-list bp4-tree-root">
<div className={Classes.TREE}>
<ul className={`${Classes.TREE_ROOT} ${Classes.TREE_NODE_LIST}`}>
<AddTestcase />
<SubtaskNode subtaskId={-1} />
</ul>
Expand Down
Loading

0 comments on commit af8a8f4

Please sign in to comment.