copy saved file

This commit is contained in:
Jan Prochazka
2021-11-11 16:04:51 +01:00
parent 45501c82eb
commit 7fe5c354f1
3 changed files with 27 additions and 1 deletions

View File

@@ -58,6 +58,14 @@ module.exports = {
socket.emitChanged(`all-files-changed`);
},
copy_meta: 'post',
async copy({ folder, file, newFile }) {
if (!hasPermission(`files/${folder}/write`)) return;
await fs.copyFile(path.join(filesdir(), folder, file), path.join(filesdir(), folder, newFile));
socket.emitChanged(`files-changed-${folder}`);
socket.emitChanged(`all-files-changed`);
},
load_meta: 'post',
async load({ folder, file, format }) {
if (folder.startsWith('archive:')) {