mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix storage sign
This commit is contained in:
11 files changed
+38
-25
No files matched your search
+2
-2
@@ -17,9 +17,9 @@ const withoutTypes = (data) => ({
|
|||||||
const compilerOptionsBase = {
|
const compilerOptionsBase = {
|
||||||
target: 'es2022',
|
target: 'es2022',
|
||||||
lib: ['es2022'],
|
lib: ['es2022'],
|
||||||
module: 'commonjs',
|
module: 'preserve',
|
||||||
esModuleInterop: true,
|
esModuleInterop: true,
|
||||||
moduleResolution: 'node',
|
moduleResolution: 'bundler',
|
||||||
jsx: 'react',
|
jsx: 'react',
|
||||||
sourceMap: false,
|
sourceMap: false,
|
||||||
composite: true,
|
composite: true,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "react.yaml",
|
"main": "react.yaml",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@stylistic/eslint-plugin": "^3.1.0",
|
"@stylistic/eslint-plugin": "^4.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
||||||
"@typescript-eslint/parser": "^8.26.0",
|
"@typescript-eslint/parser": "^8.26.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
"@aws-sdk/lib-storage": "3.726.1",
|
"@aws-sdk/lib-storage": "3.726.1",
|
||||||
"@aws-sdk/s3-presigned-post": "3.726.1",
|
"@aws-sdk/s3-presigned-post": "3.726.1",
|
||||||
"@aws-sdk/s3-request-presigner": "3.726.1",
|
"@aws-sdk/s3-request-presigner": "3.726.1",
|
||||||
"@cordisjs/core": "4.0.0-alpha.2",
|
"@cordisjs/core": "4.0.0-alpha.3",
|
||||||
"@cordisjs/logger": "1.0.0-alpha.1",
|
"@cordisjs/logger": "1.0.0-alpha.2",
|
||||||
"@cordisjs/plugin-timer": "1.0.0-alpha.0",
|
"@cordisjs/plugin-timer": "1.0.0-alpha.0",
|
||||||
"@graphql-tools/schema": "^10.0.21",
|
"@graphql-tools/schema": "^10.0.21",
|
||||||
"@hydrooj/common": "workspace:^",
|
"@hydrooj/common": "workspace:^",
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"moment-timezone": "^0.5.47",
|
"moment-timezone": "^0.5.47",
|
||||||
"mongodb": "^5.9.2",
|
"mongodb": "^5.9.2",
|
||||||
"mongodb-uri": "^0.9.7",
|
"mongodb-uri": "^0.9.7",
|
||||||
"nanoid": "^5.1.2",
|
"nanoid": "^5.1.3",
|
||||||
"nodemailer": "^6.10.0",
|
"nodemailer": "^6.10.0",
|
||||||
"notp": "^2.0.3",
|
"notp": "^2.0.3",
|
||||||
"p-queue": "^8.1.0",
|
"p-queue": "^8.1.0",
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import { ContestDetailBaseHandler } from './contest';
|
|||||||
import { postJudge } from './judge';
|
import { postJudge } from './judge';
|
||||||
|
|
||||||
class RecordListHandler extends ContestDetailBaseHandler {
|
class RecordListHandler extends ContestDetailBaseHandler {
|
||||||
tdoc?: Tdoc;
|
|
||||||
|
|
||||||
@param('page', Types.PositiveInt, true)
|
@param('page', Types.PositiveInt, true)
|
||||||
@param('pid', Types.ProblemId, true)
|
@param('pid', Types.ProblemId, true)
|
||||||
@param('tid', Types.ObjectId, true)
|
@param('tid', Types.ObjectId, true)
|
||||||
@@ -131,7 +129,6 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
|||||||
|
|
||||||
class RecordDetailHandler extends ContestDetailBaseHandler {
|
class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||||
rdoc: RecordDoc;
|
rdoc: RecordDoc;
|
||||||
tdoc?: Tdoc;
|
|
||||||
|
|
||||||
@param('rid', Types.ObjectId)
|
@param('rid', Types.ObjectId)
|
||||||
async prepare(domainId: string, rid: ObjectId) {
|
async prepare(domainId: string, rid: ObjectId) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { AttestationFormat, CredentialDeviceType } from '@simplewebauthn/server';
|
import type { AttestationFormat, CredentialDeviceType } from '@simplewebauthn/server';
|
||||||
import type { AuthenticationExtensionsAuthenticatorOutputs } from '@simplewebauthn/server/esm/helpers/decodeAuthenticatorExtensions';
|
import type { ParsedAuthenticatorData } from '@simplewebauthn/server/helpers';
|
||||||
import type fs from 'fs';
|
import type fs from 'fs';
|
||||||
import type { Dictionary, NumericDictionary } from 'lodash';
|
import type { Dictionary, NumericDictionary } from 'lodash';
|
||||||
import type { Binary, FindCursor, ObjectId } from 'mongodb';
|
import type { Binary, FindCursor, ObjectId } from 'mongodb';
|
||||||
@@ -80,7 +80,7 @@ export interface Authenticator {
|
|||||||
userVerified: boolean;
|
userVerified: boolean;
|
||||||
credentialDeviceType: CredentialDeviceType;
|
credentialDeviceType: CredentialDeviceType;
|
||||||
credentialBackedUp: boolean;
|
credentialBackedUp: boolean;
|
||||||
authenticatorExtensionResults?: AuthenticationExtensionsAuthenticatorOutputs;
|
authenticatorExtensionResults?: ParsedAuthenticatorData['extensionsData'];
|
||||||
authenticatorAttachment: 'platform' | 'cross-platform';
|
authenticatorAttachment: 'platform' | 'cross-platform';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -370,8 +370,10 @@ class LocalStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isLinkValid(link: string) {
|
async isLinkValid(link: string) {
|
||||||
const [target, expire, secret] = link.split('/');
|
const parts = link.split('/');
|
||||||
const expected = md5(`${target}/${expire}/${this.config.secret}`);
|
const secret = parts.pop();
|
||||||
|
parts.push(this.config.secret);
|
||||||
|
const expected = md5(parts.join('/'));
|
||||||
return expected === secret;
|
return expected === secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@blueprintjs/core": "^5.17.5",
|
"@blueprintjs/core": "^5.17.5",
|
||||||
"@cordisjs/core": "4.0.0-alpha.2",
|
"@cordisjs/core": "4.0.0-alpha.3",
|
||||||
"@fontsource/dm-mono": "^5.2.5",
|
"@fontsource/dm-mono": "^5.2.5",
|
||||||
"@fontsource/fira-code": "^5.2.5",
|
"@fontsource/fira-code": "^5.2.5",
|
||||||
"@fontsource/inconsolata": "^5.2.5",
|
"@fontsource/inconsolata": "^5.2.5",
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
"monaco-editor-webpack-plugin": "^7.1.0",
|
"monaco-editor-webpack-plugin": "^7.1.0",
|
||||||
"monaco-themes": "^0.4.4",
|
"monaco-themes": "^0.4.4",
|
||||||
"monaco-yaml": "5.1.1",
|
"monaco-yaml": "5.1.1",
|
||||||
"nanoid": "^5.1.2",
|
"nanoid": "^5.1.3",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"p-queue": "^8.1.0",
|
"p-queue": "^8.1.0",
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
declare module '*.vue' {
|
||||||
|
export default {} as any;
|
||||||
|
}
|
||||||
@@ -14,14 +14,14 @@
|
|||||||
"react-dom": "^19.0.0"
|
"react-dom": "^19.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.22.0",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.10",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@vitejs/plugin-react-swc": "^3.8.0",
|
"@vitejs/plugin-react-swc": "^3.8.0",
|
||||||
"eslint": "^9.21.0",
|
"eslint": "^9.22.0",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.19",
|
"eslint-plugin-react-refresh": "^0.4.19",
|
||||||
"globals": "^15.15.0",
|
"globals": "^16.0.0",
|
||||||
"typescript": "~5.8.2",
|
"typescript": "~5.8.2",
|
||||||
"typescript-eslint": "^8.26.0",
|
"typescript-eslint": "^8.26.0",
|
||||||
"vite": "^6.2.1"
|
"vite": "^6.2.1"
|
||||||
|
|||||||
@@ -7,20 +7,31 @@ import type AdmZip from 'adm-zip';
|
|||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import moment, { isMoment, Moment } from 'moment-timezone';
|
import moment, { isMoment, Moment } from 'moment-timezone';
|
||||||
import { ObjectId } from 'mongodb';
|
import { ObjectId } from 'mongodb';
|
||||||
import Logger from 'reggol';
|
import { Exporter, Factory, Logger as Reggol } from 'reggol';
|
||||||
import type * as superagent from 'superagent';
|
import type * as superagent from 'superagent';
|
||||||
export * as yaml from 'js-yaml';
|
export * as yaml from 'js-yaml';
|
||||||
export * as fs from 'fs-extra';
|
export * as fs from 'fs-extra';
|
||||||
|
|
||||||
Logger.levels.base = process.env.DEV ? 3 : 2;
|
const factory = new Factory();
|
||||||
Logger.targets[0].showTime = 'dd hh:mm:ss';
|
|
||||||
Logger.targets[0].label = {
|
factory.addExporter(new Exporter.Console({
|
||||||
|
showDiff: false,
|
||||||
|
showTime: 'dd hh:mm:ss',
|
||||||
|
label: {
|
||||||
align: 'right',
|
align: 'right',
|
||||||
width: 9,
|
width: 9,
|
||||||
margin: 1,
|
margin: 1,
|
||||||
};
|
},
|
||||||
|
timestamp: Date.now(),
|
||||||
|
}));
|
||||||
|
|
||||||
export { Logger, moment };
|
function createLogger(name: string) {
|
||||||
|
return factory.createLogger(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Logger = Reggol & { new(name: string): Reggol & Logger };
|
||||||
|
export const Logger = createLogger as any as Logger;
|
||||||
|
export { moment };
|
||||||
|
|
||||||
const encrypt = (algorithm, content) => crypto.createHash(algorithm).update(content).digest('hex');
|
const encrypt = (algorithm, content) => crypto.createHash(algorithm).update(content).digest('hex');
|
||||||
export const sha1 = (content: string) => encrypt('sha1', content);
|
export const sha1 = (content: string) => encrypt('sha1', content);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"moment-timezone": "^0.5.47",
|
"moment-timezone": "^0.5.47",
|
||||||
"mongodb": "^5.9.2",
|
"mongodb": "^5.9.2",
|
||||||
"reggol": "^1.7.1",
|
"reggol": "^2.0.3",
|
||||||
"search-query-parser": "^1.6.0",
|
"search-query-parser": "^1.6.0",
|
||||||
"systeminformation": "^5.25.11"
|
"systeminformation": "^5.25.11"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user