mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Added a release notes page, you can access via Admin>Updates>Recent Changes tab. Note to self, need to put better comments in for users to understand!
This commit is contained in:
parent
14ac399886
commit
2804191781
14 changed files with 451 additions and 70 deletions
|
@ -35,8 +35,10 @@ using MarkdownSharp;
|
|||
using Nancy;
|
||||
using Nancy.ModelBinding;
|
||||
using Nancy.Responses.Negotiation;
|
||||
using Ombi.Api.Interfaces;
|
||||
using Ombi.Common.Processes;
|
||||
using Ombi.Core;
|
||||
using Ombi.Core.Models;
|
||||
using Ombi.Core.SettingModels;
|
||||
using Ombi.Core.StatusChecker;
|
||||
using Ombi.Helpers;
|
||||
|
@ -50,11 +52,13 @@ namespace Ombi.UI.Modules.Admin
|
|||
{
|
||||
public class SystemStatusModule : BaseModule
|
||||
{
|
||||
public SystemStatusModule(ISettingsService<PlexRequestSettings> settingsService, ICacheProvider cache, ISettingsService<SystemSettings> ss, ISecurityExtensions security, IAnalytics a) : base("admin", settingsService, security)
|
||||
public SystemStatusModule(ISettingsService<PlexRequestSettings> settingsService, ICacheProvider cache, ISettingsService<SystemSettings> ss,
|
||||
ISecurityExtensions security, IAnalytics a, IAppveyorApi appveyor) : base("admin", settingsService, security)
|
||||
{
|
||||
Cache = cache;
|
||||
SystemSettings = ss;
|
||||
Analytics = a;
|
||||
AppveyorApi = appveyor;
|
||||
|
||||
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
||||
|
||||
|
@ -62,11 +66,13 @@ namespace Ombi.UI.Modules.Admin
|
|||
Post["/save", true] = async (x, ct) => await Save();
|
||||
|
||||
Post["/autoupdate"] = x => AutoUpdate();
|
||||
Get["/changes", true] = async (x, ct) => await GetLatestChanges();
|
||||
}
|
||||
|
||||
private ICacheProvider Cache { get; }
|
||||
private ISettingsService<SystemSettings> SystemSettings { get; }
|
||||
private IAnalytics Analytics { get; }
|
||||
private IAppveyorApi AppveyorApi { get; }
|
||||
|
||||
private async Task<Negotiator> Status()
|
||||
{
|
||||
|
@ -82,19 +88,19 @@ namespace Ombi.UI.Modules.Admin
|
|||
{
|
||||
new BranchDropdown
|
||||
{
|
||||
Name = EnumHelper<Branches>.GetDisplayValue(Branches.Stable),
|
||||
Name =EnumHelper<Branches>.GetBranchValue<BranchAttribute>(Branches.Stable).DisplayName,
|
||||
Value = Branches.Stable,
|
||||
Selected = settings.Branch == Branches.Stable
|
||||
},
|
||||
new BranchDropdown
|
||||
{
|
||||
Name = EnumHelper<Branches>.GetDisplayValue(Branches.EarlyAccessPreview),
|
||||
Name = EnumHelper<Branches>.GetBranchValue<BranchAttribute>(Branches.EarlyAccessPreview).DisplayName,
|
||||
Value = Branches.EarlyAccessPreview,
|
||||
Selected = settings.Branch == Branches.EarlyAccessPreview
|
||||
},
|
||||
new BranchDropdown
|
||||
{
|
||||
Name = EnumHelper<Branches>.GetDisplayValue(Branches.Dev),
|
||||
Name = EnumHelper<Branches>.GetBranchValue<BranchAttribute>(Branches.Dev).DisplayName,
|
||||
Value = Branches.Dev,
|
||||
Selected = settings.Branch == Branches.Dev
|
||||
},
|
||||
|
@ -103,6 +109,34 @@ namespace Ombi.UI.Modules.Admin
|
|||
return View["Status", settings];
|
||||
}
|
||||
|
||||
public async Task<Response> GetLatestChanges()
|
||||
{
|
||||
var settings = await SystemSettings.GetSettingsAsync();
|
||||
var branchName = EnumHelper<Branches>.GetBranchValue<BranchAttribute>(settings.Branch).BranchName;
|
||||
var changes = AppveyorApi.GetProjectHistory(branchName);
|
||||
var currentVersion = AssemblyHelper.GetProductVersion();
|
||||
var model = new List<RecentUpdatesModel>();
|
||||
|
||||
foreach (var build in changes.builds)
|
||||
{
|
||||
model.Add(new RecentUpdatesModel
|
||||
{
|
||||
Date = build.finished,
|
||||
Message = BuildAppveyorMessage(build.message, build.messageExtended),
|
||||
Version = build.version,
|
||||
Installed = currentVersion.Equals(build.version, StringComparison.CurrentCultureIgnoreCase) ,
|
||||
Branch = branchName
|
||||
});
|
||||
}
|
||||
|
||||
return Response.AsJson(model);
|
||||
}
|
||||
|
||||
private string BuildAppveyorMessage(string message, string extended)
|
||||
{
|
||||
return extended == null ? message : $"{message} {extended}";
|
||||
}
|
||||
|
||||
private async Task<Response> Save()
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue