aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs6
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs18
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs19
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserViewManager.cs39
-rw-r--r--MediaBrowser.Server.Implementations/Localization/Server/server.json11
5 files changed, 40 insertions, 53 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
index 2b9ae7d09..855b26034 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
@@ -53,17 +53,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
ValidateUser(req, allowLocal);
}
- // TODO: Remove this when all clients have supported the new sescurity
- private readonly List<string> _updatedClients = new List<string>() { "Dashboard", "Chromecast" };
-
private void ValidateUser(IRequest req, bool allowLocal)
{
//This code is executed before the service
var auth = AuthorizationContext.GetAuthorizationInfo(req);
if (!string.IsNullOrWhiteSpace(auth.Token)
- || _config.Configuration.EnableTokenAuthentication
- || _updatedClients.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
+ || _config.Configuration.SecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
if (!allowLocal || !req.IsLocal)
{
diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index 94be37e95..925eb6a86 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="httpReq">The HTTP req.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static AuthorizationInfo GetAuthorization(IRequest httpReq)
+ private AuthorizationInfo GetAuthorization(IRequest httpReq)
{
var auth = GetAuthorizationDictionary(httpReq);
@@ -59,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="httpReq">The HTTP req.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static Dictionary<string, string> GetAuthorizationDictionary(IRequest httpReq)
+ private Dictionary<string, string> GetAuthorizationDictionary(IRequest httpReq)
{
var auth = httpReq.Headers["Authorization"];
@@ -71,14 +71,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="authorizationHeader">The authorization header.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static Dictionary<string, string> GetAuthorization(string authorizationHeader)
+ private Dictionary<string, string> GetAuthorization(string authorizationHeader)
{
if (authorizationHeader == null) return null;
- var parts = authorizationHeader.Split(' ');
+ var parts = authorizationHeader.Split(new[] { ' ' }, 2);
// There should be at least to parts
- if (parts.Length < 2) return null;
+ if (parts.Length != 2) return null;
// It has to be a digest request
if (!string.Equals(parts[0], "MediaBrowser", StringComparison.OrdinalIgnoreCase))
@@ -87,7 +87,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
}
// Remove uptil the first space
- authorizationHeader = authorizationHeader.Substring(authorizationHeader.IndexOf(' '));
+ authorizationHeader = parts[1];
parts = authorizationHeader.Split(',');
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -95,7 +95,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
foreach (var item in parts)
{
var param = item.Trim().Split(new[] { '=' }, 2);
- result.Add(param[0], param[1].Trim(new[] { '"' }));
+
+ if (param.Length == 2)
+ {
+ result.Add(param[0], param[1].Trim(new[] { '"' }));
+ }
}
return result;
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 297d5e032..a3e86c667 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -1484,16 +1484,27 @@ namespace MediaBrowser.Server.Implementations.Library
.Distinct(StringComparer.OrdinalIgnoreCase);
}
- public async Task<UserView> GetNamedView(string name, string type, string sortName, CancellationToken cancellationToken)
+ public Task<UserView> GetNamedView(string name, string type, string sortName, CancellationToken cancellationToken)
+ {
+ return GetNamedView(name, null, type, sortName, cancellationToken);
+ }
+
+ public async Task<UserView> GetNamedView(string name, string category, string type, string sortName, CancellationToken cancellationToken)
{
var path = Path.Combine(ConfigurationManager.ApplicationPaths.ItemsByNamePath,
- "views",
- _fileSystem.GetValidFilename(type));
+ "views");
+
+ if (!string.IsNullOrWhiteSpace(category))
+ {
+ path = Path.Combine(path, _fileSystem.GetValidFilename(category));
+ }
+
+ path = Path.Combine(path, _fileSystem.GetValidFilename(type));
var id = (path + "_namedview_" + name).GetMBId(typeof(UserView));
var item = GetItemById(id) as UserView;
-
+
if (item == null)
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
index 63aa3764c..61283505b 100644
--- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
@@ -16,7 +15,6 @@ using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -148,43 +146,16 @@ namespace MediaBrowser.Server.Implementations.Library
.ThenBy(i => i.SortName);
}
- public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
+ public Task<UserView> GetUserView(string category, string type, User user, string sortName, CancellationToken cancellationToken)
{
var name = _localizationManager.GetLocalizedString("ViewType" + type);
- return _libraryManager.GetNamedView(name, type, sortName, cancellationToken);
+ return _libraryManager.GetNamedView(name, category, type, sortName, cancellationToken);
}
- public async Task<SpecialFolder> GetSpecialFolder(string name, SpecialFolderType type, string itemType, CancellationToken cancellationToken)
+ public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
{
- var path = Path.Combine(_appPaths.ItemsByNamePath,
- "specialfolders",
- _fileSystem.GetValidFilename(name));
-
- var id = (path + "_specialfolder_" + name).GetMBId(typeof(SpecialFolder));
-
- var item = _libraryManager.GetItemById(id) as SpecialFolder;
-
- if (item == null)
- {
- Directory.CreateDirectory(Path.GetDirectoryName(path));
-
- item = new SpecialFolder
- {
- Path = path,
- Id = id,
- DateCreated = DateTime.UtcNow,
- Name = name,
- SpecialFolderType = type,
- ItemTypeName = itemType
- };
-
- await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
-
- await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
- }
-
- return item;
+ return GetUserView(null, type, user, sortName, cancellationToken);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json
index 1020038f4..2192f5f08 100644
--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json
+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json
@@ -859,6 +859,9 @@
"ViewTypeMovieCollections": "Collections",
"ViewTypeMovieFavorites": "Favorites",
"ViewTypeMovieGenres": "Genres",
+ "ViewTypeMusicLatest": "Latest",
+ "ViewTypeMusicAlbums": "Albums",
+ "ViewTypeMusicAlbumArtists": "Album Artists",
"HeaderOtherDisplaySettings": "Display Settings",
"HeaderMyViews": "My Views",
"LabelSelectFolderGroups": "Automatically group content from the following folders into views such as Movies, Music and TV:",
@@ -1109,12 +1112,14 @@
"HeaderMetadataSettings": "Metadata Settings",
"LabelLockItemToPreventChanges": "Lock this item to prevent future changes",
"MessageLeaveEmptyToInherit": "Leave empty to inherit settings from a parent item, or the global default value.",
- "TabSupporterClub": "Supporter Club",
+ "TabDonate": "Donate",
"HeaderDonationType": "Donation type:",
"OptionMakeOneTimeDonation": "Make a separate donation",
"OptionOneTimeDescription": "This is an additional donation to the team to show your support. It does not have any additional benefits.",
- "OptionLifeTimeSupporterClubMembership": "Lifetime supporter club membership",
- "HeaderSupporterBenefit": "Becoming a supporter club member provides additional benefits such as access to premium plugins, internet channel content, and more.",
+ "OptionLifeTimeSupporterMembership": "Lifetime supporter membership",
+ "OptionYearlySupporterMembership": "Yearly supporter membership",
+ "OptionMonthlySupporterMembership": "Monthly supporter membership",
+ "HeaderSupporterBenefit": "A supporter membership provides additional benefits such as access to premium plugins, internet channel content, and more.",
"OptionNoTrailer": "No Trailer",
"OptionNoThemeSong": "No Theme Song",
"OptionNoThemeVideo": "No Theme Video",