改用peerdep防止multi-instance

This commit is contained in:
undefined committed 2020-09-03 12:50:01 +08:00
1 parent 7fc721676e
commit efa3faea5d
11 files changed
+49 -25

No files matched your search

+1
View File
@@ -20,6 +20,7 @@ module.exports = {
'guard-for-in': 'off',
'implicit-arrow-linebreak': 'off',
'import/extensions': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-named-as-default-member': 'off',
'import/prefer-default-export': 'off',
indent: ['warn', 4],
+13 -6
View File
@@ -4,7 +4,7 @@ import os from 'os';
import fs from 'fs-extra';
import AdmZip from 'adm-zip';
import xml2js from 'xml2js';
import { ObjectID } from 'mongodb';
import { ObjectID } from 'bson';
import { LocalProblemConfig } from 'hydrooj';
import {
Route, Handler, param, Types,
@@ -25,7 +25,7 @@ class FpsProblemImportHandler extends Handler {
} else this.response.template = 'problem_import_fps.html';
}
@param('input', Types.String, true)
@param('input', Types.String)
async post(domainId: string, input: string) {
const result = await xml2js.parseStringPromise(input);
const problem = global.Hydro.model.problem;
@@ -80,10 +80,17 @@ class FpsProblemImportHandler extends Handler {
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, []);
testdata.addFile('config.yaml', Buffer.from(`time:${config.time}\nmemory:${config.memory}`));
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}.out`, Buffer.from(p.test_output[i]));
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++) {
testdata.addFile(`${i + 1}.in`, Buffer.from(p.test_input[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`);
await new Promise((resolve, reject) => {
+6 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/fps-importer",
"version": "1.0.6",
"version": "1.0.7",
"description": "Import FPS problems",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
@@ -9,12 +9,14 @@
"dependencies": {
"adm-zip": "^0.4.16",
"fs-extra": "^9.0.1",
"hydrooj": "^2.12.22",
"mongodb": "^3.6.1",
"xml2js": "^0.4.23"
},
"devDependencies": {
"@types/xml2js": "^0.4.5"
"@types/xml2js": "^0.4.5",
"bson": "^4.1.0"
},
"peerDependencies": {
"hydrooj": "^2.12.22"
},
"scripts": {
"build": "tsc",
@@ -21,11 +21,11 @@
</button>
</div></div>
</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 }}">
<p>{{ _('Upload file') }}:
<input type="text" name="title" value="FPS_IMPORT">
<input type="text" name="redirect" value="{{ url('problem_import_fps') }}">
<input type="hidden" name="title" value="FPS_IMPORT">
<input type="hidden" name="redirect" value="{{ url('problem_import_fps') }}">
<input type="file" name="file">
<input type="submit" value="{{ _('Upload') }}" class="rounded primary button">
</p>
+4 -2
View File
@@ -1,12 +1,14 @@
{
"name": "@hydrooj/geoip",
"version": "1.1.10",
"version": "1.1.11",
"main": "package.json",
"repository": "git@github.com:hydro-dev/Hydro.git",
"author": "undefined <masnn0@outlook.com>",
"license": "MIT",
"dependencies": {
"hydrooj": "^2.12.0",
"maxmind": "^4.1.3"
},
"peerDependencies": {
"hydrooj": "^2.12.0"
}
}
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/html2md",
"version": "1.0.0",
"version": "1.0.1",
"description": "turn html into markdown",
"main": "lib.js",
"typings": "lib.d.ts",
@@ -8,7 +8,6 @@
"author": "undefined <masnn0@outlook.com>",
"license": "AGPL-3.0-only",
"dependencies": {
"hydrooj": "^2.12.22",
"jsdom": "^16.4.0",
"turndown": "^6.0.0"
},
@@ -16,6 +15,9 @@
"@types/jsdom": "^16.2.3",
"@types/turndown": "^5.0.0"
},
"peerDependencies": {
"hydrooj": "^2.12.22"
},
"scripts": {
"build": "tsc",
"lint": "eslint . --ext ts --fix"
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/login-with-github",
"version": "0.0.5",
"version": "0.0.6",
"main": "package.json",
"repository": "git@github.com:hydro-dev/Hydro.git",
"author": "undefined <masnn0@outlook.com>",
@@ -13,8 +13,10 @@
"@types/superagent": "^4.1.8",
"@types/superagent-proxy": "^2.0.0"
},
"peerDependencies": {
"hydrooj": "^2.12.1"
},
"dependencies": {
"hydrooj": "^2.12.1",
"superagent": "^6.0.0",
"superagent-proxy": "^2.0.0"
}
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/login-with-google",
"version": "0.0.5",
"version": "0.0.6",
"main": "package.json",
"repository": "git@github.com:hydro-dev/Hydro.git",
"author": "undefined <masnn0@outlook.com>",
@@ -13,8 +13,10 @@
"@types/superagent": "^4.1.8",
"@types/superagent-proxy": "^2.0.0"
},
"peerDependencies": {
"hydrooj": "^2.12.1"
},
"dependencies": {
"hydrooj": "^2.12.1",
"superagent": "^6.0.0",
"superagent-proxy": "^2.0.0"
}
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/login-with-osu",
"version": "0.0.5",
"version": "0.0.6",
"main": "package.json",
"repository": "git@github.com:hydro-dev/Hydro.git",
"author": "undefined <masnn0@outlook.com>",
@@ -13,8 +13,10 @@
"@types/superagent": "^4.1.8",
"@types/superagent-proxy": "^2.0.0"
},
"peerDependencies": {
"hydrooj": "^2.12.1"
},
"dependencies": {
"hydrooj": "^2.12.1",
"superagent": "^6.0.0",
"superagent-proxy": "^2.0.0"
}
+3 -1
View File
@@ -9,8 +9,10 @@
"lint": "eslint lib.ts service.ts --fix",
"build": "tsc"
},
"peerDependencies": {
"hydrooj": "^2.12.1"
},
"dependencies": {
"hydrooj": "^2.12.1",
"ws": "^7.3.1"
},
"devDependencies": {
+3 -1
View File
@@ -13,8 +13,10 @@
"@types/js-yaml": "^3.12.5",
"@types/mongodb": "^3.5.26"
},
"peerDependencies": {
"hydrooj": "^2.12.3"
},
"dependencies": {
"hydrooj": "^2.12.3",
"js-yaml": "^3.14.0",
"mongodb": "^3.6.0"
}