aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Configuration/FanartOptions.cs11
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs7
-rw-r--r--MediaBrowser.Model/Cryptography/PasswordHash.cs306
-rw-r--r--MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs20
-rw-r--r--MediaBrowser.Model/Services/IHttpRequest.cs20
-rw-r--r--MediaBrowser.Model/System/PublicSystemInfo.cs5
-rw-r--r--MediaBrowser.Model/System/SystemInfo.cs4
7 files changed, 172 insertions, 201 deletions
diff --git a/MediaBrowser.Model/Configuration/FanartOptions.cs b/MediaBrowser.Model/Configuration/FanartOptions.cs
deleted file mode 100644
index 9c8be39be..000000000
--- a/MediaBrowser.Model/Configuration/FanartOptions.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace MediaBrowser.Model.Configuration
-{
- public class FanartOptions
- {
- /// <summary>
- /// Gets or sets the user API key.
- /// </summary>
- /// <value>The user API key.</value>
- public string UserApiKey { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 0ba36b4b9..2673597ca 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -49,9 +49,9 @@ namespace MediaBrowser.Model.Configuration
public bool EnableNormalizedItemByNameIds { get; set; }
/// <summary>
- /// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
+ /// Gets or sets the value pointing to the file system where the ssl certificate is located..
/// </summary>
- /// <value>The value pointing to the file system where the ssl certiifcate is located..</value>
+ /// <value>The value pointing to the file system where the ssl certificate is located..</value>
public string CertificatePath { get; set; }
public string CertificatePassword { get; set; }
@@ -259,7 +259,7 @@ namespace MediaBrowser.Model.Configuration
{
ItemType = "MusicVideo",
DisabledMetadataFetchers = new [] { "The Open Movie Database" },
- DisabledImageFetchers = new [] { "The Open Movie Database", "FanArt" }
+ DisabledImageFetchers = new [] { "The Open Movie Database" }
},
new MetadataOptions
{
@@ -285,7 +285,6 @@ namespace MediaBrowser.Model.Configuration
{
ItemType = "Season",
DisabledMetadataFetchers = new [] { "TheMovieDb" },
- DisabledImageFetchers = new [] { "FanArt" }
},
new MetadataOptions
{
diff --git a/MediaBrowser.Model/Cryptography/PasswordHash.cs b/MediaBrowser.Model/Cryptography/PasswordHash.cs
index a9d0f6744..f15b27d32 100644
--- a/MediaBrowser.Model/Cryptography/PasswordHash.cs
+++ b/MediaBrowser.Model/Cryptography/PasswordHash.cs
@@ -1,153 +1,153 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace MediaBrowser.Model.Cryptography
-{
- public class PasswordHash
- {
- // Defined from this hash storage spec
- // https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md
- // $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
- // with one slight amendment to ease the transition, we're writing out the bytes in hex
- // rather than making them a BASE64 string with stripped padding
-
- private string _id;
-
- private Dictionary<string, string> _parameters = new Dictionary<string, string>();
-
- private string _salt;
-
- private byte[] _saltBytes;
-
- private string _hash;
-
- private byte[] _hashBytes;
-
- public string Id { get => _id; set => _id = value; }
-
- public Dictionary<string, string> Parameters { get => _parameters; set => _parameters = value; }
-
- public string Salt { get => _salt; set => _salt = value; }
-
- public byte[] SaltBytes { get => _saltBytes; set => _saltBytes = value; }
-
- public string Hash { get => _hash; set => _hash = value; }
-
- public byte[] HashBytes { get => _hashBytes; set => _hashBytes = value; }
-
- public PasswordHash(string storageString)
- {
- string[] splitted = storageString.Split('$');
- _id = splitted[1];
- if (splitted[2].Contains("="))
- {
- foreach (string paramset in (splitted[2].Split(',')))
- {
- if (!string.IsNullOrEmpty(paramset))
- {
- string[] fields = paramset.Split('=');
- if (fields.Length == 2)
- {
- _parameters.Add(fields[0], fields[1]);
- }
- else
- {
- throw new Exception($"Malformed parameter in password hash string {paramset}");
- }
- }
- }
- if (splitted.Length == 5)
- {
- _salt = splitted[3];
- _saltBytes = ConvertFromByteString(_salt);
- _hash = splitted[4];
- _hashBytes = ConvertFromByteString(_hash);
- }
- else
- {
- _salt = string.Empty;
- _hash = splitted[3];
- _hashBytes = ConvertFromByteString(_hash);
- }
- }
- else
- {
- if (splitted.Length == 4)
- {
- _salt = splitted[2];
- _saltBytes = ConvertFromByteString(_salt);
- _hash = splitted[3];
- _hashBytes = ConvertFromByteString(_hash);
- }
- else
- {
- _salt = string.Empty;
- _hash = splitted[2];
- _hashBytes = ConvertFromByteString(_hash);
- }
-
- }
-
- }
-
- public PasswordHash(ICryptoProvider cryptoProvider)
- {
- _id = cryptoProvider.DefaultHashMethod;
- _saltBytes = cryptoProvider.GenerateSalt();
- _salt = ConvertToByteString(SaltBytes);
- }
-
- public static byte[] ConvertFromByteString(string byteString)
- {
- byte[] bytes = new byte[byteString.Length / 2];
- for (int i = 0; i < byteString.Length; i += 2)
- {
- // TODO: NetStandard2.1 switch this to use a span instead of a substring.
- bytes[i / 2] = Convert.ToByte(byteString.Substring(i, 2), 16);
- }
-
- return bytes;
- }
-
- public static string ConvertToByteString(byte[] bytes)
- {
- return BitConverter.ToString(bytes).Replace("-", "");
- }
-
- private string SerializeParameters()
- {
- string returnString = string.Empty;
- foreach (var KVP in _parameters)
- {
- returnString += $",{KVP.Key}={KVP.Value}";
- }
-
- if ((!string.IsNullOrEmpty(returnString)) && returnString[0] == ',')
- {
- returnString = returnString.Remove(0, 1);
- }
-
- return returnString;
- }
-
- public override string ToString()
- {
- string outString = "$" + _id;
- string paramstring = SerializeParameters();
- if (!string.IsNullOrEmpty(paramstring))
- {
- outString += $"${paramstring}";
- }
-
- if (!string.IsNullOrEmpty(_salt))
- {
- outString += $"${_salt}";
- }
-
- outString += $"${_hash}";
- return outString;
- }
- }
-
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace MediaBrowser.Model.Cryptography
+{
+ public class PasswordHash
+ {
+ // Defined from this hash storage spec
+ // https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md
+ // $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
+ // with one slight amendment to ease the transition, we're writing out the bytes in hex
+ // rather than making them a BASE64 string with stripped padding
+
+ private string _id;
+
+ private Dictionary<string, string> _parameters = new Dictionary<string, string>();
+
+ private string _salt;
+
+ private byte[] _saltBytes;
+
+ private string _hash;
+
+ private byte[] _hashBytes;
+
+ public string Id { get => _id; set => _id = value; }
+
+ public Dictionary<string, string> Parameters { get => _parameters; set => _parameters = value; }
+
+ public string Salt { get => _salt; set => _salt = value; }
+
+ public byte[] SaltBytes { get => _saltBytes; set => _saltBytes = value; }
+
+ public string Hash { get => _hash; set => _hash = value; }
+
+ public byte[] HashBytes { get => _hashBytes; set => _hashBytes = value; }
+
+ public PasswordHash(string storageString)
+ {
+ string[] splitted = storageString.Split('$');
+ _id = splitted[1];
+ if (splitted[2].Contains("="))
+ {
+ foreach (string paramset in (splitted[2].Split(',')))
+ {
+ if (!string.IsNullOrEmpty(paramset))
+ {
+ string[] fields = paramset.Split('=');
+ if (fields.Length == 2)
+ {
+ _parameters.Add(fields[0], fields[1]);
+ }
+ else
+ {
+ throw new Exception($"Malformed parameter in password hash string {paramset}");
+ }
+ }
+ }
+ if (splitted.Length == 5)
+ {
+ _salt = splitted[3];
+ _saltBytes = ConvertFromByteString(_salt);
+ _hash = splitted[4];
+ _hashBytes = ConvertFromByteString(_hash);
+ }
+ else
+ {
+ _salt = string.Empty;
+ _hash = splitted[3];
+ _hashBytes = ConvertFromByteString(_hash);
+ }
+ }
+ else
+ {
+ if (splitted.Length == 4)
+ {
+ _salt = splitted[2];
+ _saltBytes = ConvertFromByteString(_salt);
+ _hash = splitted[3];
+ _hashBytes = ConvertFromByteString(_hash);
+ }
+ else
+ {
+ _salt = string.Empty;
+ _hash = splitted[2];
+ _hashBytes = ConvertFromByteString(_hash);
+ }
+
+ }
+
+ }
+
+ public PasswordHash(ICryptoProvider cryptoProvider)
+ {
+ _id = cryptoProvider.DefaultHashMethod;
+ _saltBytes = cryptoProvider.GenerateSalt();
+ _salt = ConvertToByteString(SaltBytes);
+ }
+
+ public static byte[] ConvertFromByteString(string byteString)
+ {
+ byte[] bytes = new byte[byteString.Length / 2];
+ for (int i = 0; i < byteString.Length; i += 2)
+ {
+ // TODO: NetStandard2.1 switch this to use a span instead of a substring.
+ bytes[i / 2] = Convert.ToByte(byteString.Substring(i, 2), 16);
+ }
+
+ return bytes;
+ }
+
+ public static string ConvertToByteString(byte[] bytes)
+ {
+ return BitConverter.ToString(bytes).Replace("-", "");
+ }
+
+ private string SerializeParameters()
+ {
+ string returnString = string.Empty;
+ foreach (var KVP in _parameters)
+ {
+ returnString += $",{KVP.Key}={KVP.Value}";
+ }
+
+ if ((!string.IsNullOrEmpty(returnString)) && returnString[0] == ',')
+ {
+ returnString = returnString.Remove(0, 1);
+ }
+
+ return returnString;
+ }
+
+ public override string ToString()
+ {
+ string outString = "$" + _id;
+ string paramstring = SerializeParameters();
+ if (!string.IsNullOrEmpty(paramstring))
+ {
+ outString += $"${paramstring}";
+ }
+
+ if (!string.IsNullOrEmpty(_salt))
+ {
+ outString += $"${_salt}";
+ }
+
+ outString += $"${_hash}";
+ return outString;
+ }
+ }
+
+}
diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
index 901d81c5f..e52951dd0 100644
--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
+++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
@@ -13,7 +13,8 @@ namespace MediaBrowser.Model.Dlna
_profile = profile;
}
- public string BuildImageHeader(string container,
+ public string BuildImageHeader(
+ string container,
int? width,
int? height,
bool isDirectStream,
@@ -28,8 +29,7 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
- string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
- DlnaMaps.FlagsToString(flagValue));
+ string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
width,
@@ -37,7 +37,7 @@ namespace MediaBrowser.Model.Dlna
if (string.IsNullOrEmpty(orgPn))
{
- orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
+ orgPn = mediaProfile?.OrgPn;
}
if (string.IsNullOrEmpty(orgPn))
@@ -50,7 +50,8 @@ namespace MediaBrowser.Model.Dlna
return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
}
- public string BuildAudioHeader(string container,
+ public string BuildAudioHeader(
+ string container,
string audioCodec,
int? audioBitrate,
int? audioSampleRate,
@@ -102,7 +103,8 @@ namespace MediaBrowser.Model.Dlna
return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';');
}
- public List<string> BuildVideoHeader(string container,
+ public List<string> BuildVideoHeader(
+ string container,
string videoCodec,
string audioCodec,
int? width,
@@ -206,7 +208,7 @@ namespace MediaBrowser.Model.Dlna
return contentFeatureList;
}
- private string GetImageOrgPnValue(string container, int? width, int? height)
+ private static string GetImageOrgPnValue(string container, int? width, int? height)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveImageFormat(container,
@@ -216,7 +218,7 @@ namespace MediaBrowser.Model.Dlna
return format.HasValue ? format.Value.ToString() : null;
}
- private string GetAudioOrgPnValue(string container, int? audioBitrate, int? audioSampleRate, int? audioChannels)
+ private static string GetAudioOrgPnValue(string container, int? audioBitrate, int? audioSampleRate, int? audioChannels)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveAudioFormat(container,
@@ -227,7 +229,7 @@ namespace MediaBrowser.Model.Dlna
return format.HasValue ? format.Value.ToString() : null;
}
- private string[] GetVideoOrgPnValue(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestamp)
+ private static string[] GetVideoOrgPnValue(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestamp)
{
return new MediaFormatProfileResolver().ResolveVideoFormat(container, videoCodec, audioCodec, width, height, timestamp);
}
diff --git a/MediaBrowser.Model/Services/IHttpRequest.cs b/MediaBrowser.Model/Services/IHttpRequest.cs
index 50c6076f3..daf91488f 100644
--- a/MediaBrowser.Model/Services/IHttpRequest.cs
+++ b/MediaBrowser.Model/Services/IHttpRequest.cs
@@ -8,26 +8,6 @@ namespace MediaBrowser.Model.Services
string HttpMethod { get; }
/// <summary>
- /// The IP Address of the X-Forwarded-For header, null if null or empty
- /// </summary>
- string XForwardedFor { get; }
-
- /// <summary>
- /// The Port number of the X-Forwarded-Port header, null if null or empty
- /// </summary>
- int? XForwardedPort { get; }
-
- /// <summary>
- /// The http or https scheme of the X-Forwarded-Proto header, null if null or empty
- /// </summary>
- string XForwardedProtocol { get; }
-
- /// <summary>
- /// The value of the X-Real-IP header, null if null or empty
- /// </summary>
- string XRealIp { get; }
-
- /// <summary>
/// The value of the Accept HTTP Request Header
/// </summary>
string Accept { get; }
diff --git a/MediaBrowser.Model/System/PublicSystemInfo.cs b/MediaBrowser.Model/System/PublicSystemInfo.cs
index d97eda352..d6e031e42 100644
--- a/MediaBrowser.Model/System/PublicSystemInfo.cs
+++ b/MediaBrowser.Model/System/PublicSystemInfo.cs
@@ -25,6 +25,11 @@ namespace MediaBrowser.Model.System
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
+
+ /// <summary>
+ /// The product name. This is the AssemblyProduct name.
+ /// </summary>
+ public string ProductName { get; set; }
/// <summary>
/// Gets or sets the operating system.
diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs
index 222c10798..3f73cc4e0 100644
--- a/MediaBrowser.Model/System/SystemInfo.cs
+++ b/MediaBrowser.Model/System/SystemInfo.cs
@@ -32,10 +32,6 @@ namespace MediaBrowser.Model.System
/// <value>The display name of the operating system.</value>
public string OperatingSystemDisplayName { get; set; }
- /// <summary>
- /// The product name. This is the AssemblyProduct name.
- /// </summary>
- public string ProductName { get; set; }
/// <summary>
/// Get or sets the package name.