mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-09 03:36:17 +00:00
added dlna music folders
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user