mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
markdown preview
This commit is contained in:
1 parent
86f67a0ec3
commit
5ca424da0b
15 files changed
+123
-104
No files matched your search
@@ -3,6 +3,12 @@ const { PERM_LOGGEDIN } = global.Hydro.permission;
|
||||
const { pastebin } = global.Hydro.model;
|
||||
const { nav } = global.Hydro.lib;
|
||||
|
||||
class PasteMainHandler extends Handler {
|
||||
async get() {
|
||||
this.response.redirect = this.url('paste_creaate');
|
||||
}
|
||||
}
|
||||
|
||||
class PasteShowHandler extends Handler {
|
||||
async get({ docId }) {
|
||||
const doc = await pastebin.get(docId);
|
||||
@@ -42,9 +48,10 @@ class PasteCreateHandler extends Handler {
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
Route('paste', '/paste', PasteMainHandler);
|
||||
Route('paste_create', '/paste/create', PasteCreateHandler);
|
||||
Route('paste_show', '/paste/:docId', PasteShowHandler);
|
||||
nav('/paste/create', 'pastebin', 'pastebin', PERM_LOGGEDIN);
|
||||
nav('paste', null, 'paste', PERM_LOGGEDIN);
|
||||
}
|
||||
|
||||
global.Hydro.handler.pastebin = module.exports = apply;
|
||||
Reference in new issue
Block a user