diff --git a/PlexRequests.Core.Tests/PlexRequests.Core.Tests.csproj b/PlexRequests.Core.Tests/PlexRequests.Core.Tests.csproj
index bbcac92ee..7674966ff 100644
--- a/PlexRequests.Core.Tests/PlexRequests.Core.Tests.csproj
+++ b/PlexRequests.Core.Tests/PlexRequests.Core.Tests.csproj
@@ -59,6 +59,7 @@
+
@@ -71,6 +72,10 @@
{DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}
PlexRequests.Core
+
+ {1252336D-42A3-482A-804C-836E60173DFA}
+ PlexRequests.Helpers
+
diff --git a/PlexRequests.Core.Tests/StatusCheckerTests.cs b/PlexRequests.Core.Tests/StatusCheckerTests.cs
new file mode 100644
index 000000000..aaacaf78a
--- /dev/null
+++ b/PlexRequests.Core.Tests/StatusCheckerTests.cs
@@ -0,0 +1,43 @@
+#region Copyright
+// /************************************************************************
+// Copyright (c) 2016 Jamie Rees
+// File: AuthenticationSettingsTests.cs
+// Created By: Jamie Rees
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ************************************************************************/
+#endregion
+using NUnit.Framework;
+
+namespace PlexRequests.Core.Tests
+{
+ [TestFixture]
+ public class StatusCheckerTests
+ {
+ [Test]
+ public void CheckStatusTest()
+ {
+ var checker = new StatusChecker();
+ var status = checker.GetStatus();
+
+ Assert.That(status, Is.Not.Null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PlexRequests.Core.Tests/app.config b/PlexRequests.Core.Tests/app.config
index 7503b02ee..ee433ca9b 100644
--- a/PlexRequests.Core.Tests/app.config
+++ b/PlexRequests.Core.Tests/app.config
@@ -1,11 +1,11 @@
-
+
-
-
+
+
-
+
diff --git a/PlexRequests.Core/Models/StatusModel.cs b/PlexRequests.Core/Models/StatusModel.cs
new file mode 100644
index 000000000..33d8f0fe1
--- /dev/null
+++ b/PlexRequests.Core/Models/StatusModel.cs
@@ -0,0 +1,37 @@
+#region Copyright
+// /************************************************************************
+// Copyright (c) 2016 Jamie Rees
+// File: StatusModel.cs
+// Created By: Jamie Rees
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ************************************************************************/
+#endregion
+
+namespace PlexRequests.Core.Models
+{
+ public class StatusModel
+ {
+ public string Version { get; set; }
+ public bool UpdateAvailable { get; set; }
+ public int ReleasesBehind { get; set; }
+ public string UpdateUri { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/PlexRequests.Core/PlexRequests.Core.csproj b/PlexRequests.Core/PlexRequests.Core.csproj
index 79aca698c..eb20f81d1 100644
--- a/PlexRequests.Core/PlexRequests.Core.csproj
+++ b/PlexRequests.Core/PlexRequests.Core.csproj
@@ -46,6 +46,10 @@
..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll
True
+
+ ..\packages\Octokit.0.19.0\lib\net45\Octokit.dll
+ True
+
..\packages\valueinjecter.3.1.1.2\lib\net40\Omu.ValueInjecter.dll
True
@@ -66,6 +70,7 @@
+
@@ -77,6 +82,7 @@
+
diff --git a/PlexRequests.Core/StatusChecker.cs b/PlexRequests.Core/StatusChecker.cs
new file mode 100644
index 000000000..e4c939206
--- /dev/null
+++ b/PlexRequests.Core/StatusChecker.cs
@@ -0,0 +1,78 @@
+#region Copyright
+// /************************************************************************
+// Copyright (c) 2016 Jamie Rees
+// File: StatusChecker.cs
+// Created By: Jamie Rees
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ************************************************************************/
+#endregion
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.Versioning;
+using System.Threading.Tasks;
+
+using Octokit;
+
+using PlexRequests.Core.Models;
+using PlexRequests.Helpers;
+
+namespace PlexRequests.Core
+{
+ public class StatusChecker
+ {
+ public StatusChecker()
+ {
+ Git = new GitHubClient(new ProductHeaderValue("PlexRequests-StatusChecker"));
+ }
+ private IGitHubClient Git { get; }
+ private const string Owner = "tidusjar";
+ private const string RepoName = "PlexRequests.Net";
+
+ public async Task GetLatestRelease()
+ {
+ var releases = await Git.Repository.Release.GetAll(Owner, RepoName);
+ return releases.FirstOrDefault();
+ }
+
+ public StatusModel GetStatus()
+ {
+ var assemblyVersion = AssemblyHelper.GetAssemblyVersion();
+ var model = new StatusModel
+ {
+ Version = assemblyVersion,
+ };
+
+ var latestRelease = GetLatestRelease();
+
+ var latestVersionArray = latestRelease.Result.Name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+ var latestVersion = latestVersionArray.Length > 1 ? latestVersionArray[1] : string.Empty;
+
+ if (!latestVersion.Equals(AssemblyHelper.GetReleaseVersion(), StringComparison.InvariantCultureIgnoreCase))
+ {
+ model.UpdateAvailable = true;
+ model.UpdateUri = latestRelease.Result.HtmlUrl;
+ }
+
+ return model;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PlexRequests.Core/app.config b/PlexRequests.Core/app.config
index 7503b02ee..ee433ca9b 100644
--- a/PlexRequests.Core/app.config
+++ b/PlexRequests.Core/app.config
@@ -1,11 +1,11 @@
-
+
-
-
+
+
-
+
diff --git a/PlexRequests.Core/packages.config b/PlexRequests.Core/packages.config
index 2d5fcc6ef..ddcb2361b 100644
--- a/PlexRequests.Core/packages.config
+++ b/PlexRequests.Core/packages.config
@@ -3,5 +3,6 @@
+
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/AssemblyHelperTests.cs b/PlexRequests.Helpers.Tests/AssemblyHelperTests.cs
new file mode 100644
index 000000000..689bfd039
--- /dev/null
+++ b/PlexRequests.Helpers.Tests/AssemblyHelperTests.cs
@@ -0,0 +1,42 @@
+#region Copyright
+// /************************************************************************
+// Copyright (c) 2016 Jamie Rees
+// File: AssemblyHelperTests.cs
+// Created By: Jamie Rees
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ************************************************************************/
+#endregion
+using NUnit.Framework;
+
+namespace PlexRequests.Helpers.Tests
+{
+ [TestFixture]
+ public class AssemblyHelperTests
+ {
+ [Test]
+ public void GetReleaseVersionTest()
+ {
+ var result = AssemblyHelper.GetReleaseVersion();
+ Assert.That(result, Contains.Substring("v"));
+ Assert.That(result, Is.Not.EqualTo("1.0.0.0"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj b/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj
index 0fa7e92d8..54af6aebe 100644
--- a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj
+++ b/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj
@@ -35,14 +35,6 @@
4
-
- ..\packages\Hangfire.Core.1.5.3\lib\net45\Hangfire.Core.dll
- True
-
-
- ..\packages\Hangfire.SqlServer.1.5.3\lib\net45\Hangfire.SqlServer.dll
- True
-
..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll
True
@@ -78,6 +70,7 @@
+
diff --git a/PlexRequests.Helpers/AssemblyHelper.cs b/PlexRequests.Helpers/AssemblyHelper.cs
index a2a1b6163..c1a03d2b7 100644
--- a/PlexRequests.Helpers/AssemblyHelper.cs
+++ b/PlexRequests.Helpers/AssemblyHelper.cs
@@ -37,5 +37,13 @@ namespace PlexRequests.Helpers
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return fvi.FileVersion;
}
+
+ public static string GetReleaseVersion()
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
+ var retVersion = "v" + fvi.FileVersion.Substring(0, fvi.FileVersion.Length - 2);
+ return retVersion;
+ }
}
}
\ No newline at end of file
diff --git a/PlexRequests.Services.Tests/PlexRequests.Services.Tests.csproj b/PlexRequests.Services.Tests/PlexRequests.Services.Tests.csproj
index 0f9c7f1c1..175b4f0f8 100644
--- a/PlexRequests.Services.Tests/PlexRequests.Services.Tests.csproj
+++ b/PlexRequests.Services.Tests/PlexRequests.Services.Tests.csproj
@@ -59,6 +59,7 @@
+
diff --git a/PlexRequests.Services.Tests/app.config b/PlexRequests.Services.Tests/app.config
new file mode 100644
index 000000000..ac2586ac9
--- /dev/null
+++ b/PlexRequests.Services.Tests/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PlexRequests.Services/PlexRequests.Services.csproj b/PlexRequests.Services/PlexRequests.Services.csproj
index e817d50d3..3a18c5a04 100644
--- a/PlexRequests.Services/PlexRequests.Services.csproj
+++ b/PlexRequests.Services/PlexRequests.Services.csproj
@@ -82,6 +82,7 @@
+
diff --git a/PlexRequests.Services/app.config b/PlexRequests.Services/app.config
new file mode 100644
index 000000000..ac2586ac9
--- /dev/null
+++ b/PlexRequests.Services/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PlexRequests.UI/Modules/AdminModule.cs b/PlexRequests.UI/Modules/AdminModule.cs
index 52c67eb08..70c7e5fb0 100644
--- a/PlexRequests.UI/Modules/AdminModule.cs
+++ b/PlexRequests.UI/Modules/AdminModule.cs
@@ -100,6 +100,7 @@ namespace PlexRequests.UI.Modules
Get["/emailnotification"] = _ => EmailNotifications();
Post["/emailnotification"] = _ => SaveEmailNotifications();
+ Get["/status"] = _ => Status();
}
private Negotiator Authentication()
@@ -272,5 +273,12 @@ namespace PlexRequests.UI.Modules
Log.Info("Saved email settings, result: {0}", result);
return Context.GetRedirect("~/admin/emailnotification");
}
+
+ private Negotiator Status()
+ {
+ var checker = new StatusChecker();
+ var status = checker.GetStatus();
+ return View["Status", status];
+ }
}
}
\ No newline at end of file
diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj
index 901540af6..430232605 100644
--- a/PlexRequests.UI/PlexRequests.UI.csproj
+++ b/PlexRequests.UI/PlexRequests.UI.csproj
@@ -300,6 +300,9 @@
Always
+
+ Always
+
web.config
diff --git a/PlexRequests.UI/Views/Admin/Status.cshtml b/PlexRequests.UI/Views/Admin/Status.cshtml
new file mode 100644
index 000000000..1cb621f3c
--- /dev/null
+++ b/PlexRequests.UI/Views/Admin/Status.cshtml
@@ -0,0 +1,18 @@
+@Html.Partial("_Sidebar")
+
+
\ No newline at end of file
diff --git a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml
index f414c0769..7733857e8 100644
--- a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml
+++ b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml
@@ -54,5 +54,14 @@
{
Email Notifications
}
+
+ @if (Context.Request.Path == "/admin/status")
+ {
+ Status/a>
+ }
+ else
+ {
+ Status
+ }
\ No newline at end of file
diff --git a/PlexRequests.sln b/PlexRequests.sln
index 69ed4c4e6..4cdca72cf 100644
--- a/PlexRequests.sln
+++ b/PlexRequests.sln
@@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Api.Models", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Services.Tests", "PlexRequests.Services.Tests\PlexRequests.Services.Tests.csproj", "{EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Helpers.Tests", "PlexRequests.Helpers.Tests\PlexRequests.Helpers.Tests.csproj", "{0E6395D3-B074-49E8-898D-0EB99E507E0E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -83,6 +85,10 @@ Global
{EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE