mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: problemconfig: support new CompilableSource
This commit is contained in:
1 parent
4a33816a37
commit
5c9cecc197
17 files changed
+252
-228
No files matched your search
@@ -71,7 +71,6 @@ export interface HydroResponse {
|
||||
etag?: string;
|
||||
attachment: (name: string, stream?: any) => void;
|
||||
addHeader: (name: string, value: string) => void;
|
||||
serializer: typeof serializer;
|
||||
}
|
||||
export type RendererFunction = (name: string, context: Record<string, any>) => string | Promise<string>;
|
||||
type HydroContext = {
|
||||
@@ -171,7 +170,7 @@ export class HandlerCommon {
|
||||
|
||||
renderHTML(templateName: string, args: Record<string, any>) {
|
||||
const type = templateName.split('.')[1];
|
||||
const engine = this.ctx.server.renderers[type] || (() => JSON.stringify(args, this.response.serializer(false, this)));
|
||||
const engine = this.ctx.server.renderers[type] || (() => JSON.stringify(args, serializer(false, this)));
|
||||
return engine(templateName, {
|
||||
handler: this,
|
||||
UserContext: this.user,
|
||||
@@ -266,7 +265,7 @@ export class ConnectionHandler extends HandlerCommon {
|
||||
}
|
||||
|
||||
send(data: any) {
|
||||
let payload = JSON.stringify(data, this.response.serializer(false, this));
|
||||
let payload = JSON.stringify(data, serializer(false, this));
|
||||
if (this.compression) {
|
||||
if (this.counter > 1000) this.resetCompression();
|
||||
payload = this.compression.deflate(payload);
|
||||
@@ -328,7 +327,6 @@ export interface WebServiceConfig {
|
||||
host?: string;
|
||||
xff?: string;
|
||||
xhost?: string;
|
||||
serializer?: typeof serializer;
|
||||
}
|
||||
|
||||
export class WebService extends Service {
|
||||
@@ -443,7 +441,7 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
func: (t) => this.handleHttp(t, NotFoundHandler, () => true),
|
||||
},
|
||||
]));
|
||||
this.addLayer('base', base(logger, this.config.xff, this.config.xhost, this.config.serializer));
|
||||
this.addLayer('base', base(logger, this.config.xff, this.config.xhost));
|
||||
wsServer.on('connection', async (socket, request) => {
|
||||
socket.on('error', (err) => {
|
||||
logger.warn('Websocket Error: %s', err.message);
|
||||
|
||||
Reference in new issue
Block a user