ui: tos update

This commit is contained in:
undefined committed 2021-11-02 14:50:48 +08:00
1 parent 12b7d7f6cd
commit 813890fc4b
14 files changed
+173 -160

No files matched your search

+16
View File
@@ -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 };
}
}