add user_dropdown

This commit is contained in:
undefined committed 2020-10-02 20:13:51 +08:00
1 parent 5dc87c599c
commit 7ceb8fc028
9 files changed
+23 -12

No files matched your search

+3 -3
View File
@@ -25,16 +25,16 @@
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"cross-spawn": "^7.0.3",
"eslint": "^7.9.0",
"eslint": "^7.10.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.22.1",
"globby": "^11.0.1",
"jest": "^26.4.2",
"latest-version": "^5.1.0",
"ora": "^5.1.0",
"semver": "^7.3.2",
"ts-jest": "^26.4.0",
"ts-jest": "^26.4.1",
"typescript": "^4.0.3"
},
"dependencies": {
+1 -1
View File
@@ -6,7 +6,7 @@
"author": "undefined <masnn0@outlook.com>",
"license": "MIT",
"dependencies": {
"maxmind": "^4.1.3"
"maxmind": "^4.2.0"
},
"scripts": {
"prepublish": "./prepublish.sh"
+1 -1
View File
@@ -14,7 +14,7 @@
"lodash": "^4.17.20",
"p-queue": "^6.6.1",
"shell-quote": "^1.7.2",
"systeminformation": "^4.27.5"
"systeminformation": "^4.27.6"
},
"peerDependencies": {
"hydrooj": "^2.13.3"
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.13.22",
"version": "2.13.23",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
@@ -25,13 +25,13 @@
"lru-cache": "^6.0.0",
"moment-timezone": "^0.5.31",
"mongodb": "^3.6.2",
"nodemailer": "^6.4.10",
"nodemailer": "^6.4.13",
"ps-list": "^7.2.0",
"serialize-javascript": "^5.0.1",
"sockjs": "^0.3.20",
"superagent": "^6.1.0",
"supports-color": "^7.2.0",
"systeminformation": "^4.27.5",
"systeminformation": "^4.27.6",
"yargs": "^16.0.3"
},
"devDependencies": {
+3 -1
View File
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Readable, Writable } from 'stream';
import { ObjectID, GridFSBucket } from 'mongodb';
import { ObjectID } from 'mongodb';
import fs from 'fs';
import { Dictionary, NumericDictionary } from 'lodash';
@@ -532,9 +532,11 @@ export interface UI {
nodes: {
nav: any[],
problem_add: any[],
user_dropdown: any[],
},
Nav: typeof import('./lib/ui').Nav,
ProblemAdd: typeof import('./lib/ui').ProblemAdd,
UserDropdown: typeof import('./lib/ui').UserDropdown,
}
declare global {
+9
View File
@@ -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('problem_main', {}, 'problem', PERM.PERM_VIEW_PROBLEM);
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.ProblemAdd = ProblemAdd;
global.Hydro.ui.UserDropdown = UserDropdown;
+1
View File
@@ -30,6 +30,7 @@ if (!global.Hydro) {
nodes: {
nav: [],
problem_add: [],
user_dropdown: [],
},
template: {},
},
+1 -2
View File
@@ -1,7 +1,6 @@
import 'hydrooj';
import 'hydrooj/src/utils';
import md5 from 'hydrooj/src/lib/md5';
import sha1 from 'hydrooj/src/lib/sha1';
import { md5, sha1 } from 'hydrooj/src/lib/crypto';
import pwhash from 'hydrooj/src/lib/hash.hydro';
describe('crypto', () => {
+1 -1
View File
@@ -16,6 +16,6 @@
"ws": "^7.3.1"
},
"devDependencies": {
"@types/ws": "^7.2.6"
"@types/ws": "^7.2.7"
}
}