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
@@ -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', () => {