diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..2e58ecc2 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,12 @@ +image: gitpod/mongodb +tasks: + - init: yarn && yarn build +vscode: + extensions: + - dbaeumer.vscode-eslint@2.1.3:1NRvj3UKNTNwmYjptmUmIw== + - vscode-icons-team.vscode-icons@10.2.0:DrQUJPtFm0woSFiyitha8Q== +ports: + - port: 8888 + onOpen: open-preview + - port: 27017 + onOpen: open-mongodb \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 772d9684..a4136814 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,8 +1,6 @@ { "recommendations": [ "dbaeumer.vscode-eslint", - "gruntfuggly.todo-tree", - "ronnidc.nunjucks", - "sysoev.language-stylus" + "gruntfuggly.todo-tree" ] } \ No newline at end of file diff --git a/bin/hydrooj.js b/bin/hydrooj.js index cbeedc86..812a754c 100644 --- a/bin/hydrooj.js +++ b/bin/hydrooj.js @@ -9,7 +9,7 @@ const hydro = require('../dist/loader'); fs.ensureDirSync(path.resolve(os.homedir(), '.hydro')); const addonPath = path.resolve(os.homedir(), '.hydro', 'addon.json'); if (!fs.existsSync(addonPath)) fs.writeFileSync(addonPath, '[]'); -const addons = JSON.parse(fs.readFileSync(addonPath).toString()); +let addons = JSON.parse(fs.readFileSync(addonPath).toString()); try { const ui = argv.ui || '@hydrooj/ui-default'; @@ -33,6 +33,7 @@ if (argv._[0]) { } } } + addons = Array.from(new Set(addons)); console.log('Current Addons: ', addons); fs.writeFileSync(addonPath, JSON.stringify(addons, null, 2)); } diff --git a/hydro/handler/problem.ts b/hydro/handler/problem.ts index e35ac891..b1a3791f 100644 --- a/hydro/handler/problem.ts +++ b/hydro/handler/problem.ts @@ -1,4 +1,5 @@ import { isSafeInteger, flatten } from 'lodash'; +import yaml from 'js-yaml'; import { ObjectID } from 'mongodb'; import paginate from '../lib/paginate'; import { @@ -175,9 +176,12 @@ class ProblemDetailHandler extends ProblemHandler { if (this.pdoc.hidden && this.pdoc.owner !== this.user._id) { this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN); } + const config: any = this.pdoc.config ? yaml.safeLoad(this.pdoc.config) : {}; this.udoc = await user.getById(domainId, this.pdoc.owner); this.response.body = { pdoc: this.pdoc, + time: config.time, + memory: config.memory, udoc: this.udoc, title: this.pdoc.title, path: [ diff --git a/package.json b/package.json index 791245a3..93fbd54d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.9.4", + "version": "2.9.5", "main": "dist/loader.js", "bin": "bin/hydrooj.js", "repository": "https://github.com/hydro-dev/Hydro.git",