mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
w: upgrade deps
This commit is contained in:
1 parent
47499bdcd6
commit
0824487342
19 files changed
+132
-88
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.2.19",
|
||||
"version": "3.2.20",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
@@ -14,15 +14,15 @@
|
||||
"dependencies": {
|
||||
"@graphql-tools/schema": "^8.3.1",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"adm-zip": "0.5.5",
|
||||
"adm-zip": "0.5.9",
|
||||
"ansi_up": "^5.1.0",
|
||||
"cac": "^6.7.12",
|
||||
"cookies": "^0.8.0",
|
||||
"detect-browser": "^5.2.1",
|
||||
"esbuild": "^0.13.15",
|
||||
"detect-browser": "^5.3.0",
|
||||
"esbuild": "0.14.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
"graphql": "^15.7.2",
|
||||
"graphql-scalars": "1.13.6",
|
||||
"graphql": "^16.1.0",
|
||||
"graphql-scalars": "1.14.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"koa": "^2.13.4",
|
||||
"koa-body": "^4.2.0",
|
||||
@@ -33,16 +33,16 @@
|
||||
"lodash": "^4.17.21",
|
||||
"lru-cache": "^6.0.0",
|
||||
"mime-types": "^2.1.34",
|
||||
"minio": "7.0.19",
|
||||
"minio": "7.0.25",
|
||||
"moment-timezone": "^0.5.34",
|
||||
"mongodb": "^3.7.3",
|
||||
"nanoid": "^3.1.30",
|
||||
"nodemailer": "^6.7.1",
|
||||
"nodemailer": "^6.7.2",
|
||||
"notp": "^2.0.3",
|
||||
"p-queue": "^7.1.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"serialize-javascript": "^6.0.0",
|
||||
"sockjs": "^0.3.21",
|
||||
"sockjs": "^0.3.24",
|
||||
"source-map-support": "^0.5.21",
|
||||
"superagent": "^6.1.0",
|
||||
"thirty-two": "^1.0.2",
|
||||
@@ -56,7 +56,7 @@
|
||||
"@types/koa-compress": "^4.0.3",
|
||||
"@types/koa-router": "^7.4.4",
|
||||
"@types/koa-static-cache": "^5.1.1",
|
||||
"@types/lodash": "^4.14.177",
|
||||
"@types/lodash": "^4.14.178",
|
||||
"@types/lru-cache": "^5.1.1",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"@types/minio": "^7.0.11",
|
||||
@@ -67,7 +67,6 @@
|
||||
"@types/sockjs": "^0.3.33",
|
||||
"@types/source-map-support": "^0.5.4",
|
||||
"@types/superagent": "^4.1.13",
|
||||
"formidable": "^1.2.6",
|
||||
"moment": "^2.29.1",
|
||||
"pm2": "^5.1.2"
|
||||
},
|
||||
|
||||
@@ -94,9 +94,14 @@ bus.on('app/started', () => {
|
||||
});
|
||||
|
||||
class ApiHandler extends Handler {
|
||||
async query(q: string, variables: any) {
|
||||
// FIXME validation for fields like ObjectID doesn't work.
|
||||
return graphql(schema, q, root, this, variables);
|
||||
query(q: string, variables: any) {
|
||||
return graphql({
|
||||
schema,
|
||||
source: q,
|
||||
rootValue: root,
|
||||
contextValue: this,
|
||||
variableValues: variables,
|
||||
});
|
||||
}
|
||||
|
||||
async get() {
|
||||
|
||||
@@ -105,14 +105,9 @@ class DomainUserHandler extends ManageHandler {
|
||||
rudocs[ud.role || 'default'].push(ud);
|
||||
}
|
||||
const rolesSelect = roles.map((role) => [role._id, role._id]);
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['domain', null],
|
||||
['domain_user', null],
|
||||
];
|
||||
this.response.template = 'domain_user.html';
|
||||
this.response.body = {
|
||||
roles, rolesSelect, rudocs, udict, path, domain: this.domain,
|
||||
roles, rolesSelect, rudocs, udict, domain: this.domain,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -134,14 +129,9 @@ class DomainUserHandler extends ManageHandler {
|
||||
class DomainPermissionHandler extends ManageHandler {
|
||||
async get({ domainId }) {
|
||||
const roles = await domain.getRoles(domainId);
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['domain', null],
|
||||
['domain_permission', null],
|
||||
];
|
||||
this.response.template = 'domain_permission.html';
|
||||
this.response.body = {
|
||||
roles, PERMS_BY_FAMILY, domain: this.domain, path, log2,
|
||||
roles, PERMS_BY_FAMILY, domain: this.domain, log2,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -179,10 +169,8 @@ class DomainRoleHandler extends ManageHandler {
|
||||
|
||||
@param('roles', Types.Array)
|
||||
async postDelete(domainId: string, roles: string[]) {
|
||||
for (const role of roles) {
|
||||
if (['root', 'default', 'guest'].includes(role)) {
|
||||
throw new ValidationError('role');
|
||||
}
|
||||
if (Set.intersection(new Set(roles), new Set(['root', 'default', 'guest'])).size > 0) {
|
||||
throw new ValidationError('role', null, 'You cannot delete root, default or guest roles');
|
||||
}
|
||||
await domain.deleteRoles(domainId, roles);
|
||||
this.back();
|
||||
|
||||
@@ -24,16 +24,12 @@ async function getStatus() {
|
||||
|
||||
class StatusHandler extends Handler {
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['status', null],
|
||||
];
|
||||
const stats = await getStatus();
|
||||
for (const stat of stats) {
|
||||
if (!stat.battery.hasBattery) stat.battery = 'No battery';
|
||||
else stat.battery = `${stat.battery.type} ${stat.battery.model} ${stat.battery.percent}%${stat.battery.isCharging ? ' Charging' : ''}`;
|
||||
}
|
||||
this.response.body = { stats, path };
|
||||
this.response.body = { stats };
|
||||
this.response.template = 'status.html';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type fs from 'fs';
|
||||
import type * as Koa from 'koa';
|
||||
import type { Dictionary, NumericDictionary } from 'lodash';
|
||||
import type { ItemBucketMetadata } from 'minio';
|
||||
import type { Cursor, ObjectID } from 'mongodb';
|
||||
@@ -682,10 +681,3 @@ declare global {
|
||||
var Hydro: HydroGlobal; // eslint-disable-line
|
||||
var addons: string[]; // eslint-disable-line
|
||||
}
|
||||
|
||||
declare module 'koa' {
|
||||
interface Request extends Koa.BaseRequest {
|
||||
body?: any;
|
||||
files?: import('formidable').Files;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,6 @@ class DomainModel {
|
||||
@ArgMethod
|
||||
static async getList(domainIds: string[]) {
|
||||
const r: Record<string, DomainDoc | null> = {};
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const tasks = [];
|
||||
for (const domainId of domainIds) tasks.push(DomainModel.get(domainId).then((ddoc) => { r[domainId] = ddoc; }));
|
||||
await Promise.all(tasks);
|
||||
@@ -146,12 +145,11 @@ class DomainModel {
|
||||
}
|
||||
}
|
||||
if (count) {
|
||||
for (const role of roles) {
|
||||
if (!['default', 'guest'].includes(role._id)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
role.count = await DomainModel.countUser(ddoc._id, role._id);
|
||||
}
|
||||
}
|
||||
await Promise.all(roles.map(async (role) => {
|
||||
if (['default', 'guest'].includes(role._id)) return role;
|
||||
role.count = await DomainModel.countUser(ddoc._id, role._id);
|
||||
return role;
|
||||
}));
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ export type NumberKeys<O> = {
|
||||
export type ArrayKeys<O, P = any> = {
|
||||
[K in keyof O]: P[] extends O[K] ? K : never
|
||||
}[keyof O];
|
||||
export type NestKeys<O, T = any, S = any[]> = O extends object ? O extends S ? never : {
|
||||
[K in keyof O]: (O[K] extends T ? K : never) | `${K & string}.${NestKeys<O[K], T, S | O>}`
|
||||
}[keyof O] & string : never;
|
||||
export type Value<O, V = ''> = {
|
||||
[K in keyof O]: V
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user