mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: customizable discussion nodes (#213)
This commit is contained in:
1 parent
e5a9d6cb0a
commit
95df2cfaf2
4 files changed
+47
-44
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.36.7",
|
||||
"version": "2.36.8",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { load } from 'js-yaml';
|
||||
import { Dictionary } from 'lodash';
|
||||
import moment from 'moment-timezone';
|
||||
import {
|
||||
@@ -8,7 +9,7 @@ import type { DomainDoc } from '../interface';
|
||||
import avatar from '../lib/avatar';
|
||||
import paginate from '../lib/paginate';
|
||||
import {
|
||||
DEFAULT_NODES, PERM, PERMS_BY_FAMILY, PRIV,
|
||||
PERM, PERMS_BY_FAMILY, PRIV,
|
||||
} from '../model/builtin';
|
||||
import * as discussion from '../model/discussion';
|
||||
import domain from '../model/domain';
|
||||
@@ -72,8 +73,9 @@ class DomainDashboardHandler extends ManageHandler {
|
||||
}
|
||||
|
||||
async postInitDiscussionNode({ domainId }) {
|
||||
for (const category of Object.keys(DEFAULT_NODES)) {
|
||||
for (const item of DEFAULT_NODES[category]) {
|
||||
const nodes = load(system.get('discussion.nodes'));
|
||||
for (const category of Object.keys(nodes)) {
|
||||
for (const item of nodes[category]) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const curr = await discussion.getNode(domainId, item.name);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
|
||||
@@ -276,55 +276,55 @@ export const DEFAULT_NODES = {
|
||||
],
|
||||
Hydro: [
|
||||
{ pic: 'hydro', name: 'Hydro' },
|
||||
{ pic: null, name: '团队' },
|
||||
{ pic: null, name: '月赛' },
|
||||
{ name: '团队' },
|
||||
{ name: '月赛' },
|
||||
{ pic: 'advice', name: '建议' },
|
||||
],
|
||||
数据结构: [
|
||||
{ pic: null, name: '散列表' },
|
||||
{ pic: null, name: '搜索树' },
|
||||
{ pic: null, name: '栈和队列' },
|
||||
{ pic: null, name: '图' },
|
||||
{ pic: null, name: '堆' },
|
||||
{ name: '散列表' },
|
||||
{ name: '搜索树' },
|
||||
{ name: '栈和队列' },
|
||||
{ name: '图' },
|
||||
{ name: '堆' },
|
||||
],
|
||||
算法: [
|
||||
{ pic: null, name: '数论' },
|
||||
{ pic: null, name: '几何' },
|
||||
{ pic: null, name: '图论' },
|
||||
{ pic: null, name: '网络流' },
|
||||
{ pic: null, name: '动态规划' },
|
||||
{ pic: null, name: '背包' },
|
||||
{ pic: null, name: '排序' },
|
||||
{ pic: null, name: '搜索' },
|
||||
{ pic: null, name: '并查集' },
|
||||
{ pic: null, name: '贪心' },
|
||||
{ pic: null, name: '博弈论' },
|
||||
{ name: '数论' },
|
||||
{ name: '几何' },
|
||||
{ name: '图论' },
|
||||
{ name: '网络流' },
|
||||
{ name: '动态规划' },
|
||||
{ name: '背包' },
|
||||
{ name: '排序' },
|
||||
{ name: '搜索' },
|
||||
{ name: '并查集' },
|
||||
{ name: '贪心' },
|
||||
{ name: '博弈论' },
|
||||
],
|
||||
在线题库: [
|
||||
{ pic: null, name: 'CodeForces' },
|
||||
{ pic: null, name: 'TopCoder' },
|
||||
{ pic: null, name: 'POJ' },
|
||||
{ pic: null, name: 'BZOJ' },
|
||||
{ pic: null, name: 'USACO' },
|
||||
{ pic: null, name: 'RQNOJ' },
|
||||
{ pic: null, name: 'UOJ' },
|
||||
{ pic: null, name: 'LOJ' },
|
||||
{ pic: null, name: '洛谷' },
|
||||
{ name: 'CodeForces' },
|
||||
{ name: 'TopCoder' },
|
||||
{ name: 'POJ' },
|
||||
{ name: 'BZOJ' },
|
||||
{ name: 'USACO' },
|
||||
{ name: 'RQNOJ' },
|
||||
{ name: 'UOJ' },
|
||||
{ name: 'LOJ' },
|
||||
{ name: '洛谷' },
|
||||
],
|
||||
泛: [
|
||||
{ pic: null, name: '数学' },
|
||||
{ pic: null, name: '编程' },
|
||||
{ pic: null, name: '数据库' },
|
||||
{ pic: null, name: 'C' },
|
||||
{ pic: null, name: 'C++' },
|
||||
{ pic: null, name: 'Pascal' },
|
||||
{ pic: null, name: 'Java' },
|
||||
{ pic: null, name: 'PHP' },
|
||||
{ pic: null, name: 'Python' },
|
||||
{ pic: null, name: 'Julia' },
|
||||
{ pic: null, name: '游戏' },
|
||||
{ pic: null, name: '保送' },
|
||||
{ pic: null, name: 'ACM' },
|
||||
{ name: '数学' },
|
||||
{ name: '编程' },
|
||||
{ name: '数据库' },
|
||||
{ name: 'C' },
|
||||
{ name: 'C++' },
|
||||
{ name: 'Pascal' },
|
||||
{ name: 'Java' },
|
||||
{ name: 'PHP' },
|
||||
{ name: 'Python' },
|
||||
{ name: 'Julia' },
|
||||
{ name: '游戏' },
|
||||
{ name: '保送' },
|
||||
{ name: 'ACM' },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ SystemSetting(
|
||||
Setting('setting_limits', 'limit.submission', 30, 'number', 'limit.submission', 'Max submission count per minute'),
|
||||
Setting('setting_limits', 'limit.pretest', 60, 'number', 'limit.pretest', 'Max pretest count per minute'),
|
||||
Setting('setting_basic', 'default.priv', builtin.PRIV.PRIV_DEFAULT, 'number', 'default.priv', 'Default Privilege', FLAG_PRO),
|
||||
Setting('setting_basic', 'discussion.nodes', builtin.DEFAULT_NODES, 'yaml', 'discussion.nodes', 'Discussion Nodes'),
|
||||
Setting('setting_basic', 'problem.categories', builtin.CATEGORIES, 'yaml', 'problem.categories', 'Problem Categories'),
|
||||
Setting('setting_basic', 'pagination.problem', 100, 'number', 'pagination.problem', 'Problems per page'),
|
||||
Setting('setting_basic', 'pagination.contest', 20, 'number', 'pagination.contest', 'Contests per page'),
|
||||
|
||||
Reference in new issue
Block a user