core: dump UiContext & UserContext

This commit is contained in:
undefined committed 2021-06-29 19:25:43 +08:00
1 parent 900cce3614
commit a33708cd21
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.29.2",
"version": "2.29.3",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+4
View File
@@ -558,6 +558,10 @@ export class Handler extends HandlerCommon {
this.request.json || this.response.redirect
|| this.request.query.noTemplate || !this.response.template) {
try {
if (typeof this.response.body === 'object') {
this.response.body.UiContext = this.UiContext;
this.response.body.UserContext = this.user;
}
this.response.body = JSON.stringify(this.response.body, serializer);
} catch (e) {
this.response.body = new SystemError('Serialize failure', e.message);