mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 17:38:19 +08:00
core: fix #109
This commit is contained in:
1 parent
31f7d9a643
commit
b49a2fde74
4 files changed
+4
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.23.15",
|
||||
"version": "2.23.16",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -250,7 +250,7 @@ class HomeSettingsHandler extends Handler {
|
||||
const settings = args.category === 'domain' ? setting.DOMAIN_USER_SETTINGS_BY_KEY : setting.SETTINGS_BY_KEY;
|
||||
for (const key in args) {
|
||||
const val = set(settings[key], key, args[key]);
|
||||
if (val) $set[key] = val;
|
||||
if (val !== undefined) $set[key] = val;
|
||||
}
|
||||
for (const key in booleanKeys) if (!args[key]) $set[key] = false;
|
||||
await setter($set);
|
||||
|
||||
@@ -20,7 +20,7 @@ class RecordModel {
|
||||
const pending = await task.count({ uid });
|
||||
const timeRecent = await RecordModel.coll
|
||||
.find({ _id: { $gte: Time.getObjectID(moment().add(-1, 'hour')) }, uid }).project({ time: 1 }).toArray();
|
||||
return -(pending * (sum(timeRecent) / 1000));
|
||||
return -(pending * (sum(timeRecent.map((i) => i.time || 0)) / 1000));
|
||||
}
|
||||
|
||||
static async get(domainId: string, _id: ObjectID): Promise<Rdoc | null> {
|
||||
|
||||
@@ -445,7 +445,7 @@ export class Handler extends HandlerCommon {
|
||||
this.session = {};
|
||||
const [xff, xhost] = system.getMany(['server.xff', 'server.xhost']);
|
||||
if (xff) this.request.ip = this.request.headers[xff.toLowerCase()] || this.request.ip;
|
||||
if (xhost) this.request.hostname = this.request.headers[xhost.toLowerCase()] || this.request.hostname;
|
||||
if (xhost) this.request.host = this.request.headers[xhost.toLowerCase()] || this.request.host;
|
||||
this.noCheckPermView = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user