mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
fixes #1001 - Support downloading
This commit is contained in:
@@ -284,6 +284,20 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
AttachLinkedChildImages(dto, playlist, user, options);
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.CanDelete))
|
||||
{
|
||||
dto.CanDelete = user == null
|
||||
? item.CanDelete()
|
||||
: item.CanDelete(user);
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.CanDownload))
|
||||
{
|
||||
dto.CanDownload = user == null
|
||||
? item.CanDownload()
|
||||
: item.CanDownload(user);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||
ValidateUserAccess(user, request, authAttribtues, auth);
|
||||
}
|
||||
|
||||
if (!IsExemptFromRoles(auth, authAttribtues))
|
||||
var info = (AuthenticationInfo)request.Items["OriginalAuthenticationInfo"];
|
||||
|
||||
if (!IsExemptFromRoles(auth, authAttribtues, info))
|
||||
{
|
||||
var roles = authAttribtues.GetRoles().ToList();
|
||||
|
||||
@@ -142,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private bool IsExemptFromRoles(AuthorizationInfo auth, IAuthenticationAttributes authAttribtues)
|
||||
private bool IsExemptFromRoles(AuthorizationInfo auth, IAuthenticationAttributes authAttribtues, AuthenticationInfo tokenInfo)
|
||||
{
|
||||
if (!_config.Configuration.IsStartupWizardCompleted &&
|
||||
authAttribtues.AllowBeforeStartupWizard)
|
||||
@@ -150,6 +152,16 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(auth.Token))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tokenInfo != null && string.IsNullOrWhiteSpace(tokenInfo.UserId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,6 +187,16 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||
};
|
||||
}
|
||||
}
|
||||
if (roles.Contains("download", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
if (user == null || !user.Policy.EnableContentDownloading)
|
||||
{
|
||||
throw new SecurityException("User does not have download access.")
|
||||
{
|
||||
SecurityExceptionType = SecurityExceptionType.Unauthenticated
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsValidConnectKey(string token)
|
||||
|
||||
@@ -229,6 +229,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
ServerId = _appHost.SystemId
|
||||
};
|
||||
|
||||
dto.CanDelete = user == null
|
||||
? recording.CanDelete()
|
||||
: recording.CanDelete(user);
|
||||
|
||||
dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToList();
|
||||
|
||||
if (info.Status == RecordingStatus.InProgress)
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"LabelFailed": "(failed)",
|
||||
"ButtonHelp": "Help",
|
||||
"ButtonSave": "Save",
|
||||
"ButtonDownload": "Download",
|
||||
"SyncJobStatusQueued": "Queued",
|
||||
"SyncJobStatusConverting": "Converting",
|
||||
"SyncJobStatusFailed": "Failed",
|
||||
@@ -56,6 +57,7 @@
|
||||
"SyncJobStatusReadyToTransfer": "Ready to Transfer",
|
||||
"SyncJobStatusTransferring": "Transferring",
|
||||
"SyncJobStatusCompletedWithError": "Synced with errors",
|
||||
"SyncJobItemStatusReadyToTransfer": "Ready to Transfer",
|
||||
"LabelCollection": "Collection",
|
||||
"HeaderAddToCollection": "Add to Collection",
|
||||
"NewCollectionNameExample": "Example: Star Wars Collection",
|
||||
|
||||
@@ -285,10 +285,10 @@
|
||||
"ButtonHelp": "Help",
|
||||
"OptionAllowUserToManageServer": "Allow this user to manage the server",
|
||||
"HeaderFeatureAccess": "Feature Access",
|
||||
"OptionAllowMediaPlayback": "Allow media playback",
|
||||
"OptionAllowBrowsingLiveTv": "Allow browsing of live tv",
|
||||
"OptionAllowDeleteLibraryContent": "Allow deletion of library content",
|
||||
"OptionAllowManageLiveTv": "Allow management of live tv recordings",
|
||||
"OptionAllowMediaPlayback": "Media playback",
|
||||
"OptionAllowBrowsingLiveTv": "Live TV",
|
||||
"OptionAllowDeleteLibraryContent": "Media deletion",
|
||||
"OptionAllowManageLiveTv": "Live TV recording management",
|
||||
"OptionAllowRemoteControlOthers": "Allow remote control of other users",
|
||||
"OptionAllowRemoteSharedDevices": "Allow remote control of shared devices",
|
||||
"OptionAllowRemoteSharedDevicesHelp": "Dlna devices are considered shared until a user begins controlling it.",
|
||||
@@ -1133,7 +1133,7 @@
|
||||
"ViewTypeLiveTvRecordingGroups": "Recordings",
|
||||
"ViewTypeLiveTvChannels": "Channels",
|
||||
"LabelEasyPinCode": "Easy pin code:",
|
||||
"EasyPasswordHelp": "Your easy pin code is used for offline access with supported Media Browser apps, and can also be used for easy in-network sign in.",
|
||||
"EasyPasswordHelp": "Your easy pin code is used for offline access with supported Media Browser apps, and can also be used for easy in-network sign in.",
|
||||
"LabelInNetworkSignInWithEasyPassword": "Enable in-network sign in with my easy pin code",
|
||||
"LabelInNetworkSignInWithEasyPasswordHelp": "If enabled, you'll be able to use your easy pin code to sign in to Media Browser apps from inside your home network. Your regular password will only be needed away from home. If the pin code is left blank, you won't need a password within your home network.",
|
||||
"HeaderPassword": "Password",
|
||||
@@ -1362,7 +1362,8 @@
|
||||
"LabelEnableSingleImageInDidlLimitHelp": "Some devices will not render properly if multiple images are embedded within Didl.",
|
||||
"TabActivity": "Activity",
|
||||
"TitleSync": "Sync",
|
||||
"OptionAllowSyncContent": "Allow syncing media to devices",
|
||||
"OptionAllowSyncContent": "Sync",
|
||||
"OptionAllowContentDownloading": "Media downloading",
|
||||
"NameSeasonUnknown": "Season Unknown",
|
||||
"NameSeasonNumber": "Season {0}",
|
||||
"LabelNewUserNameHelp": "Usernames can contain letters (a-z), numbers (0-9), dashes (-), underscores (_), apostrophes ('), and periods (.)",
|
||||
|
||||
@@ -311,8 +311,10 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
var itemByName = item as IItemByName;
|
||||
if (itemByName != null)
|
||||
{
|
||||
var itemByNameFilter = itemByName.GetItemFilter();
|
||||
|
||||
return user.RootFolder
|
||||
.GetRecursiveChildren(user, itemByName.GetItemFilter());
|
||||
.GetRecursiveChildren(user, i => !i.IsFolder && itemByNameFilter(i));
|
||||
}
|
||||
|
||||
if (item.IsFolder)
|
||||
|
||||
Reference in New Issue
Block a user