mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: contest_files
This commit is contained in:
1 parent
86d77625f6
commit
996ff2a9dd
16 files changed
+154
-32
No files matched your search
@@ -29,17 +29,20 @@ export class FilesHandler extends Handler {
|
||||
@param('pjax', Types.Boolean)
|
||||
async get(domainId: string, pjax = false) {
|
||||
if (!this.user._files?.length) this.checkPriv(PRIV.PRIV_CREATE_FILE);
|
||||
const files = sortFiles(this.user._files);
|
||||
const body = {
|
||||
files: sortFiles(this.user._files),
|
||||
urlForFile: (filename: string) => this.url('fs_download', { uid: this.user._id, filename }),
|
||||
};
|
||||
if (pjax) {
|
||||
this.response.body = {
|
||||
fragments: (await Promise.all([
|
||||
this.renderHTML('partials/home_files.html', { files }),
|
||||
this.renderHTML('partials/files.html', body),
|
||||
])).map((i) => ({ html: i })),
|
||||
};
|
||||
this.response.template = '';
|
||||
} else {
|
||||
this.response.template = 'home_files.html';
|
||||
this.response.body = { files };
|
||||
this.response.body = body;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,13 +71,6 @@ export class FilesHandler extends Handler {
|
||||
this.back();
|
||||
}
|
||||
|
||||
@post('from', Types.String)
|
||||
@post('to', Types.String)
|
||||
async postRename(domainId: string, from: string, to: string) {
|
||||
await storage.rename(`user/${this.user._id}/${from}`, `user/${this.user._id}/${to}`, this.user._id);
|
||||
this.back();
|
||||
}
|
||||
|
||||
@post('files', Types.Array)
|
||||
async postDeleteFiles(domainId: string, files: string[]) {
|
||||
await Promise.all([
|
||||
|
||||
Reference in new issue
Block a user