mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
改用peerdep防止multi-instance
This commit is contained in:
1 parent
7fc721676e
commit
efa3faea5d
11 files changed
+46
-22
No files matched your search
@@ -20,6 +20,7 @@ module.exports = {
|
|||||||
'guard-for-in': 'off',
|
'guard-for-in': 'off',
|
||||||
'implicit-arrow-linebreak': 'off',
|
'implicit-arrow-linebreak': 'off',
|
||||||
'import/extensions': 'off',
|
'import/extensions': 'off',
|
||||||
|
'import/no-extraneous-dependencies': 'off',
|
||||||
'import/no-named-as-default-member': 'off',
|
'import/no-named-as-default-member': 'off',
|
||||||
'import/prefer-default-export': 'off',
|
'import/prefer-default-export': 'off',
|
||||||
indent: ['warn', 4],
|
indent: ['warn', 4],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import os from 'os';
|
|||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import AdmZip from 'adm-zip';
|
import AdmZip from 'adm-zip';
|
||||||
import xml2js from 'xml2js';
|
import xml2js from 'xml2js';
|
||||||
import { ObjectID } from 'mongodb';
|
import { ObjectID } from 'bson';
|
||||||
import { LocalProblemConfig } from 'hydrooj';
|
import { LocalProblemConfig } from 'hydrooj';
|
||||||
import {
|
import {
|
||||||
Route, Handler, param, Types,
|
Route, Handler, param, Types,
|
||||||
@@ -25,7 +25,7 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
} else this.response.template = 'problem_import_fps.html';
|
} else this.response.template = 'problem_import_fps.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('input', Types.String, true)
|
@param('input', Types.String)
|
||||||
async post(domainId: string, input: string) {
|
async post(domainId: string, input: string) {
|
||||||
const result = await xml2js.parseStringPromise(input);
|
const result = await xml2js.parseStringPromise(input);
|
||||||
const problem = global.Hydro.model.problem;
|
const problem = global.Hydro.model.problem;
|
||||||
@@ -80,11 +80,18 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
memory: p.memory_limit[0]._ + p.memory_limit[0].$.unit,
|
memory: p.memory_limit[0]._ + p.memory_limit[0].$.unit,
|
||||||
};
|
};
|
||||||
const pid = await problem.add(domainId, null, p.title.join(' '), content.join('\n'), this.user._id, p.source, []);
|
const pid = await problem.add(domainId, null, p.title.join(' '), content.join('\n'), this.user._id, p.source, []);
|
||||||
testdata.addFile('config.yaml', Buffer.from(`time:${config.time}\nmemory:${config.memory}`));
|
testdata.addFile('config.yaml', Buffer.from(`time: ${config.time}\nmemory: ${config.memory}`));
|
||||||
|
if (p.test_output) {
|
||||||
for (let i = 0; i < p.test_input.length; i++) {
|
for (let i = 0; i < p.test_input.length; i++) {
|
||||||
testdata.addFile(`${i + 1}.in`, Buffer.from(p.test_input[i]));
|
testdata.addFile(`${i + 1}.in`, Buffer.from(p.test_input[i]));
|
||||||
testdata.addFile(`${i + 1}.out`, Buffer.from(p.test_output[i]));
|
testdata.addFile(`${i + 1}.out`, Buffer.from(p.test_output[i]));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < p.test_input.length / 2; i++) {
|
||||||
|
testdata.addFile(`${i + 1}.in`, Buffer.from(p.test_input[2 * i]));
|
||||||
|
testdata.addFile(`${i + 1}.out`, Buffer.from(p.test_input[2 * i + 1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
const f = path.resolve(os.tmpdir(), 'hydro', `${Math.random()}.zip`);
|
const f = path.resolve(os.tmpdir(), 'hydro', `${Math.random()}.zip`);
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
testdata.writeZip(f, (err) => {
|
testdata.writeZip(f, (err) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/fps-importer",
|
"name": "@hydrooj/fps-importer",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"description": "Import FPS problems",
|
"description": "Import FPS problems",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
@@ -9,12 +9,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "^0.4.16",
|
"adm-zip": "^0.4.16",
|
||||||
"fs-extra": "^9.0.1",
|
"fs-extra": "^9.0.1",
|
||||||
"hydrooj": "^2.12.22",
|
|
||||||
"mongodb": "^3.6.1",
|
|
||||||
"xml2js": "^0.4.23"
|
"xml2js": "^0.4.23"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/xml2js": "^0.4.5"
|
"@types/xml2js": "^0.4.5",
|
||||||
|
"bson": "^4.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.22"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</div></div>
|
</div></div>
|
||||||
</form>
|
</form>
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data" action="{{ url('file_upload') }}">
|
||||||
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
||||||
<p>{{ _('Upload file') }}:
|
<p>{{ _('Upload file') }}:
|
||||||
<input type="text" name="title" value="FPS_IMPORT">
|
<input type="hidden" name="title" value="FPS_IMPORT">
|
||||||
<input type="text" name="redirect" value="{{ url('problem_import_fps') }}">
|
<input type="hidden" name="redirect" value="{{ url('problem_import_fps') }}">
|
||||||
<input type="file" name="file">
|
<input type="file" name="file">
|
||||||
<input type="submit" value="{{ _('Upload') }}" class="rounded primary button">
|
<input type="submit" value="{{ _('Upload') }}" class="rounded primary button">
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/geoip",
|
"name": "@hydrooj/geoip",
|
||||||
"version": "1.1.10",
|
"version": "1.1.11",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.0",
|
|
||||||
"maxmind": "^4.1.3"
|
"maxmind": "^4.1.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/html2md",
|
"name": "@hydrooj/html2md",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "turn html into markdown",
|
"description": "turn html into markdown",
|
||||||
"main": "lib.js",
|
"main": "lib.js",
|
||||||
"typings": "lib.d.ts",
|
"typings": "lib.d.ts",
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.22",
|
|
||||||
"jsdom": "^16.4.0",
|
"jsdom": "^16.4.0",
|
||||||
"turndown": "^6.0.0"
|
"turndown": "^6.0.0"
|
||||||
},
|
},
|
||||||
@@ -16,6 +15,9 @@
|
|||||||
"@types/jsdom": "^16.2.3",
|
"@types/jsdom": "^16.2.3",
|
||||||
"@types/turndown": "^5.0.0"
|
"@types/turndown": "^5.0.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.22"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint": "eslint . --ext ts --fix"
|
"lint": "eslint . --ext ts --fix"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/login-with-github",
|
"name": "@hydrooj/login-with-github",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
@@ -13,8 +13,10 @@
|
|||||||
"@types/superagent": "^4.1.8",
|
"@types/superagent": "^4.1.8",
|
||||||
"@types/superagent-proxy": "^2.0.0"
|
"@types/superagent-proxy": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.1"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.1",
|
|
||||||
"superagent": "^6.0.0",
|
"superagent": "^6.0.0",
|
||||||
"superagent-proxy": "^2.0.0"
|
"superagent-proxy": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/login-with-google",
|
"name": "@hydrooj/login-with-google",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
@@ -13,8 +13,10 @@
|
|||||||
"@types/superagent": "^4.1.8",
|
"@types/superagent": "^4.1.8",
|
||||||
"@types/superagent-proxy": "^2.0.0"
|
"@types/superagent-proxy": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.1"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.1",
|
|
||||||
"superagent": "^6.0.0",
|
"superagent": "^6.0.0",
|
||||||
"superagent-proxy": "^2.0.0"
|
"superagent-proxy": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/login-with-osu",
|
"name": "@hydrooj/login-with-osu",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
@@ -13,8 +13,10 @@
|
|||||||
"@types/superagent": "^4.1.8",
|
"@types/superagent": "^4.1.8",
|
||||||
"@types/superagent-proxy": "^2.0.0"
|
"@types/superagent-proxy": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.1"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.1",
|
|
||||||
"superagent": "^6.0.0",
|
"superagent": "^6.0.0",
|
||||||
"superagent-proxy": "^2.0.0"
|
"superagent-proxy": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@
|
|||||||
"lint": "eslint lib.ts service.ts --fix",
|
"lint": "eslint lib.ts service.ts --fix",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.1"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.1",
|
|
||||||
"ws": "^7.3.1"
|
"ws": "^7.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -13,8 +13,10 @@
|
|||||||
"@types/js-yaml": "^3.12.5",
|
"@types/js-yaml": "^3.12.5",
|
||||||
"@types/mongodb": "^3.5.26"
|
"@types/mongodb": "^3.5.26"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hydrooj": "^2.12.3"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hydrooj": "^2.12.3",
|
|
||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^3.14.0",
|
||||||
"mongodb": "^3.6.0"
|
"mongodb": "^3.6.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user