mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core&ui: add contest private files (#1053)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
9729346ad9
commit
f5ef8b7f38
35 files changed
+781
-843
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user