mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-22 15:13:21 +03:00
Get downloads now supports filtering by uids
This commit is contained in:
@@ -1763,9 +1763,13 @@ app.get('/api/thumbnail/:path', optionalJwt, async (req, res) => {
|
|||||||
|
|
||||||
// Downloads management
|
// Downloads management
|
||||||
|
|
||||||
app.get('/api/downloads', optionalJwt, async (req, res) => {
|
app.post('/api/downloads', optionalJwt, async (req, res) => {
|
||||||
const user_uid = req.isAuthenticated() ? req.user.uid : null;
|
const user_uid = req.isAuthenticated() ? req.user.uid : null;
|
||||||
const downloads = await db_api.getRecords('download_queue', {user_uid: user_uid});
|
const uids = req.body.uids;
|
||||||
|
let downloads = await db_api.getRecords('download_queue', {user_uid: user_uid});
|
||||||
|
|
||||||
|
if (uids) downloads = downloads.filter(download => uids.includes(download['uid']));
|
||||||
|
|
||||||
res.send({downloads: downloads});
|
res.send({downloads: downloads});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -413,8 +413,8 @@ export class PostsService implements CanActivate {
|
|||||||
return this.http.post(this.path + 'getSubscriptions', {}, this.httpOptions);
|
return this.http.post(this.path + 'getSubscriptions', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentDownloads() {
|
getCurrentDownloads(uids = null) {
|
||||||
return this.http.get(this.path + 'downloads', this.httpOptions);
|
return this.http.post(this.path + 'downloads', {uids: uids}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentDownload(download_uid) {
|
getCurrentDownload(download_uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user