mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: update renderer interface
This commit is contained in:
4 files changed
+45
-46
No files matched your search
@@ -768,7 +768,6 @@ export interface Lib extends Record<string, any> {
|
||||
rank: typeof import('./lib/rank');
|
||||
rating: typeof import('./lib/rating');
|
||||
testdataConfig: typeof import('./lib/testdataConfig');
|
||||
template?: any;
|
||||
problemSearch: ProblemSearch;
|
||||
}
|
||||
|
||||
@@ -788,6 +787,7 @@ export interface ModuleInterfaces {
|
||||
callback: (this: Handler, args: Record<string, any>) => Promise<OAuthUserResponse>;
|
||||
};
|
||||
hash: (password: string, salt: string, user: User) => boolean | string;
|
||||
render: (name: string, state: any) => Promise<string>;
|
||||
}
|
||||
|
||||
export interface HydroGlobal {
|
||||
|
||||
@@ -14,7 +14,8 @@ export default (router, logger) => async (ctx: KoaContext, next) => {
|
||||
avatar: avatar(user?.avatar || '', 128),
|
||||
viewLang: ctx.translate('__id'),
|
||||
};
|
||||
const engine = global.Hydro.lib.template?.render
|
||||
const type = templateName.split('.')[1];
|
||||
const engine = global.Hydro.module.render[type]
|
||||
|| (() => JSON.stringify(args, serializer({
|
||||
showDisplayName: user?.hasPerm(PERM.PERM_VIEW_DISPLAYNAME),
|
||||
})));
|
||||
|
||||
Reference in new issue
Block a user