mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 07:22:35 -07:00
Almost finished #659
This commit is contained in:
parent
367ca391b1
commit
0950f20278
14 changed files with 543 additions and 119 deletions
11
PlexRequests.Core/IStatusChecker.cs
Normal file
11
PlexRequests.Core/IStatusChecker.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Octokit;
|
||||||
|
using PlexRequests.Core.Models;
|
||||||
|
|
||||||
|
namespace PlexRequests.Core
|
||||||
|
{
|
||||||
|
public interface IStatusChecker
|
||||||
|
{
|
||||||
|
Task<StatusModel> GetStatus();
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,6 +54,10 @@
|
||||||
<HintPath>..\packages\Quartz.2.3.3\lib\net40\Quartz.dll</HintPath>
|
<HintPath>..\packages\Quartz.2.3.3\lib\net40\Quartz.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
@ -82,6 +86,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CacheKeys.cs" />
|
<Compile Include="CacheKeys.cs" />
|
||||||
<Compile Include="IPlexReadOnlyDatabase.cs" />
|
<Compile Include="IPlexReadOnlyDatabase.cs" />
|
||||||
|
<Compile Include="IStatusChecker.cs" />
|
||||||
<Compile Include="Notification\NotificationMessage.cs" />
|
<Compile Include="Notification\NotificationMessage.cs" />
|
||||||
<Compile Include="Notification\NotificationMessageContent.cs" />
|
<Compile Include="Notification\NotificationMessageContent.cs" />
|
||||||
<Compile Include="Notification\NotificationMessageCurlys.cs" />
|
<Compile Include="Notification\NotificationMessageCurlys.cs" />
|
||||||
|
@ -120,9 +125,12 @@
|
||||||
<Compile Include="SettingModels\CouchPotatoSettings.cs" />
|
<Compile Include="SettingModels\CouchPotatoSettings.cs" />
|
||||||
<Compile Include="SettingModels\PlexRequestSettings.cs" />
|
<Compile Include="SettingModels\PlexRequestSettings.cs" />
|
||||||
<Compile Include="SettingModels\Settings.cs" />
|
<Compile Include="SettingModels\Settings.cs" />
|
||||||
|
<Compile Include="SettingModels\SystemSettings.cs" />
|
||||||
<Compile Include="SettingsServiceV2.cs" />
|
<Compile Include="SettingsServiceV2.cs" />
|
||||||
<Compile Include="Setup.cs" />
|
<Compile Include="Setup.cs" />
|
||||||
<Compile Include="StatusChecker.cs" />
|
<Compile Include="StatusChecker\AppveyorArtifactResult.cs" />
|
||||||
|
<Compile Include="StatusChecker\StatusChecker.cs" />
|
||||||
|
<Compile Include="StatusChecker\AppveyorBranchResult.cs" />
|
||||||
<Compile Include="UserIdentity.cs" />
|
<Compile Include="UserIdentity.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UserMapper.cs" />
|
<Compile Include="UserMapper.cs" />
|
||||||
|
|
38
PlexRequests.Core/SettingModels/SystemSettings.cs
Normal file
38
PlexRequests.Core/SettingModels/SystemSettings.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: SystemSettings.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 PlexRequests.Core.Models;
|
||||||
|
|
||||||
|
namespace PlexRequests.Core.SettingModels
|
||||||
|
{
|
||||||
|
public class SystemSettings : Settings
|
||||||
|
{
|
||||||
|
public bool UseEarlyAccessPreviewBuilds { get; set; }
|
||||||
|
|
||||||
|
public StatusModel Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,83 +0,0 @@
|
||||||
#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.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<Release> GetLatestRelease()
|
|
||||||
{
|
|
||||||
var releases = await Git.Repository.Release.GetAll(Owner, RepoName);
|
|
||||||
return releases.FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<StatusModel> GetStatus()
|
|
||||||
{
|
|
||||||
var assemblyVersion = AssemblyHelper.GetProductVersion();
|
|
||||||
var model = new StatusModel
|
|
||||||
{
|
|
||||||
Version = assemblyVersion,
|
|
||||||
};
|
|
||||||
|
|
||||||
var latestRelease = await GetLatestRelease();
|
|
||||||
if (latestRelease == null)
|
|
||||||
{
|
|
||||||
return new StatusModel { Version = "Unknown" };
|
|
||||||
}
|
|
||||||
var latestVersionArray = latestRelease.Name.Split(new[] { 'v' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
var latestVersion = latestVersionArray.Length > 1 ? latestVersionArray[1] : string.Empty;
|
|
||||||
|
|
||||||
if (!latestVersion.Equals(assemblyVersion, StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
model.UpdateAvailable = true;
|
|
||||||
model.UpdateUri = latestRelease.HtmlUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
model.ReleaseNotes = latestRelease.Body;
|
|
||||||
model.DownloadUri = latestRelease.Assets[0].BrowserDownloadUrl;
|
|
||||||
model.ReleaseTitle = latestRelease.Name;
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
35
PlexRequests.Core/StatusChecker/AppveyorArtifactResult.cs
Normal file
35
PlexRequests.Core/StatusChecker/AppveyorArtifactResult.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: AppveyorArtifactResult.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.StatusChecker
|
||||||
|
{
|
||||||
|
public class AppveyorArtifactResult
|
||||||
|
{
|
||||||
|
public string fileName { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public int size { get; set; }
|
||||||
|
}
|
||||||
|
}
|
138
PlexRequests.Core/StatusChecker/AppveyorBranchResult.cs
Normal file
138
PlexRequests.Core/StatusChecker/AppveyorBranchResult.cs
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: AppveyorBranchResult.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.Collections.Generic;
|
||||||
|
|
||||||
|
namespace PlexRequests.Core.StatusChecker
|
||||||
|
{
|
||||||
|
public class NuGetFeed
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public bool publishingEnabled { get; set; }
|
||||||
|
public string created { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AccessRightDefinition
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string description { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AccessRight
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public bool allowed { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RoleAce
|
||||||
|
{
|
||||||
|
public int roleId { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public bool isAdmin { get; set; }
|
||||||
|
public List<AccessRight> accessRights { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SecurityDescriptor
|
||||||
|
{
|
||||||
|
public List<AccessRightDefinition> accessRightDefinitions { get; set; }
|
||||||
|
public List<RoleAce> roleAces { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Project
|
||||||
|
{
|
||||||
|
public int projectId { get; set; }
|
||||||
|
public int accountId { get; set; }
|
||||||
|
public string accountName { get; set; }
|
||||||
|
public List<object> builds { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string slug { get; set; }
|
||||||
|
public string repositoryType { get; set; }
|
||||||
|
public string repositoryScm { get; set; }
|
||||||
|
public string repositoryName { get; set; }
|
||||||
|
public string repositoryBranch { get; set; }
|
||||||
|
public bool isPrivate { get; set; }
|
||||||
|
public bool skipBranchesWithoutAppveyorYml { get; set; }
|
||||||
|
public bool enableSecureVariablesInPullRequests { get; set; }
|
||||||
|
public bool enableSecureVariablesInPullRequestsFromSameRepo { get; set; }
|
||||||
|
public bool enableDeploymentInPullRequests { get; set; }
|
||||||
|
public bool rollingBuilds { get; set; }
|
||||||
|
public bool alwaysBuildClosedPullRequests { get; set; }
|
||||||
|
public string tags { get; set; }
|
||||||
|
public NuGetFeed nuGetFeed { get; set; }
|
||||||
|
public SecurityDescriptor securityDescriptor { get; set; }
|
||||||
|
public string created { get; set; }
|
||||||
|
public string updated { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Job
|
||||||
|
{
|
||||||
|
public string jobId { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public bool allowFailure { get; set; }
|
||||||
|
public int messagesCount { get; set; }
|
||||||
|
public int compilationMessagesCount { get; set; }
|
||||||
|
public int compilationErrorsCount { get; set; }
|
||||||
|
public int compilationWarningsCount { get; set; }
|
||||||
|
public int testsCount { get; set; }
|
||||||
|
public int passedTestsCount { get; set; }
|
||||||
|
public int failedTestsCount { get; set; }
|
||||||
|
public int artifactsCount { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
public string started { get; set; }
|
||||||
|
public string finished { get; set; }
|
||||||
|
public string created { get; set; }
|
||||||
|
public string updated { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Build
|
||||||
|
{
|
||||||
|
public int buildId { get; set; }
|
||||||
|
public List<Job> jobs { get; set; }
|
||||||
|
public int buildNumber { get; set; }
|
||||||
|
public string version { get; set; }
|
||||||
|
public string message { get; set; }
|
||||||
|
public string branch { get; set; }
|
||||||
|
public bool isTag { get; set; }
|
||||||
|
public string commitId { get; set; }
|
||||||
|
public string authorName { get; set; }
|
||||||
|
public string committerName { get; set; }
|
||||||
|
public string committed { get; set; }
|
||||||
|
public List<object> messages { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
public string started { get; set; }
|
||||||
|
public string finished { get; set; }
|
||||||
|
public string created { get; set; }
|
||||||
|
public string updated { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AppveyorBranchResult
|
||||||
|
{
|
||||||
|
public Project project { get; set; }
|
||||||
|
public Build build { get; set; }
|
||||||
|
}
|
||||||
|
}
|
153
PlexRequests.Core/StatusChecker/StatusChecker.cs
Normal file
153
PlexRequests.Core/StatusChecker/StatusChecker.cs
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
#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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Octokit;
|
||||||
|
using PlexRequests.Api;
|
||||||
|
using PlexRequests.Core.Models;
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
using RestSharp;
|
||||||
|
|
||||||
|
namespace PlexRequests.Core.StatusChecker
|
||||||
|
{
|
||||||
|
public class StatusChecker : IStatusChecker
|
||||||
|
{
|
||||||
|
public StatusChecker(ISettingsService<SystemSettings> ss)
|
||||||
|
{
|
||||||
|
SystemSettings = ss;
|
||||||
|
Git = new GitHubClient(new ProductHeaderValue("PlexRequests-StatusChecker"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ISettingsService<SystemSettings> SystemSettings { get; }
|
||||||
|
|
||||||
|
private IGitHubClient Git { get; }
|
||||||
|
private const string Owner = "tidusjar";
|
||||||
|
private const string RepoName = "PlexRequests.Net";
|
||||||
|
private const string AppveyorApiUrl = "https://ci.appveyor.com/api";
|
||||||
|
|
||||||
|
private const string Api =
|
||||||
|
"48Ku58C0794nBrXra8IxWav+dc6NqgkRw+PZB3/bQwbt/D0IrnJQkgtjzo0bd6nkooLMKsC8M+Ab7jyBO+ROjY14VRuxffpDopX9r0iG/fjBl6mZVvqkm+VTDNstDtzp";
|
||||||
|
|
||||||
|
public async Task<StatusModel> GetStatus()
|
||||||
|
{
|
||||||
|
var settings = await SystemSettings.GetSettingsAsync();
|
||||||
|
var isEap = settings.UseEarlyAccessPreviewBuilds;
|
||||||
|
|
||||||
|
if (isEap)
|
||||||
|
{
|
||||||
|
// Early Access Preview Releases
|
||||||
|
return GetLatestEapRelease();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stable releases
|
||||||
|
return await GetLatestGithubRelease();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<StatusModel> GetLatestGithubRelease()
|
||||||
|
{
|
||||||
|
var assemblyVersion = AssemblyHelper.GetProductVersion();
|
||||||
|
var model = new StatusModel
|
||||||
|
{
|
||||||
|
Version = assemblyVersion,
|
||||||
|
};
|
||||||
|
|
||||||
|
var releases = await Git.Repository.Release.GetAll(Owner, RepoName);
|
||||||
|
var latestRelease = releases.FirstOrDefault();
|
||||||
|
|
||||||
|
if (latestRelease == null)
|
||||||
|
{
|
||||||
|
return new StatusModel { Version = "Unknown" };
|
||||||
|
}
|
||||||
|
var latestVersionArray = latestRelease.Name.Split(new[] { 'v' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
var latestVersion = latestVersionArray.Length > 1 ? latestVersionArray[1] : string.Empty;
|
||||||
|
|
||||||
|
if (!latestVersion.Equals(assemblyVersion, StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
model.UpdateAvailable = true;
|
||||||
|
model.UpdateUri = latestRelease.HtmlUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.ReleaseNotes = latestRelease.Body;
|
||||||
|
model.DownloadUri = latestRelease.Assets[0].BrowserDownloadUrl;
|
||||||
|
model.ReleaseTitle = latestRelease.Name;
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private StatusModel GetLatestEapRelease()
|
||||||
|
{
|
||||||
|
var request = new ApiRequest();
|
||||||
|
|
||||||
|
// Get latest EAP Build
|
||||||
|
var eapBranchRequest = new RestRequest
|
||||||
|
{
|
||||||
|
Resource = "/projects/tidusjar/requestplex/branch/EAP",
|
||||||
|
Method = Method.GET
|
||||||
|
};
|
||||||
|
|
||||||
|
var api = StringCipher.Decrypt(Api,"Appveyor");
|
||||||
|
eapBranchRequest.AddHeader("Authorization", $"Bearer {api}");
|
||||||
|
eapBranchRequest.AddHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
var branchResult = request.ExecuteJson<AppveyorBranchResult>(eapBranchRequest, new Uri(AppveyorApiUrl));
|
||||||
|
|
||||||
|
var jobId = branchResult.build.jobs.FirstOrDefault()?.jobId ?? string.Empty;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(jobId))
|
||||||
|
{
|
||||||
|
return new StatusModel {UpdateAvailable = false};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get artifacts from the EAP Build
|
||||||
|
var eapAtrifactRequest = new RestRequest
|
||||||
|
{
|
||||||
|
Resource = $"/buildjobs/{jobId}/artifacts",
|
||||||
|
Method = Method.GET
|
||||||
|
};
|
||||||
|
eapAtrifactRequest.AddHeader("Authorization", $"Bearer {api}");
|
||||||
|
eapAtrifactRequest.AddHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
var artifactResult = request.ExecuteJson<List<AppveyorArtifactResult>>(eapAtrifactRequest, new Uri(AppveyorApiUrl)).FirstOrDefault();
|
||||||
|
|
||||||
|
var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}";
|
||||||
|
|
||||||
|
return new StatusModel
|
||||||
|
{
|
||||||
|
DownloadUri = downloadLink,
|
||||||
|
ReleaseNotes = "Early Access Preview (See recent commits for details)",
|
||||||
|
ReleaseTitle = "Plex Requests Early Access Preview",
|
||||||
|
Version = branchResult.build.version,
|
||||||
|
UpdateAvailable = true,
|
||||||
|
UpdateUri = downloadLink
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,5 +8,6 @@
|
||||||
<package id="NLog" version="4.3.6" targetFramework="net45" />
|
<package id="NLog" version="4.3.6" targetFramework="net45" />
|
||||||
<package id="Octokit" version="0.19.0" targetFramework="net45" />
|
<package id="Octokit" version="0.19.0" targetFramework="net45" />
|
||||||
<package id="Quartz" version="2.3.3" targetFramework="net45" />
|
<package id="Quartz" version="2.3.3" targetFramework="net45" />
|
||||||
|
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||||
<package id="valueinjecter" version="3.1.1.2" targetFramework="net45" />
|
<package id="valueinjecter" version="3.1.1.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -186,7 +186,6 @@ namespace PlexRequests.UI.Modules
|
||||||
Get["/emailnotification"] = _ => EmailNotifications();
|
Get["/emailnotification"] = _ => EmailNotifications();
|
||||||
Post["/emailnotification"] = _ => SaveEmailNotifications();
|
Post["/emailnotification"] = _ => SaveEmailNotifications();
|
||||||
Post["/testemailnotification", true] = async (x, ct) => await TestEmailNotifications();
|
Post["/testemailnotification", true] = async (x, ct) => await TestEmailNotifications();
|
||||||
Get["/status", true] = async (x, ct) => await Status();
|
|
||||||
|
|
||||||
Get["/pushbulletnotification"] = _ => PushbulletNotifications();
|
Get["/pushbulletnotification"] = _ => PushbulletNotifications();
|
||||||
Post["/pushbulletnotification"] = _ => SavePushbulletNotifications();
|
Post["/pushbulletnotification"] = _ => SavePushbulletNotifications();
|
||||||
|
@ -209,7 +208,7 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
Post["/createapikey"] = x => CreateApiKey();
|
Post["/createapikey"] = x => CreateApiKey();
|
||||||
|
|
||||||
Post["/autoupdate"] = x => AutoUpdate();
|
|
||||||
|
|
||||||
Post["/testslacknotification", true] = async (x, ct) => await TestSlackNotification();
|
Post["/testslacknotification", true] = async (x, ct) => await TestSlackNotification();
|
||||||
|
|
||||||
|
@ -568,28 +567,6 @@ namespace PlexRequests.UI.Modules
|
||||||
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Negotiator> Status()
|
|
||||||
{
|
|
||||||
var checker = new StatusChecker();
|
|
||||||
var status = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async () => await checker.GetStatus(), 30);
|
|
||||||
var md = new Markdown(new MarkdownOptions { AutoNewLines = true, AutoHyperlink = true });
|
|
||||||
status.ReleaseNotes = md.Transform(status.ReleaseNotes);
|
|
||||||
return View["Status", status];
|
|
||||||
}
|
|
||||||
|
|
||||||
private Response AutoUpdate()
|
|
||||||
{
|
|
||||||
var url = Request.Form["url"];
|
|
||||||
|
|
||||||
var startInfo = Type.GetType("Mono.Runtime") != null
|
|
||||||
? new ProcessStartInfo("mono PlexRequests.Updater.exe") { Arguments = url }
|
|
||||||
: new ProcessStartInfo("PlexRequests.Updater.exe") { Arguments = url };
|
|
||||||
|
|
||||||
Process.Start(startInfo);
|
|
||||||
|
|
||||||
Environment.Exit(0);
|
|
||||||
return Nancy.Response.NoBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Negotiator PushbulletNotifications()
|
private Negotiator PushbulletNotifications()
|
||||||
{
|
{
|
100
PlexRequests.UI/Modules/Admin/SystemStatusModule.cs
Normal file
100
PlexRequests.UI/Modules/Admin/SystemStatusModule.cs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: SystemStatusModule.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.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MarkdownSharp;
|
||||||
|
using Nancy;
|
||||||
|
using Nancy.ModelBinding;
|
||||||
|
using Nancy.Responses.Negotiation;
|
||||||
|
using PlexRequests.Core;
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Core.StatusChecker;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Permissions;
|
||||||
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.Modules.Admin
|
||||||
|
{
|
||||||
|
public class SystemStatusModule : BaseModule
|
||||||
|
{
|
||||||
|
public SystemStatusModule(ISettingsService<PlexRequestSettings> settingsService, ICacheProvider cache, ISettingsService<SystemSettings> ss) : base("admin", settingsService)
|
||||||
|
{
|
||||||
|
Cache = cache;
|
||||||
|
SystemSettings = ss;
|
||||||
|
|
||||||
|
Security.HasPermissionsResponse(Permissions.Administrator);
|
||||||
|
|
||||||
|
|
||||||
|
Get["/status", true] = async (x, ct) => await Status();
|
||||||
|
Post["/save", true] = async (x, ct) => await Save();
|
||||||
|
|
||||||
|
Post["/autoupdate"] = x => AutoUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICacheProvider Cache { get; }
|
||||||
|
private ISettingsService<SystemSettings> SystemSettings { get; }
|
||||||
|
|
||||||
|
private async Task<Negotiator> Status()
|
||||||
|
{
|
||||||
|
var settings = await SystemSettings.GetSettingsAsync();
|
||||||
|
var checker = new StatusChecker(SystemSettings);
|
||||||
|
var status = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async () => await checker.GetStatus(), 30);
|
||||||
|
var md = new Markdown(new MarkdownOptions { AutoNewLines = true, AutoHyperlink = true });
|
||||||
|
status.ReleaseNotes = md.Transform(status.ReleaseNotes);
|
||||||
|
|
||||||
|
settings.Status = status;
|
||||||
|
|
||||||
|
return View["Status", settings];
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Response> Save()
|
||||||
|
{
|
||||||
|
var settings = this.Bind<SystemSettings>();
|
||||||
|
|
||||||
|
await SystemSettings.SaveSettingsAsync(settings);
|
||||||
|
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully Saved your settings"});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response AutoUpdate()
|
||||||
|
{
|
||||||
|
var url = Request.Form["url"];
|
||||||
|
|
||||||
|
var startInfo = Type.GetType("Mono.Runtime") != null
|
||||||
|
? new ProcessStartInfo("mono PlexRequests.Updater.exe") { Arguments = url }
|
||||||
|
: new ProcessStartInfo("PlexRequests.Updater.exe") { Arguments = url };
|
||||||
|
|
||||||
|
Process.Start(startInfo);
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
|
return Nancy.Response.NoBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ using NLog;
|
||||||
|
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Core.StatusChecker;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
|
@ -40,9 +41,10 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class UpdateCheckerModule : BaseAuthModule
|
public class UpdateCheckerModule : BaseAuthModule
|
||||||
{
|
{
|
||||||
public UpdateCheckerModule(ICacheProvider provider, ISettingsService<PlexRequestSettings> pr) : base("updatechecker", pr)
|
public UpdateCheckerModule(ICacheProvider provider, ISettingsService<PlexRequestSettings> pr, ISettingsService<SystemSettings> settings) : base("updatechecker", pr)
|
||||||
{
|
{
|
||||||
Cache = provider;
|
Cache = provider;
|
||||||
|
SystemSettings = settings;
|
||||||
|
|
||||||
Get["/", true] = async (x,ct) => await CheckLatestVersion();
|
Get["/", true] = async (x,ct) => await CheckLatestVersion();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,7 @@ namespace PlexRequests.UI.Modules
|
||||||
private ICacheProvider Cache { get; }
|
private ICacheProvider Cache { get; }
|
||||||
|
|
||||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
private ISettingsService<SystemSettings> SystemSettings { get; }
|
||||||
|
|
||||||
private async Task<Response> CheckLatestVersion()
|
private async Task<Response> CheckLatestVersion()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +65,7 @@ namespace PlexRequests.UI.Modules
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false});
|
return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false});
|
||||||
#endif
|
#endif
|
||||||
var checker = new StatusChecker();
|
var checker = new StatusChecker(SystemSettings);
|
||||||
var release = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async() => await checker.GetStatus(), 30);
|
var release = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async() => await checker.GetStatus(), 30);
|
||||||
|
|
||||||
return Response.AsJson(release.UpdateAvailable
|
return Response.AsJson(release.UpdateAvailable
|
||||||
|
|
|
@ -33,6 +33,7 @@ using Ninject.Modules;
|
||||||
|
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.Migration;
|
using PlexRequests.Core.Migration;
|
||||||
|
using PlexRequests.Core.StatusChecker;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
using PlexRequests.Services.Interfaces;
|
using PlexRequests.Services.Interfaces;
|
||||||
using PlexRequests.Services.Notification;
|
using PlexRequests.Services.Notification;
|
||||||
|
@ -56,6 +57,8 @@ namespace PlexRequests.UI.NinjectModules
|
||||||
|
|
||||||
Bind<INotificationService>().To<NotificationService>().InSingletonScope();
|
Bind<INotificationService>().To<NotificationService>().InSingletonScope();
|
||||||
Bind<INotificationEngine>().To<NotificationEngine>();
|
Bind<INotificationEngine>().To<NotificationEngine>();
|
||||||
|
|
||||||
|
Bind<IStatusChecker>().To<StatusChecker>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -244,6 +244,7 @@
|
||||||
<Compile Include="Models\SearchMovieViewModel.cs" />
|
<Compile Include="Models\SearchMovieViewModel.cs" />
|
||||||
<Compile Include="Models\UserManagement\DeleteUserViewModel.cs" />
|
<Compile Include="Models\UserManagement\DeleteUserViewModel.cs" />
|
||||||
<Compile Include="Models\UserManagement\UserUpdateViewModel.cs" />
|
<Compile Include="Models\UserManagement\UserUpdateViewModel.cs" />
|
||||||
|
<Compile Include="Modules\Admin\SystemStatusModule.cs" />
|
||||||
<Compile Include="Modules\ApiDocsModule.cs" />
|
<Compile Include="Modules\ApiDocsModule.cs" />
|
||||||
<Compile Include="Modules\ApiSettingsMetadataModule.cs" />
|
<Compile Include="Modules\ApiSettingsMetadataModule.cs" />
|
||||||
<Compile Include="Modules\ApiUserMetadataModule.cs" />
|
<Compile Include="Modules\ApiUserMetadataModule.cs" />
|
||||||
|
@ -324,7 +325,7 @@
|
||||||
<Compile Include="Models\RequestViewModel.cs" />
|
<Compile Include="Models\RequestViewModel.cs" />
|
||||||
<Compile Include="Models\SearchTvShowViewModel.cs" />
|
<Compile Include="Models\SearchTvShowViewModel.cs" />
|
||||||
<Compile Include="Models\SessionKeys.cs" />
|
<Compile Include="Models\SessionKeys.cs" />
|
||||||
<Compile Include="Modules\AdminModule.cs" />
|
<Compile Include="Modules\Admin\AdminModule.cs" />
|
||||||
<Compile Include="Modules\ApplicationTesterModule.cs" />
|
<Compile Include="Modules\ApplicationTesterModule.cs" />
|
||||||
<Compile Include="Modules\BaseAuthModule.cs" />
|
<Compile Include="Modules\BaseAuthModule.cs" />
|
||||||
<Compile Include="Modules\IndexModule.cs" />
|
<Compile Include="Modules\IndexModule.cs" />
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@using PlexRequests.UI.Helpers
|
@using PlexRequests.UI.Helpers
|
||||||
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<PlexRequests.Core.SettingModels.SystemSettings>
|
||||||
@Html.Partial("_Sidebar")
|
@Html.Partial("_Sidebar")
|
||||||
|
|
||||||
<div class="col-sm-8 col-sm-push-1">
|
<div class="col-sm-8 col-sm-push-1">
|
||||||
|
@ -8,16 +9,35 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Version: </label>
|
<label class="control-label">Version: </label>
|
||||||
<label class="control-label">@Model.Version</label>
|
<label class="control-label">@Model.Status.Version</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form id="mainForm" method="post" action="save">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
|
||||||
|
@if (Model.UseEarlyAccessPreviewBuilds)
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="UseEarlyAccessPreviewBuilds" name="UseEarlyAccessPreviewBuilds" checked="checked"><label for="UseEarlyAccessPreviewBuilds">Use Early Access Preview Builds</label>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="UseEarlyAccessPreviewBuilds" name="UseEarlyAccessPreviewBuilds"><label for="UseEarlyAccessPreviewBuilds">Use Early Access Preview Builds</label>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button id="saveSettings" class="btn btn-success-outline">Save</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Update Available: </label>
|
<label class="control-label">Update Available: </label>
|
||||||
@if (Model.UpdateAvailable)
|
@if (Model.Status.UpdateAvailable)
|
||||||
{
|
{
|
||||||
<label class="control-label"><a href="@Model.UpdateUri" target="_blank"><i class="fa fa-check"></i></a></label>
|
<label class="control-label"><a href="@Model.Status.UpdateUri" target="_blank"><i class="fa fa-check"></i></a></label>
|
||||||
<br />
|
<br />
|
||||||
@*<button id="autoUpdate" class="btn btn-success-outline">Automatic Update <i class="fa fa-download"></i></button>*@ //TODO
|
<button id="autoUpdate" class="btn btn-success-outline">Automatic Update (beta) <i class="fa fa-download"></i></button>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -26,14 +46,14 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (Model.UpdateAvailable)
|
@if (Model.Status.UpdateAvailable)
|
||||||
{
|
{
|
||||||
<h2>
|
<h2>
|
||||||
<a href="@Model.DownloadUri">@Model.ReleaseTitle</a>
|
<a href="@Model.Status.DownloadUri">@Model.Status.ReleaseTitle</a>
|
||||||
</h2>
|
</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<label>Release Notes:</label>
|
<label>Release Notes:</label>
|
||||||
@Html.Raw(Model.ReleaseNotes)
|
@Html.Raw(Model.Status.ReleaseNotes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +78,7 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "Post",
|
type: "Post",
|
||||||
url: "autoupdate",
|
url: "autoupdate",
|
||||||
data: { url: "@Model.DownloadUri" },
|
data: { url: "@Model.Status.DownloadUri" },
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
error: function () {
|
error: function () {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
|
@ -68,4 +88,23 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#saveSettings').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $form = $("#mainForm");
|
||||||
|
$.ajax({
|
||||||
|
type: $form.prop("method"),
|
||||||
|
url: $form.prop("action"),
|
||||||
|
data: $form.serialize(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function (response) {
|
||||||
|
if (response.result === true) {
|
||||||
|
generateNotify(response.message, "success");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
generateNotify(response.message, "warning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue