mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: bug fixes
This commit is contained in:
6 files changed
+10
-8
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "5.0.0-beta.4",
|
"version": "5.0.0-beta.5",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/plugin-api",
|
"main": "src/plugin-api",
|
||||||
"module": "src/plugin-api",
|
"module": "src/plugin-api",
|
||||||
|
|||||||
@@ -70,10 +70,12 @@ export async function apply(ctx: Context) {
|
|||||||
if (process.env.NODE_APP_INSTANCE === '0') {
|
if (process.env.NODE_APP_INSTANCE === '0') {
|
||||||
const staticDir = path.join(os.homedir(), '.hydro/static');
|
const staticDir = path.join(os.homedir(), '.hydro/static');
|
||||||
await fs.emptyDir(staticDir);
|
await fs.emptyDir(staticDir);
|
||||||
await Promise.all(Object.values(global.addons).map(async (f) => {
|
// Use ordered copy to allow resource override
|
||||||
|
for (const f of Object.values(global.addons)) {
|
||||||
const dir = path.join(f, 'public');
|
const dir = path.join(f, 'public');
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (await fs.pathExists(dir)) await fs.copy(dir, staticDir);
|
if (await fs.pathExists(dir)) await fs.copy(dir, staticDir);
|
||||||
}));
|
}
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
ctx.inject(['migration'], async (c) => {
|
ctx.inject(['migration'], async (c) => {
|
||||||
c.migration.registerChannel('hydrooj', require('../upgrade').coreScripts);
|
c.migration.registerChannel('hydrooj', require('../upgrade').coreScripts);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
|
|||||||
if (contest.isDone(this.tdoc) && canViewRecord) {
|
if (contest.isDone(this.tdoc) && canViewRecord) {
|
||||||
const correction = await problem.getListStatus(domainId, this.user._id, this.tdoc.pids);
|
const correction = await problem.getListStatus(domainId, this.user._id, this.tdoc.pids);
|
||||||
for (const pid in correction) {
|
for (const pid in correction) {
|
||||||
if (this.tsdoc.detail[pid]?.rid === correction[pid].rid) delete correction[pid];
|
if (this.tsdoc.detail?.[pid]?.rid === correction[pid].rid) delete correction[pid];
|
||||||
}
|
}
|
||||||
rids.push(...Object.values(correction).map((i) => i.rid));
|
rids.push(...Object.values(correction).map((i) => i.rid));
|
||||||
this.response.body.correction = correction;
|
this.response.body.correction = correction;
|
||||||
|
|||||||
@@ -43,12 +43,11 @@ export class FilesHandler extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('uid', Types.Int, true)
|
async get({ }) {
|
||||||
async get({ }, uid: number) {
|
|
||||||
if (!this.udoc._files?.length) this.checkPriv(PRIV.PRIV_CREATE_FILE);
|
if (!this.udoc._files?.length) this.checkPriv(PRIV.PRIV_CREATE_FILE);
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
files: sortFiles(this.udoc._files),
|
files: sortFiles(this.udoc._files),
|
||||||
urlForFile: (filename: string) => this.url('fs_download', { uid, filename }),
|
urlForFile: (filename: string) => this.url('fs_download', { uid: this.udoc._id, filename }),
|
||||||
};
|
};
|
||||||
this.response.pjax = 'partials/files.html';
|
this.response.pjax = 'partials/files.html';
|
||||||
this.response.template = 'home_files.html';
|
this.response.template = 'home_files.html';
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ export function apply(ctx: Context) {
|
|||||||
preload: Schema.string().default(''),
|
preload: Schema.string().default(''),
|
||||||
domainNavigation: Schema.boolean().default(true).description('Show Domain Navigation'),
|
domainNavigation: Schema.boolean().default(true).description('Show Domain Navigation'),
|
||||||
about: Schema.string().role('markdown').default(defaultAbout),
|
about: Schema.string().role('markdown').default(defaultAbout),
|
||||||
|
enableScratchpad: Schema.boolean().default(true).description('Enable Scratchpad Mode'),
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
ctx.Route('config_schema', '/manage/config/schema.json', SystemConfigSchemaHandler, PRIV.PRIV_EDIT_SYSTEM);
|
ctx.Route('config_schema', '/manage/config/schema.json', SystemConfigSchemaHandler, PRIV.PRIV_EDIT_SYSTEM);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.58.0-beta.4",
|
"version": "4.58.0-beta.5",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
|
|||||||
Reference in new issue
Block a user