mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix UserContext json
This commit is contained in:
1 parent
6e4e2d5ecf
commit
00bc92a2e1
4 files changed
+7
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.16.4",
|
||||
"version": "3.16.5",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -12,11 +12,10 @@ const serializer = (showDisplayName = false) => (k: string, v: any) => {
|
||||
};
|
||||
|
||||
export default (logger) => async (ctx: KoaContext, next) => {
|
||||
const {
|
||||
request, response, UiContext, user, args,
|
||||
} = ctx.HydroContext;
|
||||
const { request, response } = ctx.HydroContext;
|
||||
try {
|
||||
await next();
|
||||
const { UiContext, user, args } = ctx.HydroContext;
|
||||
if (response.redirect) {
|
||||
response.body ||= {};
|
||||
response.body.url = response.redirect;
|
||||
|
||||
@@ -67,6 +67,7 @@ export async function saveConfig(config: any) {
|
||||
}
|
||||
export async function setConfig(key: string, value: any) {
|
||||
const path = key.split('.');
|
||||
if (path.filter((i) => ['__proto__', 'prototype'].includes(i)).length) throw new Error('Invalid key');
|
||||
const t = path.pop();
|
||||
let cursor = systemConfig;
|
||||
for (const p of path) {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
"main": "hydro.js",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"lint": "eslint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blueprintjs/core": "^4.9.3",
|
||||
"@fontsource/dm-mono": "^4.5.9",
|
||||
|
||||
Reference in new issue
Block a user