mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
wiki
This commit is contained in:
1 parent
8c20c34d8b
commit
ca11d80776
45 files changed
+418
-444
No files matched your search
@@ -0,0 +1,24 @@
|
||||
const { Route, Handler } = require('../service/server');
|
||||
const { NotFoundError } = require('../error');
|
||||
|
||||
class WikiHandler extends Handler {
|
||||
async get({ name }) {
|
||||
if (!global.Hydro.wiki[name]) throw new NotFoundError(name);
|
||||
const contents = global.Hydro.wiki[name];
|
||||
const path = [
|
||||
['Hydro', '/'],
|
||||
['wiki', '/wiki'],
|
||||
[`wiki_${name}`, null],
|
||||
];
|
||||
this.response.body = {
|
||||
path, contents, page_name: `wiki_${name}`,
|
||||
};
|
||||
this.response.template = 'wiki.html';
|
||||
}
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
Route('/wiki/:name', WikiHandler);
|
||||
}
|
||||
|
||||
global.Hydro.handler.wiki = module.exports = apply;
|
||||
Reference in new issue
Block a user