mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: support @[user]()
This commit is contained in:
1 parent
b272598685
commit
c5b2552f59
8 files changed
+48
-13
No files matched your search
@@ -132,6 +132,24 @@ class MarkdownHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
class RichMediaHandler extends Handler {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
this.noCheckPermView = true;
|
||||
}
|
||||
|
||||
async post({ domainId, items }) {
|
||||
const res = [];
|
||||
for (const item of items) {
|
||||
if (item.type === 'user') {
|
||||
const udoc = Number.isNaN(+item.id) ? await user.getByUname(domainId, item.id) : await user.getById(domainId, +item.id);
|
||||
res.push(this.renderHTML('partials/user.html', { udoc }));
|
||||
} else res.push('');
|
||||
}
|
||||
this.response.body = await Promise.all(res);
|
||||
}
|
||||
}
|
||||
|
||||
const getHash = (i) => {
|
||||
const shasum = crypto.createHash('sha1');
|
||||
const file = readFileSync(join(tmpdir(), 'hydro', 'public', i));
|
||||
@@ -160,4 +178,5 @@ global.Hydro.handler.ui = async () => {
|
||||
Route('set_theme', '/set_theme/:id', SetThemeHandler);
|
||||
Route('ui_extracss', '/extra.css', UiSettingsHandler);
|
||||
Route('markdown', '/markdown', MarkdownHandler);
|
||||
Route('media', '/media', RichMediaHandler);
|
||||
};
|
||||
Reference in new issue
Block a user