mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
Merge branch 'master' into angular-13-update
This commit is contained in:
@@ -482,6 +482,26 @@ paths:
|
|||||||
description: OK
|
description: OK
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
|
/api/deleteAllFiles:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- files
|
||||||
|
summary: Delete all downloaded files
|
||||||
|
operationId: post-api-deleteAllFiles
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/DeleteMp3Mp4Request'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/DeleteAllFilesResponse'
|
||||||
|
security:
|
||||||
|
- Auth query parameter: []
|
||||||
/api/downloadArchive:
|
/api/downloadArchive:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -1765,6 +1785,15 @@ components:
|
|||||||
type: boolean
|
type: boolean
|
||||||
error:
|
error:
|
||||||
type: string
|
type: string
|
||||||
|
DeleteAllFilesResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
file_count:
|
||||||
|
type: number
|
||||||
|
description: Number of files found matching search parameters
|
||||||
|
delete_count:
|
||||||
|
type: number
|
||||||
|
description: Number of files removed
|
||||||
DeleteSubscriptionFileRequest:
|
DeleteSubscriptionFileRequest:
|
||||||
required:
|
required:
|
||||||
- file
|
- file
|
||||||
|
|||||||
@@ -1434,6 +1434,46 @@ app.post('/api/deleteFile', optionalJwt, async (req, res) => {
|
|||||||
res.send(wasDeleted);
|
res.send(wasDeleted);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post('/api/deleteAllFiles', optionalJwt, async (req, res) => {
|
||||||
|
const blacklistMode = false;
|
||||||
|
const uuid = req.isAuthenticated() ? req.user.uid : null;
|
||||||
|
|
||||||
|
let files = null;
|
||||||
|
let text_search = req.body.text_search;
|
||||||
|
let file_type_filter = req.body.file_type_filter;
|
||||||
|
|
||||||
|
const filter_obj = {user_uid: uuid};
|
||||||
|
const regex = true;
|
||||||
|
if (text_search) {
|
||||||
|
if (regex) {
|
||||||
|
filter_obj['title'] = {$regex: `.*${text_search}.*`, $options: 'i'};
|
||||||
|
} else {
|
||||||
|
filter_obj['$text'] = { $search: utils.createEdgeNGrams(text_search) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_type_filter === 'audio_only') filter_obj['isAudio'] = true;
|
||||||
|
else if (file_type_filter === 'video_only') filter_obj['isAudio'] = false;
|
||||||
|
|
||||||
|
files = await db_api.getRecords('files', filter_obj);
|
||||||
|
|
||||||
|
let file_count = await db_api.getRecords('files', filter_obj, true);
|
||||||
|
let delete_count = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
let wasDeleted = false;
|
||||||
|
wasDeleted = await db_api.deleteFile(files[i].uid, uuid, blacklistMode);
|
||||||
|
if (wasDeleted) {
|
||||||
|
delete_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send({
|
||||||
|
file_count: file_count,
|
||||||
|
delete_count: delete_count
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.post('/api/downloadFileFromServer', optionalJwt, async (req, res) => {
|
app.post('/api/downloadFileFromServer', optionalJwt, async (req, res) => {
|
||||||
let uid = req.body.uid;
|
let uid = req.body.uid;
|
||||||
let uuid = req.body.uuid;
|
let uuid = req.body.uuid;
|
||||||
|
|||||||
53
package-lock.json
generated
53
package-lock.json
generated
@@ -3295,12 +3295,65 @@
|
|||||||
"safer-buffer": "~2.1.0"
|
"safer-buffer": "~2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"asn1.js": {
|
||||||
|
"version": "5.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
|
||||||
|
"integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"bn.js": "^4.0.0",
|
||||||
|
"inherits": "^2.0.1",
|
||||||
|
"minimalistic-assert": "^1.0.0",
|
||||||
|
"safer-buffer": "^2.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"bn.js": {
|
||||||
|
"version": "4.11.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
|
||||||
|
"integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"assert": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"object-assign": "^4.1.1",
|
||||||
|
"util": "0.10.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||||
|
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"util": {
|
||||||
|
"version": "0.10.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
|
||||||
|
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"inherits": "2.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"assert-plus": {
|
"assert-plus": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||||
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"assign-symbols": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"ast-types-flow": {
|
"ast-types-flow": {
|
||||||
"version": "0.0.7",
|
"version": "0.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
|
||||||
|
|||||||
Reference in New Issue
Block a user