aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2020-12-22 14:07:01 +0000
committerBaronGreenback <jimcartlidge@yahoo.co.uk>2020-12-22 14:07:01 +0000
commit621e6d28cda49fac580cf8c9c672b5fdfd3f743b (patch)
tree98c2eb40376559d081962171f9b91390b97f8e32
parent3633996a53385d78601df33286b47415475ae3bb (diff)
Fallback to default guid
-rw-r--r--Emby.Server.Implementations/Plugins/PluginManager.cs12
-rw-r--r--MediaBrowser.Common/Json/Converters/JsonGuidDashConverter.cs26
-rw-r--r--MediaBrowser.Common/Plugins/PluginManifest.cs40
3 files changed, 40 insertions, 38 deletions
diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs
index b46c19995..33faa5e9d 100644
--- a/Emby.Server.Implementations/Plugins/PluginManager.cs
+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs
@@ -51,8 +51,18 @@ namespace Emby.Server.Implementations.Plugins
_pluginsPath = pluginsPath;
_appVersion = appVersion ?? throw new ArgumentNullException(nameof(appVersion));
_jsonOptions = JsonDefaults.GetOptions();
- _jsonOptions.Converters.Add(new JsonGuidDashConverter());
_jsonOptions.WriteIndented = true;
+
+ // We need to use the default GUID converter, so we need to remove any custom ones.
+ for (int a = _jsonOptions.Converters.Count - 1; a >= 0; a--)
+ {
+ if (_jsonOptions.Converters[a] is JsonGuidConverter convertor)
+ {
+ _jsonOptions.Converters.Remove(convertor);
+ break;
+ }
+ }
+
_config = config;
_appHost = appHost;
_minimumVersion = new Version(0, 0, 0, 1);
diff --git a/MediaBrowser.Common/Json/Converters/JsonGuidDashConverter.cs b/MediaBrowser.Common/Json/Converters/JsonGuidDashConverter.cs
deleted file mode 100644
index 75bab5875..000000000
--- a/MediaBrowser.Common/Json/Converters/JsonGuidDashConverter.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Globalization;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace MediaBrowser.Common.Json.Converters
-{
- /// <summary>
- /// Converts a GUID object or value to/from JSON.
- /// </summary>
- public class JsonGuidDashConverter : JsonConverter<Guid>
- {
- /// <inheritdoc />
- public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- var guidStr = reader.GetString();
- return guidStr == null ? Guid.Empty : new Guid(guidStr);
- }
-
- /// <inheritdoc />
- public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)
- {
- writer.WriteStringValue(value.ToString());
- }
- }
-}
diff --git a/MediaBrowser.Common/Plugins/PluginManifest.cs b/MediaBrowser.Common/Plugins/PluginManifest.cs
index 956a91f85..334c8d908 100644
--- a/MediaBrowser.Common/Plugins/PluginManifest.cs
+++ b/MediaBrowser.Common/Plugins/PluginManifest.cs
@@ -1,7 +1,7 @@
#nullable enable
+
using System;
using System.Text.Json.Serialization;
-using MediaBrowser.Common.Json.Converters;
using MediaBrowser.Model.Plugins;
namespace MediaBrowser.Common.Plugins
@@ -12,53 +12,70 @@ namespace MediaBrowser.Common.Plugins
public class PluginManifest
{
/// <summary>
+ /// Initializes a new instance of the <see cref="PluginManifest"/> class.
+ /// </summary>
+ public PluginManifest()
+ {
+ Category = string.Empty;
+ Changelog = string.Empty;
+ Description = string.Empty;
+ Status = PluginStatus.Active;
+ Id = Guid.Empty;
+ Name = string.Empty;
+ Owner = string.Empty;
+ Overview = string.Empty;
+ TargetAbi = string.Empty;
+ Version = string.Empty;
+ AutoUpdate = true;
+ }
+
+ /// <summary>
/// Gets or sets the category of the plugin.
/// </summary>
[JsonPropertyName("category")]
- public string Category { get; set; } = string.Empty;
+ public string Category { get; set; }
/// <summary>
/// Gets or sets the changelog information.
/// </summary>
[JsonPropertyName("changelog")]
- public string Changelog { get; set; } = string.Empty;
+ public string Changelog { get; set; }
/// <summary>
/// Gets or sets the description of the plugin.
/// </summary>
[JsonPropertyName("description")]
- public string Description { get; set; } = string.Empty;
+ public string Description { get; set; }
/// <summary>
/// Gets or sets the Global Unique Identifier for the plugin.
/// </summary>
[JsonPropertyName("guid")]
- [JsonConverter(typeof(JsonGuidDashConverter))]
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the Name of the plugin.
/// </summary>
[JsonPropertyName("name")]
- public string Name { get; set; } = string.Empty;
+ public string Name { get; set; }
/// <summary>
/// Gets or sets an overview of the plugin.
/// </summary>
[JsonPropertyName("overview")]
- public string Overview { get; set; } = string.Empty;
+ public string Overview { get; set; }
/// <summary>
/// Gets or sets the owner of the plugin.
/// </summary>
[JsonPropertyName("owner")]
- public string Owner { get; set; } = string.Empty;
+ public string Owner { get; set; }
/// <summary>
/// Gets or sets the compatibility version for the plugin.
/// </summary>
[JsonPropertyName("targetAbi")]
- public string TargetAbi { get; set; } = string.Empty;
+ public string TargetAbi { get; set; }
/// <summary>
/// Gets or sets the timestamp of the plugin.
@@ -70,7 +87,7 @@ namespace MediaBrowser.Common.Plugins
/// Gets or sets the Version number of the plugin.
/// </summary>
[JsonPropertyName("version")]
- public string Version { get; set; } = string.Empty;
+ public string Version { get; set; }
/// <summary>
/// Gets or sets a value indicating the operational status of this plugin.
@@ -82,9 +99,10 @@ namespace MediaBrowser.Common.Plugins
/// Gets or sets a value indicating whether this plugin should automatically update.
/// </summary>
[JsonPropertyName("autoUpdate")]
- public bool AutoUpdate { get; set; } = true;
+ public bool AutoUpdate { get; set; }
/// <summary>
+ /// Gets or sets the ImagePath
/// Gets or sets a value indicating whether this plugin has an image.
/// Image must be located in the local plugin folder.
/// </summary>