mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: tos update
This commit is contained in:
1 parent
12b7d7f6cd
commit
813890fc4b
14 files changed
+173
-160
No files matched your search
@@ -106,7 +106,23 @@ class WikiAboutHandler extends Handler {
|
||||
noCheckPermView = true;
|
||||
|
||||
async get() {
|
||||
let raw = system.get('ui-default.about') || '';
|
||||
// TODO template engine
|
||||
raw = raw.replace(/{{ name }}/g, this.domain.ui?.name || system.get('server.name')).trim();
|
||||
const lines = raw.split('\n');
|
||||
const sections = [];
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('# ')) {
|
||||
const id = line.split(' ')[1];
|
||||
sections.push({
|
||||
id,
|
||||
title: line.split(id)[1].trim(),
|
||||
content: '',
|
||||
});
|
||||
} else sections[sections.length - 1].content += `${line}\n`;
|
||||
}
|
||||
this.response.template = 'about.html';
|
||||
this.response.body = { sections };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user