mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix pjax page
This commit is contained in:
1 parent
4cead20f0f
commit
a364519a2e
3 files changed
+7
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "4.4.3",
|
||||
"version": "4.4.4",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
|
||||
@@ -133,7 +133,7 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||
const lang = langs[this.rdoc.lang]?.pretest || this.rdoc.lang;
|
||||
this.response.body = this.rdoc.code;
|
||||
this.response.type = 'text/plain';
|
||||
this.response.disposition = `attachment; filename="${langs[lang].code_file || `foo.${this.rdoc.lang}`}"`;
|
||||
this.response.disposition = `attachment; filename="${langs[lang]?.code_file || `foo.${this.rdoc.lang}`}"`;
|
||||
}
|
||||
|
||||
@param('rid', Types.ObjectID)
|
||||
|
||||
@@ -21,7 +21,11 @@ export default (logger) => async (ctx: KoaContext, next) => {
|
||||
response.body.url = response.redirect;
|
||||
}
|
||||
if (!response.type) {
|
||||
if (
|
||||
if (response.pjax && args.pjax) {
|
||||
const html = await ctx.renderHTML(response.pjax, response.body);
|
||||
response.body = { fragments: [{ html }] };
|
||||
response.type = 'application/json';
|
||||
} else if (
|
||||
request.json || response.redirect
|
||||
|| request.query.noTemplate || !response.template) {
|
||||
// Send raw data
|
||||
@@ -35,9 +39,6 @@ export default (logger) => async (ctx: KoaContext, next) => {
|
||||
response.body = new SystemError('Serialize failure', e.message);
|
||||
}
|
||||
response.type = 'application/json';
|
||||
} else if (response.pjax && args.pjax) {
|
||||
const html = await ctx.renderHTML(response.pjax, response.body);
|
||||
response.body = { fragments: [{ html }] };
|
||||
} else if (response.template) {
|
||||
const s = response.template.split('.');
|
||||
let templateName = `${s[0]}.${args.domainId}.${s[1]}`;
|
||||
|
||||
Reference in new issue
Block a user