upgrade deps

master
undefined 10 months ago
parent e1cb062ec0
commit e2bff17589
No known key found for this signature in database

@ -33,53 +33,31 @@
"devDependencies": {
"@simplewebauthn/typescript-types": "7.4.0",
"@types/autocannon": "^7.12.5",
"@types/cross-spawn": "^6.0.5",
"@types/node": "^20.9.0",
"@types/semver": "^7.5.5",
"@types/cross-spawn": "^6.0.6",
"@types/node": "^20.10.0",
"@types/semver": "^7.5.6",
"@types/supertest": "^2.0.16",
"autocannon": "^7.12.0",
"autocannon": "^7.14.0",
"cac": "^6.7.14",
"chokidar": "^3.5.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"css-loader": "^6.8.1",
"esbuild": "0.17.10",
"esbuild-loader": "^2.21.0",
"eslint": "^8.53.0",
"esbuild": "0.19.7",
"eslint": "^8.54.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-webpack": "^0.13.8",
"fs-extra": "^11.1.1",
"globby": "14.0.0",
"inspectpack": "^4.7.1",
"mini-css-extract-plugin": "^2.7.6",
"monaco-editor-webpack-plugin": "^7.1.0",
"mongodb": "^5.9.1",
"mongodb-memory-server": "^9.0.1",
"mongodb-memory-server": "^9.1.1",
"nyc": "^15.1.0",
"ora": "^7.0.1",
"package-json": "^8.1.1",
"postcss-loader": "7.3.3",
"semver": "^7.5.4",
"simple-git": "^3.20.0",
"style-loader": "^3.3.3",
"stylus": "^0.61.0",
"stylus-loader": "7.1.2",
"simple-git": "^3.21.0",
"supertest": "^6.3.3",
"ts-loader": "^9.5.1",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.10.0",
"webpack-dev-server": "^4.15.1",
"webpack-manifest-plugin": "^5.0.0",
"webpackbar": "^5.0.2",
"typescript": "^5.3.2",
"wtfnode": "^0.9.1"
},
"resolutions": {
"@types/node": "18.17.1",
"@types/react": "18.2.28",
"schemastery": "3.13.0",
"prettier": "npm:not-installable-package@1.0.0"
}
}

@ -4,8 +4,8 @@
"license": "MIT",
"main": "react.yaml",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-plugin-github": "^4.10.1",

@ -19,7 +19,7 @@
"preferUnplugged": true,
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@types/shell-quote": "^1.7.4",
"@types/ws": "^8.5.9"
"@types/shell-quote": "^1.7.5",
"@types/ws": "^8.5.10"
}
}

@ -224,7 +224,8 @@ export default class Hydro {
const res = await this.post('login', {
uname: this.config.uname, password: this.config.password, rememberme: 'on',
});
await this.setCookie(res.headers['set-cookie'].join(';'));
const setCookie = res.headers['set-cookie'];
await this.setCookie((setCookie instanceof Array) ? setCookie.join(';') : setCookie);
}
async ensureLogin() {

@ -12,12 +12,12 @@
},
"preferUnplugged": true,
"dependencies": {
"@aws-sdk/client-s3": "3.451.0",
"@aws-sdk/lib-storage": "3.451.0",
"@aws-sdk/client-s3": "3.456.0",
"@aws-sdk/lib-storage": "3.456.0",
"@aws-sdk/middleware-endpoint": "3.374.0",
"@aws-sdk/s3-presigned-post": "3.451.0",
"@aws-sdk/s3-request-presigner": "3.451.0",
"@graphql-tools/schema": "^10.0.0",
"@aws-sdk/s3-presigned-post": "3.456.0",
"@aws-sdk/s3-request-presigner": "3.456.0",
"@graphql-tools/schema": "^10.0.2",
"@hydrooj/utils": "workspace:*",
"@simplewebauthn/server": "7.4.0",
"adm-zip": "0.5.5",
@ -37,7 +37,7 @@
"koa-router": "^12.0.1",
"koa-static-cache": "^5.1.4",
"lodash": "^4.17.21",
"lru-cache": "^10.0.2",
"lru-cache": "^10.1.0",
"mime-types": "^2.1.35",
"moment-timezone": "^0.5.43",
"mongodb": "^5.9.1",
@ -60,19 +60,19 @@
"@types/adm-zip": "^0.4.34",
"@types/fs-extra": "^11.0.4",
"@types/js-yaml": "^4.0.9",
"@types/koa": "^2.13.11",
"@types/koa": "^2.13.12",
"@types/koa-compress": "^4.0.6",
"@types/koa-router": "^7.4.7",
"@types/koa-router": "^7.4.8",
"@types/koa-static-cache": "^5.1.4",
"@types/lodash": "^4.14.201",
"@types/lodash": "^4.14.202",
"@types/mime-types": "^2.1.4",
"@types/nodemailer": "^6.4.14",
"@types/notp": "^2.0.5",
"@types/saslprep": "^1.0.3",
"@types/semver": "^7.5.5",
"@types/semver": "^7.5.6",
"@types/serialize-javascript": "^5.0.4",
"@types/superagent": "^4.1.21",
"@types/tar": "^6.1.9",
"@types/superagent": "^4.1.22",
"@types/tar": "^6.1.10",
"moment": "^2.29.4"
}
}

