mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-24 02:53:19 +03:00
Fixed bug in file deletion
This commit is contained in:
@@ -2570,7 +2570,7 @@ app.post('/api/deleteFile', optionalJwt, async (req, res) => {
|
|||||||
var blacklistMode = req.body.blacklistMode;
|
var blacklistMode = req.body.blacklistMode;
|
||||||
|
|
||||||
if (req.isAuthenticated()) {
|
if (req.isAuthenticated()) {
|
||||||
let success = auth_api.deleteUserFile(req.user.uid, uid, blacklistMode);
|
let success = await auth_api.deleteUserFile(req.user.uid, uid, blacklistMode);
|
||||||
res.send(success);
|
res.send(success);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2583,7 +2583,7 @@ app.post('/api/deleteFile', optionalJwt, async (req, res) => {
|
|||||||
{
|
{
|
||||||
wasDeleted = type === 'audio' ? await deleteAudioFile(name, path.basename(fullpath), blacklistMode) : await deleteVideoFile(name, path.basename(fullpath), blacklistMode);
|
wasDeleted = type === 'audio' ? await deleteAudioFile(name, path.basename(fullpath), blacklistMode) : await deleteVideoFile(name, path.basename(fullpath), blacklistMode);
|
||||||
db.get('files').remove({uid: uid}).write();
|
db.get('files').remove({uid: uid}).write();
|
||||||
// wasDeleted = true;
|
wasDeleted = true;
|
||||||
res.send(wasDeleted);
|
res.send(wasDeleted);
|
||||||
} else if (video_obj) {
|
} else if (video_obj) {
|
||||||
db.get('files').remove({uid: uid}).write();
|
db.get('files').remove({uid: uid}).write();
|
||||||
|
|||||||
@@ -127,9 +127,11 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
this.normal_files_received = false;
|
this.normal_files_received = false;
|
||||||
this.postsService.getAllFiles().subscribe(res => {
|
this.postsService.getAllFiles().subscribe(res => {
|
||||||
this.files = res['files'];
|
this.files = res['files'];
|
||||||
this.files.forEach(file => {
|
for (let i = 0; i < this.files.length; i++) {
|
||||||
|
const file = this.files[i];
|
||||||
file.duration = typeof file.duration !== 'string' ? file.duration : this.durationStringToNumber(file.duration);
|
file.duration = typeof file.duration !== 'string' ? file.duration : this.durationStringToNumber(file.duration);
|
||||||
});
|
file.index = i;
|
||||||
|
}
|
||||||
this.files.sort(this.sortFiles);
|
this.files.sort(this.sortFiles);
|
||||||
if (this.search_mode) {
|
if (this.search_mode) {
|
||||||
this.filterFiles(this.search_text);
|
this.filterFiles(this.search_text);
|
||||||
@@ -247,7 +249,8 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
this.postsService.deleteFile(file.uid, file.isAudio ? 'audio' : 'video', blacklistMode).subscribe(result => {
|
this.postsService.deleteFile(file.uid, file.isAudio ? 'audio' : 'video', blacklistMode).subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.postsService.openSnackBar('Delete success!', 'OK.');
|
this.postsService.openSnackBar('Delete success!', 'OK.');
|
||||||
this.files.splice(index, 1);
|
this.files.splice(file.index, 1);
|
||||||
|
this.filterByProperty(this.filterProperty['property']);
|
||||||
} else {
|
} else {
|
||||||
this.postsService.openSnackBar('Delete failed!', 'OK.');
|
this.postsService.openSnackBar('Delete failed!', 'OK.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user