mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 09:36:08 +08:00
core: export HomeHandler
This commit is contained in:
1 parent
8bb072a5a4
commit
b13bf24031
5 files changed
+6
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.8.2",
|
||||
"version": "3.8.3",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -20,8 +20,8 @@ function parseParameters(fn: Function) {
|
||||
.replace(COMMENTS, '')
|
||||
.replace(ARR, '');
|
||||
const result = code.slice(code.indexOf('(') + 1, code.indexOf(')'))
|
||||
.match(/([^,]+)/g).map((i) => i.trim());
|
||||
return result === null ? [] : result;
|
||||
.match(/([^,]+)/g)?.map((i) => i.trim());
|
||||
return result ?? [];
|
||||
}
|
||||
|
||||
async function runScript(name: string, arg: any) {
|
||||
|
||||
@@ -58,7 +58,7 @@ class DomainRankHandler extends Handler {
|
||||
@query('page', Types.PositiveInt, true)
|
||||
async get(domainId: string, page = 1) {
|
||||
const [dudocs, upcount, ucount] = await paginate(
|
||||
domain.getMultiUserInDomain(domainId, { uid: { $gt: 1 } }).sort({ rp: -1 }),
|
||||
domain.getMultiUserInDomain(domainId, { uid: { $gt: 1 }, rp: { $gt: 0 } }).sort({ rp: -1 }),
|
||||
page,
|
||||
100,
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
|
||||
const { geoip, useragent } = global.Hydro.lib;
|
||||
|
||||
class HomeHandler extends Handler {
|
||||
export class HomeHandler extends Handler {
|
||||
uids = new Set<number>();
|
||||
|
||||
collectUser(uids: number[]) {
|
||||
|
||||
@@ -99,7 +99,7 @@ export const RpTypes: Record<string, RpDef> = {
|
||||
global.Hydro.model.rp = RpTypes;
|
||||
|
||||
export async function calcLevel(domainId: string, report: Function) {
|
||||
const filter = { rp: { $exists: true } };
|
||||
const filter = { rp: { $gt: 0 } };
|
||||
const ducnt = await domain.getMultiUserInDomain(domainId, filter).count();
|
||||
await domain.setMultiUserInDomain(domainId, {}, { level: 0, rank: null });
|
||||
if (!ducnt) return;
|
||||
|
||||
Reference in new issue
Block a user