@ -106,7 +106,8 @@ class SystemScriptHandler extends SystemHandler {
args = global.Hydro.script[id].validate(args);
}
const rid = await record.add(domainId, -1, this.user._id, '-', id, false, { input: raw, type: 'pretest' });
const report = (data) => judge.next({ domainId, rid, ...data });
const rdoc = await record.get(rid);
const report = (data) => judge.next({ domainId, rid, ...data,rdoc });
report({ message: `Running script: ${id} `, status: STATUS.STATUS_JUDGING });
const start = Date.now();
// Maybe async?
@ -121,6 +122,7 @@ class SystemScriptHandler extends SystemHandler {
judger: 1,
time,
memory: 0,
rdoc,
});
})
.catch((err: Error) => {
@ -134,6 +136,7 @@ class SystemScriptHandler extends SystemHandler {
judger: 1,
time,
memory: 0,
rdoc,
});
});
this.response.body = { rid };

@ -14,7 +14,7 @@
"cli": false
},
"devDependencies": {
"@blueprintjs/core": "^5.6.0",
"@blueprintjs/core": "^5.7.1",
"@fontsource/dm-mono": "^5.0.17",
"@fontsource/fira-code": "^5.0.15",
"@fontsource/inconsolata": "^5.0.15",
@ -27,17 +27,17 @@
"@simplewebauthn/browser": "7.4.0",
"@svgr/webpack": "^8.1.0",
"@types/gulp-if": "^0.0.34",
"@types/jquery": "^3.5.27",
"@types/jquery": "^3.5.29",
"@types/json-schema": "^7.0.15",
"@types/katex": "^0.16.6",
"@types/markdown-it": "^13.0.6",
"@types/katex": "^0.16.7",
"@types/markdown-it": "^13.0.7",
"@types/pickadate": "^3.5.35",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@types/redux-logger": "^3.0.12",
"@types/serviceworker": "^0.0.76",
"@types/sharedworker": "^0.0.105",
"@types/serviceworker": "^0.0.77",
"@types/sharedworker": "^0.0.106",
"@types/webpack-env": "^1.18.4",
"@vscode/codicons": "^0.0.35",
"ajv": "^8.12.0",
@ -46,13 +46,17 @@
"browser-update": "^3.3.44",
"chalk": "^5.3.0",
"classnames": "^2.3.2",
"clean-webpack-plugin": "^4.0.0",
"clipboard": "^2.0.11",
"copy-webpack-plugin": "^11.0.0",
"cordis": "2.8.8",
"css-loader": "^6.8.1",
"diff": "^5.1.0",
"diff-dom": "^5.1.0",
"diff-dom": "^5.1.2",
"echarts": "^5.4.3",
"emojis-keywords": "2.0.0",
"emojis-list": "2.1.0",
"esbuild-loader": "^4.0.2",
"fancy-log": "^2.0.0",
"flatpickr": "^4.6.13",
"graphiql": "^2.4.7",
@ -66,9 +70,11 @@
"jquery.easing": "^1.4.1",
"jquery.transit": "^0.9.12",
"matchmedia-polyfill": "^0.3.2",
"mini-css-extract-plugin": "^2.7.6",
"moment": "^2.29.4",
"monaco-editor": "0.38.0",
"monaco-editor-nls": "^3.1.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"monaco-themes": "^0.4.4",
"monaco-yaml": "^4.0.4",
"nanoid": "^5.0.3",
@ -77,6 +83,7 @@
"p-queue": "^7.4.1",
"pickadate": "^3.6.4",
"plugin-error": "^2.0.1",
"postcss-loader": "7.3.3",
"prism-themes": "^1.9.0",
"prismjs": "^1.29.0",
"prop-types": "^15.8.1",
@ -99,18 +106,27 @@
"schemastery": "^3.14.1",
"slideout": "^1.0.1",
"sticky-kit": "^1.1.3",
"style-loader": "^3.3.3",
"stylus": "^0.61.0",
"stylus-loader": "7.1.2",
"tether": "1.4.7",
"tether-drop": "^1.4.2",
"through2": "^4.0.2",
"timeago-react": "^3.0.6",
"timeago.js": "^4.0.2",
"ts-loader": "^9.5.1",
"vditor": "^3.9.6",
"vinyl-buffer": "^1.0.1",
"web-streams-polyfill": "^3.2.1"
"web-streams-polyfill": "^3.2.1",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-dev-server": "^4.15.1",
"webpack-manifest-plugin": "^5.0.0",
"webpackbar": "^5.0.2"
},
"dependencies": {
"ansi_up": "^6.0.2",
"esbuild": "0.17.10",
"esbuild": "^0.19.7",
"fs-extra": "^11.1.1",
"js-yaml": "^4.1.0",
"jsesc": "^3.0.2",

@ -9,7 +9,7 @@
"preferUnplugged": true,
"dependencies": {
"cac": "^6.7.14",
"esbuild": "0.17.10",
"esbuild": "^0.19.7",
"fs-extra": "^11.1.1",
"js-yaml": "^4.1.0",
"moment-timezone": "^0.5.43",
@ -17,7 +17,7 @@
"reggol": "^1.6.3",
"search-query-parser": "^1.6.0",
"source-map-support": "^0.5.21",
"systeminformation": "^5.21.17"
"systeminformation": "^5.21.18"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",

@ -14,7 +14,7 @@
"superagent-proxy": "^3.0.0"
},
"devDependencies": {
"@types/jsdom": "21.1.5",
"@types/jsdom": "21.1.6",
"@types/superagent-proxy": "^3.0.3"
}
}

