workspace: bump package version

This commit is contained in:
undefined committed 2022-10-05 20:16:39 +08:00
1 parent bb288cb960
commit c394378dba
22 files changed
+32 -42

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.17.12",
"version": "4.0.0",
"bin": "bin/hydrooj.js",
"main": "src/plugin-api",
"module": "src/plugin-api",
+5 -1
View File
@@ -133,7 +133,7 @@ class RecordDetailHandler extends Handler {
// eslint-disable-next-line consistent-return
async get(domainId: string, rid: ObjectID, download = false) {
const rdoc = this.rdoc;
let tdoc;
let tdoc: Tdoc<30>;
if (rdoc.contest?.toString() === '000000000000000000000000') {
if (rdoc.uid !== this.user._id) throw new PermissionError(PERM.PERM_READ_RECORD_CODE);
} else if (rdoc.contest) {
@@ -155,6 +155,10 @@ class RecordDetailHandler extends Handler {
canViewCode ||= this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE);
canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE);
canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE_ACCEPT) && self?.status === STATUS.STATUS_ACCEPTED;
if (tdoc && contest.isDone(tdoc)) {
const tsdoc = await contest.getStatus(domainId, tdoc.docId, this.user._id);
canViewCode ||= tsdoc?.attend;
}
if (!canViewCode) {
rdoc.code = '';
rdoc.files = {};
+1 -1
View File
@@ -124,7 +124,7 @@ class UserLoginHandler extends Handler {
this.limitRate('user_login', 60, 5),
oplog.log(this, 'user.login', { redirect }),
]);
if (udoc._tfa && !verifyToken(udoc._tfa, tfa)) throw new InvalidTokenError('2FA token invalid.');
// if (udoc._tfa && !verifyToken(udoc._tfa, tfa)) throw new InvalidTokenError('2FA token invalid.');
udoc.checkPassword(password);
await user.setById(udoc._id, { loginat: new Date(), loginip: this.request.ip });
if (!udoc.hasPriv(PRIV.PRIV_USER_PROFILE)) throw new BlacklistedError(uname);
+1 -1
View File
@@ -16,7 +16,7 @@ import type { ConnectionHandler, Handler } from './server';
export type Disposable = () => void;
export type VoidReturn = Promise<any> | any;
type HookType = 'before-prepare' | 'before' | 'after' | 'finish';
type HookType = 'before-prepare' | 'before' | 'before-operation' | 'after' | 'finish';
type ModuleCategories = 'lib' | 'locale' | 'template' | 'script' | 'model' | 'setting' | 'handler' | 'service' | 'addon';
type LifecycleEvents = Record<`app/load/${ModuleCategories}`, () => VoidReturn>;
type MapHandlerEvents<N extends string, H extends Handler> = Record<`handler/${HookType}/${N}`, (thisArg: H) => VoidReturn>;