mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
move docs, remove katex
This commit is contained in:
1 parent
da6002278d
commit
c4a13f2e27
27 files changed
+190
-550
No files matched your search
+1
-40
@@ -21,7 +21,7 @@ export const builtinModel = [
|
||||
export const builtinHandler = [
|
||||
'home', 'problem', 'record', 'judge', 'user',
|
||||
'contest', 'training', 'discussion', 'manage', 'import',
|
||||
'misc', 'homework', 'domain', 'wiki',
|
||||
'misc', 'homework', 'domain',
|
||||
];
|
||||
|
||||
export const builtinScript = [
|
||||
@@ -212,42 +212,3 @@ export async function script(pending: string[], fail: string[], active: string[]
|
||||
active.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
export async function wiki(pending: string[], fail: string[]) {
|
||||
for (const i of pending) {
|
||||
const p = path.resolve(i, 'wiki');
|
||||
if (fs.existsSync(p) && fs.statSync(p).isDirectory() && !fail.includes(i)) {
|
||||
try {
|
||||
const categories = fs.readdirSync(p);
|
||||
for (const category of categories) {
|
||||
if (!fs.statSync(p).isDirectory()) return;
|
||||
const pages = fs.readdirSync(path.join(p, category));
|
||||
if (!global.Hydro.wiki[category]) global.Hydro.wiki[category] = {};
|
||||
for (const page of pages) {
|
||||
const c = fs.readFileSync(path.join(p, category, page)).toString().split('\n');
|
||||
const pagename = page.split('.')[0];
|
||||
global.Hydro.wiki[category][pagename] = [];
|
||||
let content = null;
|
||||
for (let j = 0; j < c.length; j++) {
|
||||
const line = c[j];
|
||||
if (line.startsWith('# ')) {
|
||||
if (content) global.Hydro.wiki[category][pagename].push(content);
|
||||
content = {};
|
||||
const t = line.split('# ')[1].split('|');
|
||||
[content.title, content.id] = t.map((q) => q.trim());
|
||||
content.content = '';
|
||||
} else {
|
||||
content.content = `${content.content}${line}\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`Wiki init: ${i}`);
|
||||
} catch (e) {
|
||||
fail.push(i);
|
||||
console.error(`Wiki Load Fail: ${i}`);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,6 @@ import Router from 'koa-router';
|
||||
import cache from 'koa-static-cache';
|
||||
import nunjucks from 'nunjucks';
|
||||
import mongodb from 'mongodb';
|
||||
import parse from 'yargs-parser';
|
||||
|
||||
const argv = parse(process.argv.slice(2));
|
||||
|
||||
class Loader {
|
||||
getSource(name: string) { // eslint-disable-line class-methods-use-this
|
||||
@@ -110,7 +107,7 @@ export function load() {
|
||||
ctx.body = await render('setup.html');
|
||||
ctx.response.type = 'text/html';
|
||||
});
|
||||
const listenPort = argv.port || 8888;
|
||||
const listenPort = global.argv.port || 8888;
|
||||
router.post('/', async (ctx) => {
|
||||
const {
|
||||
host, port, name, username, password,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
import {
|
||||
locale, template, lib, service, model, handler, script, setting, wiki, uistatic,
|
||||
locale, template, lib, service, model, handler, script, setting, uistatic,
|
||||
builtinLib, builtinScript, builtinHandler, builtinModel,
|
||||
} from './common';
|
||||
|
||||
@@ -17,7 +17,6 @@ export async function load(call, args) {
|
||||
locale(pending, fail),
|
||||
template(pending, fail),
|
||||
uistatic(pending, fail),
|
||||
wiki(pending, fail),
|
||||
]);
|
||||
const bus = require('../service/bus');
|
||||
await new Promise((resolve) => {
|
||||
|
||||
Reference in new issue
Block a user