mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Merge pull request #4337 from Ombi-app/feature/branch-select
feat: ✨ Added the ability to specify which branch you are on
This commit is contained in:
commit
ba32db89ce
6 changed files with 55 additions and 22 deletions
|
@ -10,23 +10,21 @@ using Octokit;
|
|||
using Ombi.Api;
|
||||
using Ombi.Api.Service;
|
||||
using Ombi.Core.Processor;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
using Branch = Ombi.Settings.Settings.Models.Branch;
|
||||
|
||||
namespace Ombi.Schedule.Processor
|
||||
{
|
||||
public class ChangeLogProcessor : IChangeLogProcessor
|
||||
{
|
||||
public ChangeLogProcessor(IApi api, IHttpClientFactory client)
|
||||
{
|
||||
_api = api;
|
||||
_client = client.CreateClient("OmbiClient");
|
||||
}
|
||||
private readonly ISettingsService<OmbiSettings> _ombiSettingsService;
|
||||
|
||||
private readonly IApi _api;
|
||||
private readonly HttpClient _client;
|
||||
private const string _changeLogUrl = "https://raw.githubusercontent.com/tidusjar/Ombi/{0}/CHANGELOG.md";
|
||||
private const string AppveyorApiUrl = "https://ci.appveyor.com/api";
|
||||
private string ChangeLogUrl(string branch) => string.Format(_changeLogUrl, branch);
|
||||
public ChangeLogProcessor(ISettingsService<OmbiSettings> ombiSettings)
|
||||
{
|
||||
_ombiSettingsService = ombiSettings;
|
||||
}
|
||||
|
||||
public async Task<UpdateModel> Process()
|
||||
{
|
||||
|
@ -34,9 +32,9 @@ namespace Ombi.Schedule.Processor
|
|||
{
|
||||
Downloads = new List<Downloads>()
|
||||
};
|
||||
var settings = _ombiSettingsService.GetSettingsAsync();
|
||||
await GetGitubRelease(release, settings);
|
||||
|
||||
await GetGitubRelease(release);
|
||||
|
||||
return TransformUpdate(release);
|
||||
}
|
||||
|
||||
|
@ -50,7 +48,7 @@ namespace Ombi.Schedule.Processor
|
|||
ChangeLogs = release.Description,
|
||||
Downloads = new List<Downloads>(),
|
||||
UpdateAvailable = release.Version != "v" + AssemblyHelper.GetRuntimeVersion()
|
||||
};
|
||||
};
|
||||
|
||||
foreach (var dl in release.Downloads)
|
||||
{
|
||||
|
@ -64,12 +62,20 @@ namespace Ombi.Schedule.Processor
|
|||
return newUpdate;
|
||||
}
|
||||
|
||||
private async Task GetGitubRelease(Release release)
|
||||
private async Task GetGitubRelease(Release release, Task<OmbiSettings> settingsTask)
|
||||
{
|
||||
var client = new GitHubClient(Octokit.ProductHeaderValue.Parse("OmbiV4"));
|
||||
|
||||
var releases = await client.Repository.Release.GetAll("ombi-app", "ombi");
|
||||
var latest = releases.OrderByDescending(x => x.CreatedAt).FirstOrDefault();
|
||||
|
||||
var settings = await settingsTask;
|
||||
|
||||
var latest = settings.Branch switch
|
||||
{
|
||||
Branch.Develop => releases.Where(x => x.Prerelease).OrderByDescending(x => x.CreatedAt).FirstOrDefault(),
|
||||
Branch.Stable => releases.Where(x => !x.Prerelease).OrderByDescending(x => x.CreatedAt).FirstOrDefault(),
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
|
||||
foreach (var item in latest.Assets)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace Ombi.Settings.Settings.Models
|
||||
{
|
||||
public class OmbiSettings : Models.Settings
|
||||
public class OmbiSettings : Settings
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
public bool CollectAnalyticData { get; set; }
|
||||
|
@ -12,9 +12,16 @@
|
|||
public string DefaultLanguageCode { get; set; } = "en";
|
||||
public bool AutoDeleteAvailableRequests { get; set; }
|
||||
public int AutoDeleteAfterDays { get; set; }
|
||||
public Branch Branch { get; set; }
|
||||
|
||||
//INTERNAL
|
||||
public bool HasMigratedOldTvDbData { get; set; }
|
||||
public bool Set { get; set; }
|
||||
}
|
||||
|
||||
public enum Branch
|
||||
{
|
||||
Develop = 0,
|
||||
Stable = 1,
|
||||
}
|
||||
}
|
|
@ -18,6 +18,12 @@ export interface IOmbiSettings extends ISettings {
|
|||
disableHealthChecks: boolean;
|
||||
autoDeleteAvailableRequests: boolean;
|
||||
autoDeleteAfterDays: number;
|
||||
branch: Branch;
|
||||
}
|
||||
|
||||
export enum Branch {
|
||||
Stable = 1,
|
||||
Develop = 0
|
||||
}
|
||||
|
||||
export interface IUpdateSettings extends ISettings {
|
||||
|
|
|
@ -21,6 +21,18 @@
|
|||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Branch" formControlName="branch" matTooltip="This will not update your current version, but only control the update checks on the About page">
|
||||
<mat-option [value]="Branch.Stable">
|
||||
Stable
|
||||
</mat-option>
|
||||
<mat-option [value]="Branch.Develop">
|
||||
Develop
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-slide-toggle formControlName="doNotSendNotificationsForAutoApprove">
|
||||
Do not send Notifications if a User has the Auto Approve permission</mat-slide-toggle>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, FormGroup } from "@angular/forms";
|
||||
|
||||
import { ILanguageRefine, IOmbiSettings } from "../../interfaces";
|
||||
import { Branch, ILanguageRefine, IOmbiSettings } from "../../interfaces";
|
||||
import { NotificationService } from "../../services";
|
||||
import { SettingsService } from "../../services";
|
||||
|
||||
|
@ -15,6 +15,7 @@ export class OmbiComponent implements OnInit {
|
|||
|
||||
public form: FormGroup;
|
||||
public langauges: ILanguageRefine[];
|
||||
public Branch = Branch;
|
||||
|
||||
constructor(private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
|
@ -31,7 +32,8 @@ export class OmbiComponent implements OnInit {
|
|||
defaultLanguageCode: [x.defaultLanguageCode],
|
||||
disableHealthChecks: [x.disableHealthChecks],
|
||||
autoDeleteAvailableRequests: [x.autoDeleteAvailableRequests],
|
||||
autoDeleteAfterDays: [x.autoDeleteAfterDays]
|
||||
autoDeleteAfterDays: [x.autoDeleteAfterDays],
|
||||
branch: [x.branch]
|
||||
});
|
||||
});
|
||||
this.langauges = <ILanguageRefine[]>languageData
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Content Remove="$(SpaRoot)**" />
|
||||
<Content Remove="Controllers\External\**" />
|
||||
<None Remove="$(SpaRoot)**" />
|
||||
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Files not to show in IDE -->
|
||||
<Compile Remove="Controllers\External\**" />
|
||||
<Compile Remove="Logs\**" />
|
||||
<Compile Remove="Styles\**" />
|
||||
<Compile Remove="wwwroot\dist\**" />
|
||||
|
@ -39,9 +41,11 @@
|
|||
<Content Remove="Logs\**" />
|
||||
<Content Remove="Styles\**" />
|
||||
<Content Remove="wwwroot\dist\**" />
|
||||
<EmbeddedResource Remove="Controllers\External\**" />
|
||||
<EmbeddedResource Remove="Logs\**" />
|
||||
<EmbeddedResource Remove="Styles\**" />
|
||||
<EmbeddedResource Remove="wwwroot\dist\**" />
|
||||
<None Remove="Controllers\External\**" />
|
||||
<None Remove="Logs\**" />
|
||||
<None Remove="Styles\**" />
|
||||
<None Remove="wwwroot\dist\**" />
|
||||
|
@ -99,10 +103,6 @@
|
|||
<ProjectReference Include="..\Ombi.Updater\Ombi.Updater.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\External\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
|
||||
<Exec Command="node --version" ContinueOnError="true">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue