diff --git a/PlexRequests.Core.Migration/Migrations/Version1100.cs b/PlexRequests.Core.Migration/Migrations/Version1100.cs index 7e23cbdbe..bfe819fd3 100644 --- a/PlexRequests.Core.Migration/Migrations/Version1100.cs +++ b/PlexRequests.Core.Migration/Migrations/Version1100.cs @@ -243,7 +243,7 @@ namespace PlexRequests.Core.Migration.Migrations { return; } - var requestedModels = allRequests as RequestedModel[] ?? allRequests.ToArray(); + var requestedModels = allRequests.ToList(); foreach (var req in requestedModels) { if (req.PosterPath.Contains("https://image.tmdb.org/t/p/w150/")) diff --git a/PlexRequests.Helpers/Analytics/Analytics.cs b/PlexRequests.Helpers/Analytics/Analytics.cs index ed7eed4fd..67a92ed33 100644 --- a/PlexRequests.Helpers/Analytics/Analytics.cs +++ b/PlexRequests.Helpers/Analytics/Analytics.cs @@ -49,41 +49,89 @@ namespace PlexRequests.Helpers.Analytics public void TrackEvent(Category category, Action action, string label, string username, string clientId, int? value = null) { - var cat = category.ToString(); - var act = action.ToString(); - Track(HitType.@event, username, cat, act, label, clientId, value); + try + { + + var cat = category.ToString(); + var act = action.ToString(); + Track(HitType.@event, username, cat, act, label, clientId, value); + } + catch (Exception ex) + { + Log.Error(ex); + } } public async void TrackEventAsync(Category category, Action action, string label, string username, string clientId, int? value = null) { - var cat = category.ToString(); - var act = action.ToString(); - await TrackAsync(HitType.@event, username, cat, act, clientId, label, value); + try + { + var cat = category.ToString(); + var act = action.ToString(); + await TrackAsync(HitType.@event, username, cat, act, clientId, label, value); + + } + catch (Exception ex) + { + Log.Error(ex); + } } public void TrackPageview(Category category, Action action, string label, string username, string clientId, int? value = null) { - var cat = category.ToString(); - var act = action.ToString(); - Track(HitType.@pageview, username, cat, act, clientId, label, value); + try + { + var cat = category.ToString(); + var act = action.ToString(); + Track(HitType.@pageview, username, cat, act, clientId, label, value); + + } + catch (Exception ex) + { + Log.Error(ex); + } } public async Task TrackPageviewAsync(Category category, Action action, string label, string username, string clientId, int? value = null) { - var cat = category.ToString(); - var act = action.ToString(); - await TrackAsync(HitType.@pageview, username, cat, act, clientId, label, value); + try + { + var cat = category.ToString(); + var act = action.ToString(); + await TrackAsync(HitType.@pageview, username, cat, act, clientId, label, value); + + } + catch (Exception ex) + { + Log.Error(ex); + } } public void TrackException(string message, string username, string clientId, bool fatal) { - var fatalInt = fatal ? 1 : 0; - Track(HitType.exception, message, fatalInt, username, clientId); + try + { + + var fatalInt = fatal ? 1 : 0; + Track(HitType.exception, message, fatalInt, username, clientId); + } + catch (Exception ex) + { + Log.Error(ex); + } } public async Task TrackExceptionAsync(string message, string username, string clientId, bool fatal) { - var fatalInt = fatal ? 1 : 0; - await TrackAsync(HitType.exception, message, fatalInt, username, clientId); + try + { + + var fatalInt = fatal ? 1 : 0; + await TrackAsync(HitType.exception, message, fatalInt, username, clientId); + } + catch (Exception ex) + { + Log.Error(ex); + } } private void Track(HitType type, string username, string category, string action, string clientId, string label, int? value = null) diff --git a/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs b/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs index 3f5b33947..32bc92abe 100644 --- a/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs +++ b/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs @@ -28,6 +28,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; +using System.Reflection; using System.Threading.Tasks; using MarkdownSharp; using Nancy; @@ -118,10 +120,23 @@ namespace PlexRequests.UI.Modules.Admin Analytics.TrackEventAsync(Category.Admin, PlexRequests.Helpers.Analytics.Action.Update, "AutoUpdate", Username, CookieHelper.GetAnalyticClientId(Cookies)); var url = Request.Form["url"]; + var args = (string)Request.Form["args"].ToString(); + var lowered = args.ToLower(); + var appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(SystemStatusModule)).Location ?? string.Empty) ?? string.Empty, "PlexRequests.Updater.exe"); + + if (!string.IsNullOrEmpty(lowered)) + { + if (lowered.Contains("plexrequests.exe")) + { + lowered = lowered.Replace("plexrequests.exe", ""); + } + } + + var startArgs = string.IsNullOrEmpty(lowered) ? appPath : $"{lowered} Plexrequests.Updater.exe"; var startInfo = Type.GetType("Mono.Runtime") != null - ? new ProcessStartInfo("mono PlexRequests.Updater.exe") { Arguments = url } - : new ProcessStartInfo("PlexRequests.Updater.exe") { Arguments = url }; + ? new ProcessStartInfo(startArgs) { Arguments = $"{url} {lowered}", } + : new ProcessStartInfo(startArgs) { Arguments = $"{url} {lowered}" }; Process.Start(startInfo); diff --git a/PlexRequests.UI/Program.cs b/PlexRequests.UI/Program.cs index 2153aca13..76f00396e 100644 --- a/PlexRequests.UI/Program.cs +++ b/PlexRequests.UI/Program.cs @@ -128,7 +128,7 @@ namespace PlexRequests.UI private static void WriteOutVersion() { - var assemblyVer = AssemblyHelper.GetProductVersion(); + var assemblyVer = AssemblyHelper.GetFileVersion(); Log.Info($"Version: {assemblyVer}"); Console.WriteLine($"Version: {assemblyVer}"); } diff --git a/PlexRequests.UI/Views/SystemStatus/Status.cshtml b/PlexRequests.UI/Views/SystemStatus/Status.cshtml index 6b1c65403..9dd06986a 100644 --- a/PlexRequests.UI/Views/SystemStatus/Status.cshtml +++ b/PlexRequests.UI/Views/SystemStatus/Status.cshtml @@ -11,7 +11,7 @@ - + @if (Model.Status.UpdateAvailable) {