@ -12,6 +12,8 @@ interface FetchOptions {
get?: Omit<FetchOptions, 'get' | 'post'>
}
const UA = `Hydro/${global.Hydro.version.hydrooj} VJudge/${global.Hydro.version.vjudge}`;
export class BasicFetcher {
cookie: string[] = [];
@ -26,7 +28,7 @@ export class BasicFetcher {
get(url: string) {
this.logger.debug('get', url);
url = new URL(url, this.account.endpoint || this.defaultEndpoint).toString();
let req = superagent.get(url).set('Cookie', this.cookie);
let req = superagent.get(url).set('Cookie', this.cookie).set('User-Agent', UA);
if (this.fetchOptions.headers) req = req.set(this.fetchOptions.headers);
if (this.fetchOptions.get?.headers) req = req.set(this.fetchOptions.get.headers);
return this.account.proxy ? req.proxy(this.account.proxy) : req;
@ -43,15 +45,17 @@ export class BasicFetcher {
post(url: string) {
this.logger.debug('post', url, this.cookie);
url = new URL(url, this.account.endpoint || this.defaultEndpoint).toString();
let req = superagent.post(url).set('Cookie', this.cookie).type(this.formType);
let req = superagent.post(url).set('Cookie', this.cookie).set('User-Agent', UA).type(this.formType);
if (this.fetchOptions.headers) req = req.set(this.fetchOptions.headers);
if (this.fetchOptions.post?.headers) req = req.set(this.fetchOptions.post.headers);
return this.account.proxy ? req.proxy(this.account.proxy) : req;
}
setCookie(cookie: string | string[]) {
setCookie(cookie: string | string[], save = false) {
if (typeof cookie === 'string') this.cookie = [cookie];
else this.cookie = cookie;
if (save && 'save' in this && typeof this.save === 'function') return this.save({ cookie: this.cookie });
return null;
}
setEndpoint(endpoint: string) {

@ -72,10 +72,7 @@ export default class CSGOJProvider extends BasicFetcher implements IBasicProvide
if (await this.loggedIn) return true;
logger.info('retry login');
const { header } = await this.get('/csgoj/user/login_ajax');
if (header['set-cookie']) {
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
}
if (header['set-cookie']) await this.setCookie(header['set-cookie'], true);
await this.post('/csgoj/user/login_ajax')
.set('referer', 'https://cpc.csgrandeur.cn/')
.send({

@ -2,7 +2,6 @@
/* eslint-disable no-await-in-loop */
import { PassThrough } from 'stream';
import { JSDOM } from 'jsdom';
import { } from 'superagent';
import charset from 'superagent-charset';
import proxy from 'superagent-proxy';
import {
@ -42,10 +41,7 @@ export default class HDUOJProvider extends BasicFetcher implements IBasicProvide
async getCsrfToken(url: string) {
const { header } = await this.get(url);
if (header['set-cookie']) {
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
}
if (header['set-cookie']) await this.setCookie(header['set-cookie'], true);
return '';
}
@ -69,7 +65,7 @@ export default class HDUOJProvider extends BasicFetcher implements IBasicProvide
async getProblem(id: string) {
logger.info(id);
const res = await superagent.get('/showproblem.php')
const res = await this.get('/showproblem.php')
.query({ pid: id.split('P')[1] })
.buffer(true)
.charset('gbk');
@ -197,7 +193,7 @@ export default class HDUOJProvider extends BasicFetcher implements IBasicProvide
|| STATUS.STATUS_SYSTEM_ERROR;
if (status === STATUS.STATUS_JUDGING) continue;
if (status === STATUS.STATUS_COMPILE_ERROR) {
const { text: info } = await superagent.get(`http://acm.hdu.edu.cn/viewerror.php?rid=${id}`)
const { text: info } = await this.get(`http://acm.hdu.edu.cn/viewerror.php?rid=${id}`)
.buffer(true)
.charset('gbk');
const ceInfo = new JSDOM(info);

@ -145,7 +145,7 @@ export class HUSTOJ extends BasicFetcher implements IBasicProvider {
});
console.log(res.text);
this.state.username = username;
if (res.headers['set-cookie']) this.cookie = res.headers['set-cookie'];
if (res.headers['set-cookie']) this.setCookie(res.headers['set-cookie']);
this.save({ cookie: this.cookie });
}
@ -378,7 +378,7 @@ export class YBTBAS extends YBT {
this.config.login.check = '退出登录';
this.config.login.extra = async () => {
const captcha = await this.get('/login_xx.php').responseType('arraybuffer');
if (captcha.headers['set-cookie']) this.cookie = captcha.headers['set-cookie'];
if (captcha.headers['set-cookie']) this.setCookie(captcha.headers['set-cookie']);
if (!global.parseCaptcha) await sleep(30000);
if (!global.parseCaptcha) return { login: '登录' };
return {

@ -64,10 +64,7 @@ export default class POJProvider extends BasicFetcher implements IBasicProvider
async getCsrfToken(url: string) {
const { header } = await this.get(url);
if (header['set-cookie']) {
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
}
if (header['set-cookie']) await this.setCookie(header['set-cookie']);
return '';
}

@ -39,11 +39,7 @@ export default class SPOJProvider extends BasicFetcher implements IBasicProvider
login_user: this.account.handle,
password: this.account.password,
});
const cookie = res.header['set-cookie'];
if (cookie) {
await this.save({ cookie });
this.cookie = cookie;
}
if (res.header['set-cookie']) await this.setCookie(res.header['set-cookie'], true);
if (await this.loggedIn) return true;
return false;
}

@ -31,10 +31,7 @@ export default class UOJProvider extends BasicFetcher implements IBasicProvider
async getCsrfToken(url: string) {
const { text: html, header } = await this.get(url);
if (header['set-cookie']) {
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
}
if (header['set-cookie']) await this.setCookie(header['set-cookie'], true);
let value = /_token *: *"(.+?)"/g.exec(html);
if (value) return value[1];
value = /_token" value="(.+?)"/g.exec(html);
@ -58,9 +55,10 @@ export default class UOJProvider extends BasicFetcher implements IBasicProvider
password: this.account.password,
});
if (header['set-cookie'] && this.cookie.length === 1) {
header['set-cookie'].push(...this.cookie);
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
const cookie = Array.isArray(header['set-cookie']) ? header['set-cookie'] : [header['set-cookie']];
cookie.push(...this.cookie);
await this.save({ cookie });
this.cookie = cookie;
}
if (text === 'ok') return true;
return text;

Loading…
Cancel
Save