diff --git a/backend/app.js b/backend/app.js index aba9e43..c240dbb 100644 --- a/backend/app.js +++ b/backend/app.js @@ -2530,9 +2530,9 @@ app.post('/api/downloadFile', optionalJwt, async (req, res) => { let base_path = fileFolderPath; let usersFileFolder = null; const multiUserMode = config_api.getConfigItem('ytdl_multi_user_mode'); - if (multiUserMode && req.body.uuid) { + if (multiUserMode && (req.body.uuid || req.user.uid)) { usersFileFolder = config_api.getConfigItem('ytdl_users_base_path'); - base_path = path.join(usersFileFolder, req.body.uuid, type); + base_path = path.join(usersFileFolder, req.body.uuid ? req.body.uuid : req.user.uid, type); } if (!subscriptionName) { file = path.join(__dirname, base_path, fileNames + ext); @@ -2550,7 +2550,7 @@ app.post('/api/downloadFile', optionalJwt, async (req, res) => { fileNames[i] = decodeURIComponent(fileNames[i]); } file = await createPlaylistZipFile(fileNames, type, outputName, fullPathProvided, req.body.uuid); - file = path.join(__dirname, file); + if (!path.isAbsolute(file)) file = path.join(__dirname, file); } res.sendFile(file, function (err) { if (err) { diff --git a/backend/authentication/auth.js b/backend/authentication/auth.js index bd9da4a..173dd37 100644 --- a/backend/authentication/auth.js +++ b/backend/authentication/auth.js @@ -297,7 +297,7 @@ exports.getUserVideo = function(user_uid, file_uid, type, requireSharing = false if (!file && type) file = users_db.get('users').find({uid: user_uid}).get(`files.${type}`).find({uid: file_uid}).value(); // prevent unauthorized users from accessing the file info - if (requireSharing && !file['sharingEnabled']) file = null; + if (file && !file['sharingEnabled'] && requireSharing) file = null; return file; } diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index af828b2..3640d7ad 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -215,7 +215,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { // adds user token if in multi-user-mode const uuid_str = this.uuid ? `&uuid=${this.uuid}` : ''; const uid_str = (this.id || !this.db_file) ? '' : `&uid=${this.db_file.uid}`; - const type_str = (this.id || !this.db_file) ? '' : `&type=${this.db_file.type}` + const type_str = (this.id || !this.db_file || !this.db_file.type) ? '' : `&type=${this.db_file.type}` const id_str = this.id ? `&id=${this.id}` : ''; if (this.postsService.isLoggedIn) { fullLocation += (this.subscriptionName ? '&' : '?') + `jwt=${this.postsService.token}`; diff --git a/src/app/subscription/subscription/subscription.component.ts b/src/app/subscription/subscription/subscription.component.ts index 5849081..794a268 100644 --- a/src/app/subscription/subscription/subscription.component.ts +++ b/src/app/subscription/subscription/subscription.component.ts @@ -108,7 +108,7 @@ export class SubscriptionComponent implements OnInit { } else { this.router.navigate(['/player', {fileNames: name, type: this.subscription.type ? this.subscription.type : 'video', subscriptionName: this.subscription.name, - subPlaylist: this.subscription.isPlaylist, uuid: this.postsService.user ? this.postsService.user.uid : null}]); + subPlaylist: this.subscription.isPlaylist}]); } }