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

@ -35,22 +35,22 @@ const newPath = path.resolve(os.homedir(), '.hydro', 'judge.yaml');
const config = global.Hydro const config = global.Hydro
? JudgeSettings({}) ? JudgeSettings({})
: (() => { : (() => {
const cfg = JudgeSettings({}); const base: any = {};
const configFilePath = (process.env.CONFIG_FILE || argv.options.config)
? path.resolve(process.env.CONFIG_FILE || argv.options.config)
: fs.existsSync(oldPath) ? oldPath : newPath;
if (process.env.TEMP_DIR || argv.options.tmp) { if (process.env.TEMP_DIR || argv.options.tmp) {
cfg.tmp_dir = path.resolve(process.env.TEMP_DIR || argv.options.tmp); base.tmp_dir = path.resolve(process.env.TEMP_DIR || argv.options.tmp);
} }
if (process.env.CACHE_DIR || argv.options.cache) { if (process.env.CACHE_DIR || argv.options.cache) {
cfg.cache_dir = path.resolve(process.env.CACHE_DIR || argv.options.cache); base.cache_dir = path.resolve(process.env.CACHE_DIR || argv.options.cache);
} }
if (process.env.EXECUTION_HOST || argv.options.sandbox) { if (process.env.EXECUTION_HOST || argv.options.sandbox) {
cfg.sandbox_host = path.resolve(process.env.EXECUTION_HOST || argv.options.sandbox); base.sandbox_host = path.resolve(process.env.EXECUTION_HOST || argv.options.sandbox);
} }
const configFilePath = (process.env.CONFIG_FILE || argv.options.config)
? path.resolve(process.env.CONFIG_FILE || argv.options.config)
: fs.existsSync(oldPath) ? oldPath : newPath;
const configFile = fs.readFileSync(configFilePath, 'utf-8'); const configFile = fs.readFileSync(configFilePath, 'utf-8');
Object.assign(cfg, yaml.load(configFile) as any); Object.assign(base, yaml.load(configFile) as any);
const cfg = JudgeSettings(base);
return JudgeSettings(cfg); return JudgeSettings(cfg);
})(); })();

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

@ -46,7 +46,7 @@ function _descriptor(v: ParamOption<any>) {
obj.value = function validate(this: Handler, rawArgs: any, ...extra: any[]) { obj.value = function validate(this: Handler, rawArgs: any, ...extra: any[]) {
if (typeof rawArgs !== 'object' || extra.length) return originalMethod.call(this, rawArgs, ...extra); if (typeof rawArgs !== 'object' || extra.length) return originalMethod.call(this, rawArgs, ...extra);
const c = []; const c = [];
const arglist: ParamOption<any>[] = this.__param[target.constructor.name][funcName]; const arglist: ParamOption<any>[] = target.__param[target.constructor.name][funcName];
for (const item of arglist) { for (const item of arglist) {
const src = item.source === 'all' const src = item.source === 'all'
? rawArgs ? rawArgs

@ -1,7 +1,7 @@
/* eslint-disable global-require */ /* eslint-disable global-require */
import { CleanWebpackPlugin } from 'clean-webpack-plugin'; import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin';
import { ESBuildMinifyPlugin } from 'esbuild-loader'; import { EsbuildPlugin } from 'esbuild-loader';
import { DuplicatesPlugin } from 'inspectpack/plugin'; import { DuplicatesPlugin } from 'inspectpack/plugin';
import ExtractCssPlugin from 'mini-css-extract-plugin'; import ExtractCssPlugin from 'mini-css-extract-plugin';
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'; import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
@ -214,7 +214,7 @@ export default function (env: { watch?: boolean, production?: boolean, measure?:
}, },
}, },
usedExports: true, usedExports: true,
minimizer: [new ESBuildMinifyPlugin({ minimizer: [new EsbuildPlugin({
css: true, css: true,
minify: true, minify: true,
minifySyntax: true, minifySyntax: true,

@ -2,7 +2,7 @@ import ReconnectingWebSocket from 'reconnecting-websocket';
export default class Sock { export default class Sock {
sock: ReconnectingWebSocket; sock: ReconnectingWebSocket;
interval: number; interval: NodeJS.Timeout;
constructor(public url: string, nocookie = false) { constructor(public url: string, nocookie = false) {
const i = new URL(url, window.location.href); const i = new URL(url, window.location.href);

Loading…
Cancel
Save