mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
add user_dropdown
This commit is contained in:
1 parent
5dc87c599c
commit
7ceb8fc028
9 files changed
+23
-12
No files matched your search
+3
-3
@@ -25,16 +25,16 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||||
"@typescript-eslint/parser": "^3.9.1",
|
"@typescript-eslint/parser": "^3.9.1",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
"eslint": "^7.9.0",
|
"eslint": "^7.10.0",
|
||||||
"eslint-config-airbnb-base": "^14.2.0",
|
"eslint-config-airbnb-base": "^14.2.0",
|
||||||
"eslint-import-resolver-typescript": "^2.3.0",
|
"eslint-import-resolver-typescript": "^2.3.0",
|
||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"globby": "^11.0.1",
|
"globby": "^11.0.1",
|
||||||
"jest": "^26.4.2",
|
"jest": "^26.4.2",
|
||||||
"latest-version": "^5.1.0",
|
"latest-version": "^5.1.0",
|
||||||
"ora": "^5.1.0",
|
"ora": "^5.1.0",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
"ts-jest": "^26.4.0",
|
"ts-jest": "^26.4.1",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"author": "undefined <masnn0@outlook.com>",
|
"author": "undefined <masnn0@outlook.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"maxmind": "^4.1.3"
|
"maxmind": "^4.2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "./prepublish.sh"
|
"prepublish": "./prepublish.sh"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"p-queue": "^6.6.1",
|
"p-queue": "^6.6.1",
|
||||||
"shell-quote": "^1.7.2",
|
"shell-quote": "^1.7.2",
|
||||||
"systeminformation": "^4.27.5"
|
"systeminformation": "^4.27.6"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"hydrooj": "^2.13.3"
|
"hydrooj": "^2.13.3"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.22",
|
"version": "2.13.23",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
@@ -25,13 +25,13 @@
|
|||||||
"lru-cache": "^6.0.0",
|
"lru-cache": "^6.0.0",
|
||||||
"moment-timezone": "^0.5.31",
|
"moment-timezone": "^0.5.31",
|
||||||
"mongodb": "^3.6.2",
|
"mongodb": "^3.6.2",
|
||||||
"nodemailer": "^6.4.10",
|
"nodemailer": "^6.4.13",
|
||||||
"ps-list": "^7.2.0",
|
"ps-list": "^7.2.0",
|
||||||
"serialize-javascript": "^5.0.1",
|
"serialize-javascript": "^5.0.1",
|
||||||
"sockjs": "^0.3.20",
|
"sockjs": "^0.3.20",
|
||||||
"superagent": "^6.1.0",
|
"superagent": "^6.1.0",
|
||||||
"supports-color": "^7.2.0",
|
"supports-color": "^7.2.0",
|
||||||
"systeminformation": "^4.27.5",
|
"systeminformation": "^4.27.6",
|
||||||
"yargs": "^16.0.3"
|
"yargs": "^16.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
import { Readable, Writable } from 'stream';
|
import { Readable, Writable } from 'stream';
|
||||||
import { ObjectID, GridFSBucket } from 'mongodb';
|
import { ObjectID } from 'mongodb';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Dictionary, NumericDictionary } from 'lodash';
|
import { Dictionary, NumericDictionary } from 'lodash';
|
||||||
|
|
||||||
@@ -532,9 +532,11 @@ export interface UI {
|
|||||||
nodes: {
|
nodes: {
|
||||||
nav: any[],
|
nav: any[],
|
||||||
problem_add: any[],
|
problem_add: any[],
|
||||||
|
user_dropdown: any[],
|
||||||
},
|
},
|
||||||
Nav: typeof import('./lib/ui').Nav,
|
Nav: typeof import('./lib/ui').Nav,
|
||||||
ProblemAdd: typeof import('./lib/ui').ProblemAdd,
|
ProblemAdd: typeof import('./lib/ui').ProblemAdd,
|
||||||
|
UserDropdown: typeof import('./lib/ui').UserDropdown,
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ export const ProblemAdd = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const UserDropdown = (
|
||||||
|
name: string, args: Dictionary<any> = {}, ...permPrivChecker: Array<number | bigint | Function>
|
||||||
|
) => {
|
||||||
|
global.Hydro.ui.nodes.user_dropdown.push({
|
||||||
|
name, args: args || {}, checker: buildChecker(...permPrivChecker),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Nav('homepage', {}, 'homepage');
|
Nav('homepage', {}, 'homepage');
|
||||||
Nav('problem_main', {}, 'problem', PERM.PERM_VIEW_PROBLEM);
|
Nav('problem_main', {}, 'problem', PERM.PERM_VIEW_PROBLEM);
|
||||||
Nav('training_main', {}, 'training', PERM.PERM_VIEW_TRAINING);
|
Nav('training_main', {}, 'training', PERM.PERM_VIEW_TRAINING);
|
||||||
@@ -71,3 +79,4 @@ ProblemAdd('problem_import_syzoj', {}, 'copy', 'Import From SYZOJ');
|
|||||||
|
|
||||||
global.Hydro.ui.Nav = Nav;
|
global.Hydro.ui.Nav = Nav;
|
||||||
global.Hydro.ui.ProblemAdd = ProblemAdd;
|
global.Hydro.ui.ProblemAdd = ProblemAdd;
|
||||||
|
global.Hydro.ui.UserDropdown = UserDropdown;
|
||||||
@@ -30,6 +30,7 @@ if (!global.Hydro) {
|
|||||||
nodes: {
|
nodes: {
|
||||||
nav: [],
|
nav: [],
|
||||||
problem_add: [],
|
problem_add: [],
|
||||||
|
user_dropdown: [],
|
||||||
},
|
},
|
||||||
template: {},
|
template: {},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'hydrooj';
|
import 'hydrooj';
|
||||||
import 'hydrooj/src/utils';
|
import 'hydrooj/src/utils';
|
||||||
import md5 from 'hydrooj/src/lib/md5';
|
import { md5, sha1 } from 'hydrooj/src/lib/crypto';
|
||||||
import sha1 from 'hydrooj/src/lib/sha1';
|
|
||||||
import pwhash from 'hydrooj/src/lib/hash.hydro';
|
import pwhash from 'hydrooj/src/lib/hash.hydro';
|
||||||
|
|
||||||
describe('crypto', () => {
|
describe('crypto', () => {
|
||||||
|
|||||||
@@ -16,6 +16,6 @@
|
|||||||
"ws": "^7.3.1"
|
"ws": "^7.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/ws": "^7.2.6"
|
"@types/ws": "^7.2.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user