core&ui: add contest private files (#1053)

Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
undefinedandpanda authored and GitHub committed 2025-10-17 10:24:38 +01:00
1 parent 9729346ad9
commit f5ef8b7f38
35 files changed
+781 -843

No files matched your search

+6 -2
View File
@@ -64,8 +64,12 @@ export default (logger, xff, xhost) => async (ctx: KoaContext, next: Next) => {
}
if (!response.type) {
if (response.pjax && args.pjax) {
const html = await handler.renderHTML(response.pjax, response.body);
response.body = { fragments: [{ html }] };
const pjax = typeof response.pjax === 'string' ? [[response.pjax, {}]] : response.pjax;
response.body = {
fragments: (await Promise.all(
pjax.map(async ([template, extra]) => handler.renderHTML(template, { ...response.body, ...extra })),
)).map((i) => ({ html: i })),
};
response.type = 'application/json';
} else if (
request.json || response.redirect
+1 -1
View File
@@ -82,7 +82,7 @@ export interface HydroResponse {
* If set, and pjax content was request from client,
* The template will be used for rendering.
*/
pjax?: string;
pjax?: string | (readonly [string, Record<string, any>])[];
redirect?: string;
disposition?: string;
etag?: string;