From 61f3e94308fb3d239140b73d34c12f1496459989 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 7 Oct 2021 16:36:42 +0100 Subject: [PATCH 01/13] feat: :sparkles: Added the ability to specify which branch you are on Currently this will only affect the update check on the settings page, this will not switch builds for you --- .../Processor/ChangeLogProcessor.cs | 34 +++++++++++-------- .../Settings/Models/OmbiSettings.cs | 9 ++++- .../ClientApp/src/app/interfaces/ISettings.ts | 6 ++++ .../src/app/settings/ombi/ombi.component.html | 12 +++++++ .../src/app/settings/ombi/ombi.component.ts | 6 ++-- src/Ombi/Ombi.csproj | 8 ++--- 6 files changed, 54 insertions(+), 21 deletions(-) diff --git a/src/Ombi.Schedule/Processor/ChangeLogProcessor.cs b/src/Ombi.Schedule/Processor/ChangeLogProcessor.cs index cffb5e508..0368984dd 100644 --- a/src/Ombi.Schedule/Processor/ChangeLogProcessor.cs +++ b/src/Ombi.Schedule/Processor/ChangeLogProcessor.cs @@ -10,33 +10,31 @@ 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) + private readonly ISettingsService _ombiSettingsService; + + public ChangeLogProcessor(ISettingsService ombiSettings) { - _api = api; - _client = client.CreateClient("OmbiClient"); + _ombiSettingsService = ombiSettings; } - 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 async Task Process() { var release = new Release { Downloads = new List() }; + 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(), 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 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) { diff --git a/src/Ombi.Settings/Settings/Models/OmbiSettings.cs b/src/Ombi.Settings/Settings/Models/OmbiSettings.cs index 6c622f2ce..ba460a2bd 100644 --- a/src/Ombi.Settings/Settings/Models/OmbiSettings.cs +++ b/src/Ombi.Settings/Settings/Models/OmbiSettings.cs @@ -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, + } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index 841ff2d86..c4a57154d 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -18,6 +18,12 @@ export interface IOmbiSettings extends ISettings { disableHealthChecks: boolean; autoDeleteAvailableRequests: boolean; autoDeleteAfterDays: number; + branch: Branch; +} + +export enum Branch { + Stable = 0, + Develop = 1 } export interface IUpdateSettings extends ISettings { diff --git a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html index ccdb57cb2..a575c24a7 100644 --- a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html +++ b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.html @@ -21,6 +21,18 @@ +
+ + + + Stable + + + Develop + + + +
Do not send Notifications if a User has the Auto Approve permission diff --git a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts index 9681784b4..f797703bc 100644 --- a/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/ombi/ombi.component.ts @@ -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 = languageData diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index d1545ff36..063dc65db 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -24,12 +24,14 @@ + + @@ -39,9 +41,11 @@ + + @@ -99,10 +103,6 @@ - - - - From ea55c4d64f7e88a1f404db1b8037611004f78dd7 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 7 Oct 2021 16:41:14 +0100 Subject: [PATCH 02/13] refactor: :recycle: Change the order --- src/Ombi/ClientApp/src/app/interfaces/ISettings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index c4a57154d..083425deb 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -22,8 +22,8 @@ export interface IOmbiSettings extends ISettings { } export enum Branch { - Stable = 0, - Develop = 1 + Stable = 1, + Develop = 0 } export interface IUpdateSettings extends ISettings { From 2887b5d6868049a6a0063b735029ba3aca914580 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Oct 2021 17:46:42 +0100 Subject: [PATCH 03/13] ci: :construction: set test to run different configuration [skip ci] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 906a33467..e108e9df4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: - name: Run Unit Tests run: | cd src - dotnet test --logger trx --results-directory "TestResults" + dotnet test -c NonUiBuild --logger trx --results-directory "TestResults" versioning: runs-on: ubuntu-latest From 5c7381313a207beb5ca66ad56fd77461fcfdff2a Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Oct 2021 17:48:03 +0100 Subject: [PATCH 04/13] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e108e9df4..085b60f19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: CI Build on: push: branches: [ develop, master ] + workflow-dispatch: jobs: build-ui: From 4e13bc1e17f1b4bb40b9fb1260230ef70eb242f8 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Oct 2021 17:48:33 +0100 Subject: [PATCH 05/13] Update build.yml --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 085b60f19..e108e9df4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ name: CI Build on: push: branches: [ develop, master ] - workflow-dispatch: jobs: build-ui: From 2c6082456e352aed5042a2199862ce80f108351d Mon Sep 17 00:00:00 2001 From: Conventional Changelog Action Date: Thu, 7 Oct 2021 16:56:00 +0000 Subject: [PATCH 06/13] chore(release): :rocket: v4.0.1511 --- CHANGELOG.md | 43 ++++++++++++------------------------------- version.json | 2 +- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b386648a8..60f86f28f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,48 +1,29 @@ -## [4.0.1510](https://github.com/Ombi-app/Ombi/compare/v4.0.1602...v4.0.1510) (2021-10-07) - - -### Bug Fixes - -* :bookmark: Set version to correct number ([1a7b9b5](https://github.com/Ombi-app/Ombi/commit/1a7b9b50578675532fdb0f656cbaf51306166b84)) -* :bug: bump ver ([5207b21](https://github.com/Ombi-app/Ombi/commit/5207b21f2f98cc63f16a72bd79ecac6abf838139)) -* :bug: Set the real tag version now ([9287d83](https://github.com/Ombi-app/Ombi/commit/9287d83c134e62c9f0a5d271cfd88eefc9dcae39)) -* :bug: Stop Devops from building and releasing, GH Actions will now call the APT Build ([1fda2a1](https://github.com/Ombi-app/Ombi/commit/1fda2a1d37c1182177fdca55e38b98a85dc1fe05)) -* :bug: updated contributors PAT ([a1d22db](https://github.com/Ombi-app/Ombi/commit/a1d22db4d14c63c39e79d47d99cc7ca2efe393df)) -* :bug: Upload the correct artifacts ([a249805](https://github.com/Ombi-app/Ombi/commit/a2498051cfd679dd19206571883a08d77e159e2b)) -* try and fix the artifact upload ([fb9ff4c](https://github.com/Ombi-app/Ombi/commit/fb9ff4ccde9121dce6da379198de225686123457)) - - - -## [4.1.9](https://github.com/Ombi-app/Ombi/compare/v4.1.8...v4.1.9) (2021-09-29) - +## [4.0.1511](https://github.com/Ombi-app/Ombi/compare/v4.1.0...v4.0.1511) (2021-10-07) -## [4.1.7](https://github.com/Ombi-app/Ombi/compare/v4.1.6...v4.1.7) (2021-09-29) +# [4.1.0](https://github.com/Ombi-app/Ombi/compare/v4.0.1510...v4.1.0) (2021-10-07) -## [4.1.6](https://github.com/Ombi-app/Ombi/compare/v4.1.5...v4.1.6) (2021-09-29) +### Features +* :sparkles: Added the ability to specify which branch you are on ([61f3e94](https://github.com/Ombi-app/Ombi/commit/61f3e94308fb3d239140b73d34c12f1496459989)) -## [4.1.5](https://github.com/Ombi-app/Ombi/compare/v4.1.4...v4.1.5) (2021-09-29) - - -## [4.1.3](https://github.com/Ombi-app/Ombi/compare/v4.1.2...v4.1.3) (2021-09-29) - - - -## [4.1.2](https://github.com/Ombi-app/Ombi/compare/v4.1.1...v4.1.2) (2021-09-28) +## [4.0.1510](https://github.com/Ombi-app/Ombi/compare/v4.0.1602...v4.0.1510) (2021-10-07) ### Bug Fixes +* :bookmark: Set version to correct number ([1a7b9b5](https://github.com/Ombi-app/Ombi/commit/1a7b9b50578675532fdb0f656cbaf51306166b84)) +* :bug: bump ver ([5207b21](https://github.com/Ombi-app/Ombi/commit/5207b21f2f98cc63f16a72bd79ecac6abf838139)) * :bug: Pretending to fix a bug ([5351c14](https://github.com/Ombi-app/Ombi/commit/5351c14cb087f9ecbb37b784724bb35107d17cb8)) - - - -## [4.1.1](https://github.com/Ombi-app/Ombi/compare/v4.0.1506...v4.1.1) (2021-09-28) +* :bug: Set the real tag version now ([9287d83](https://github.com/Ombi-app/Ombi/commit/9287d83c134e62c9f0a5d271cfd88eefc9dcae39)) +* :bug: Stop Devops from building and releasing, GH Actions will now call the APT Build ([1fda2a1](https://github.com/Ombi-app/Ombi/commit/1fda2a1d37c1182177fdca55e38b98a85dc1fe05)) +* :bug: updated contributors PAT ([a1d22db](https://github.com/Ombi-app/Ombi/commit/a1d22db4d14c63c39e79d47d99cc7ca2efe393df)) +* :bug: Upload the correct artifacts ([a249805](https://github.com/Ombi-app/Ombi/commit/a2498051cfd679dd19206571883a08d77e159e2b)) +* try and fix the artifact upload ([fb9ff4c](https://github.com/Ombi-app/Ombi/commit/fb9ff4ccde9121dce6da379198de225686123457)) diff --git a/version.json b/version.json index 468f45009..0fcc04492 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "4.0.1510" + "version": "4.0.1511" } \ No newline at end of file From dea9dc39934f4a2a67fa8da04b3adfa949473de8 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Oct 2021 21:57:23 +0100 Subject: [PATCH 07/13] ci: :construction: [skip ci] --- .github/workflows/build.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e108e9df4..11f385e27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,6 +162,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Conventional Changelog Action + id: changelog + uses: TriPSs/conventional-changelog-action@v3 + with: + version-file: 'version.json' + skip-on-empty: 'false' + git-message: 'chore(release): :rocket: {version}' + - name: Download Artifacts id: download uses: actions/download-artifact@v2 @@ -191,19 +199,6 @@ jobs: artifacts/**/*.tar.gz artifacts/**/*.zip - update-changelog: - needs: [ release ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Conventional Changelog Action - id: changelog - uses: TriPSs/conventional-changelog-action@v3 - with: - version-file: 'version.json' - skip-on-empty: 'false' - git-message: 'chore(release): :rocket: {version}' - update-apt: needs: [ release ] runs-on: ubuntu-latest From 66d3ddb0438f74cdfdec4bb6fe63b8e2e43e7c9e Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Oct 2021 22:03:14 +0100 Subject: [PATCH 08/13] ci: :construction: [skip ci] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11f385e27..7011a5943 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -209,7 +209,7 @@ jobs: url: 'https://api.github.com/repos/Ombi-app/Ombi.Apt/actions/workflows/build-deb.yml/dispatches' method: 'POST' contentType: 'application/json' - data: "{ 'ref':'main', 'inputs': { 'version': '${{ steps.changelog.outputs.tag }}'} }" + data: '{ "ref":"main", "inputs": { "version": "${{ steps.changelog.outputs.tag }}"} }' customHeaders: "{'Accept':'application/vnd.github.v3+json', 'Authorization':'Bearer ${{secrets.APT_PAT}}', 'User-Agent':'Ombi'}" From 8178dc6f580c8ff8a47428565d9956c5f9fbf390 Mon Sep 17 00:00:00 2001 From: Victor Usoltsev Date: Fri, 8 Oct 2021 23:27:21 +1300 Subject: [PATCH 09/13] Replaces Gravatar's fallback image with custom 404 error handling. --- src/Ombi/ClientApp/src/app/app.component.html | 4 +- src/Ombi/ClientApp/src/app/app.component.ts | 12 ++--- .../src/app/my-nav/my-nav.component.html | 6 ++- .../src/app/my-nav/my-nav.component.ts | 48 +++++++++++++------ .../user-preference.component.html | 8 ++-- .../user-preference.component.ts | 29 ++++++++--- .../usermanagement-user.component.html | 2 +- 7 files changed, 70 insertions(+), 39 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/app.component.html b/src/Ombi/ClientApp/src/app/app.component.html index 351b8ef49..81572869f 100644 --- a/src/Ombi/ClientApp/src/app/app.component.html +++ b/src/Ombi/ClientApp/src/app/app.component.html @@ -175,8 +175,8 @@ [isAdmin]="isAdmin" [applicationName]="applicationName" [applicationLogo]="customizationSettings?.logo" - [username]="username" - [email]="user?.email" + [userName]="userName" + [userEmail]="userEmail" [accessToken]="accessToken" [applicationUrl]="customizationSettings?.applicationUrl" (logoutClick)="logOut();" diff --git a/src/Ombi/ClientApp/src/app/app.component.ts b/src/Ombi/ClientApp/src/app/app.component.ts index dc5207164..64a59ea4a 100644 --- a/src/Ombi/ClientApp/src/app/app.component.ts +++ b/src/Ombi/ClientApp/src/app/app.component.ts @@ -24,14 +24,14 @@ export class AppComponent implements OnInit { public customizationSettings: ICustomizationSettings; public customPageSettings: ICustomPage; - public user: ILocalUser; public showNav: boolean; public updateAvailable: boolean; public currentUrl: string; public voteEnabled = false; public applicationName: string = "Ombi" public isAdmin: boolean; - public username: string; + public userName: string; + public userEmail: string; public accessToken: string; private hubConnected: boolean; @@ -53,8 +53,6 @@ export class AppComponent implements OnInit { this.translate.addLangs(["da", "de", "en", "es", "fr", "it", "hu", "nl", "no", "pl", "pt", "sk", "sv", "bg", "ru"]); if (this.authService.loggedIn()) { - this.user = this.authService.claims(); - this.username = this.user.name; this.identity.getAccessToken().subscribe(x => this.accessToken = x); if (!this.hubConnected) { this.signalrNotification.initialize(); @@ -67,6 +65,8 @@ export class AppComponent implements OnInit { }); } this.identity.getUser().subscribe(u => { + this.userEmail = u.emailAddress; + this.userName = u.userName; if (u.language) { this.translate.use(u.language); } @@ -116,10 +116,6 @@ export class AppComponent implements OnInit { if (event instanceof NavigationStart) { this.isAdmin = this.authService.hasRole("admin"); this.showNav = this.authService.loggedIn(); - if (this.showNav) { - this.user = this.authService.claims(); - this.username = this.user.name; - } } }); } diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html index 86ffa2910..7a59be582 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html @@ -89,8 +89,10 @@
diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts index 37c093e38..2f96e8760 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts @@ -1,5 +1,5 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core'; import { IUser, RequestType, UserType } from '../interfaces'; import { SettingsService, SettingsStateService } from '../services'; @@ -40,16 +40,16 @@ export class MyNavComponent implements OnInit { @Input() public applicationLogo: string; @Input() public applicationUrl: string; @Input() public accessToken: string; - @Input() public username: string; + @Input() public userName: string; + @Input() public userEmail: string; @Input() public isAdmin: string; - @Input() public email: string; @Output() public logoutClick = new EventEmitter(); public theme: string; public issuesEnabled: boolean = false; public navItems: INavBar[]; public searchFilter: SearchFilter; public SearchFilterType = SearchFilterType; - public emailHash: string | Int32Array; + public userProfileImageUrl: string; public welcomeText: string; public RequestType = RequestType; @@ -63,7 +63,6 @@ export class MyNavComponent implements OnInit { } public async ngOnInit() { - this.searchFilter = { movies: true, music: false, @@ -71,11 +70,7 @@ export class MyNavComponent implements OnInit { tvShows: true } - if (this.email) { - const md5 = new Md5(); - this.emailHash = md5.appendStr(this.email).end(); - } - + this.setProfileImageUrl(this.userEmail) this.issuesEnabled = await this.settingsService.issueEnabled().toPromise(); this.settingState.setIssue(this.issuesEnabled); @@ -103,6 +98,12 @@ export class MyNavComponent implements OnInit { ]; } + ngOnChanges(changes: SimpleChanges) { + if(changes?.userEmail || changes?.applicationLogo){ + this.setProfileImageUrl(this.userEmail) + } + } + public logOut() { this.logoutClick.emit(); } @@ -138,9 +139,27 @@ export class MyNavComponent implements OnInit { }); } - public getUserImage(): string { - var fallback = this.applicationLogo ? this.applicationLogo : 'https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png'; - return `https://www.gravatar.com/avatar/${this.emailHash}?d=${fallback}`; + private setProfileImageUrl(email: string): void { + if (email) { + const md5 = new Md5(); + const emailHash = md5.appendStr(email).end(); + this.userProfileImageUrl = `https://www.gravatar.com/avatar/${emailHash}?d=404`;; + } + else{ + this.userProfileImageUrl = this.getFallbackProfileImageUrl(); + } + } + + public onProfileImageError(): void { + const fallbackLogo = this.getFallbackProfileImageUrl(); + if (this.userProfileImageUrl === fallbackLogo) return; + this.userProfileImageUrl = fallbackLogo; + } + + private getFallbackProfileImageUrl() { + return this.applicationLogo + ? this.applicationLogo + : "https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png"; } public openMobileApp(event: any) { @@ -148,6 +167,5 @@ export class MyNavComponent implements OnInit { const url = `ombi://${this.applicationUrl}|${this.accessToken}`; window.location.assign(url); -} - + } } diff --git a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html index d513c1f63..7d466d972 100644 --- a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html +++ b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html @@ -1,8 +1,8 @@
- +

{{username}} - ({{user.emailAddress}}) + ({{user.emailAddress}})

@@ -15,7 +15,7 @@ User Type:
- {{UserType[user.userType]}} + {{UserType[user?.userType]}}
@@ -75,7 +75,7 @@ - +

Change Details

diff --git a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts index b4cfa6709..c9d3d2eb1 100644 --- a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts +++ b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts @@ -15,6 +15,7 @@ import { APP_BASE_HREF } from "@angular/common"; export class UserPreferenceComponent implements OnInit { public username: string; + public userProfileImageUrl: string; public selectedLang: string; public availableLanguages = AvailableLanguages; public qrCode: string; @@ -61,6 +62,7 @@ export class UserPreferenceComponent implements OnInit { this.user = await this.identityService.getUser().toPromise(); this.selectedCountry = this.user.streamingCountry; + this.setProfileImageUrl(this.user); this.identityService.getSupportedStreamingCountries().subscribe(x => this.countries = x); this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); @@ -92,14 +94,27 @@ export class UserPreferenceComponent implements OnInit { this.identityService.updateStreamingCountry(this.selectedCountry).subscribe(x => this.notification.success(this.translate.instant("UserPreferences.Updated"))); } - public getProfileImage(): string { - let emailHash: string|Int32Array; - if (this.user.emailAddress) { - const md5 = new Md5(); - emailHash = md5.appendStr(this.user.emailAddress).end(); + private setProfileImageUrl(user: IUser): void { + if (user?.emailAddress) { + const md5 = new Md5(); + const emailHash = md5.appendStr(this.user.emailAddress).end(); + this.userProfileImageUrl = `https://www.gravatar.com/avatar/${emailHash}?d=404`;; } - var fallback = this.customizationSettings.logo ? this.customizationSettings.logo : 'https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png'; - return `https://www.gravatar.com/avatar/${emailHash}?d=${fallback}`; + else{ + this.userProfileImageUrl = this.getFallbackProfileImageUrl(); + } + } + + public onProfileImageError(): void { + const fallbackLogo = this.getFallbackProfileImageUrl(); + if (this.userProfileImageUrl === fallbackLogo) return; + this.userProfileImageUrl = fallbackLogo; + } + + private getFallbackProfileImageUrl() { + return this.customizationSettings?.logo + ? this.customizationSettings.logo + : "https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png"; } public updatePassword() { diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html index c8eda1a87..a4b79d21d 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html @@ -182,7 +182,7 @@ - +
From ec963d869a2bf57edfcfef418e2bf8a1d679d8ca Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Oct 2021 20:23:37 +0100 Subject: [PATCH 10/13] fix(4153): :bug: fixed gravitar issues --- .azuredevops/pipelines/publish-job.yml | 118 ------------------ .../pipelines/templates/build-steps.yml | 34 ----- .../pipelines/templates/publish-os-steps.yml | 57 --------- .../pipelines/templates/variables.yml | 30 ----- 4 files changed, 239 deletions(-) delete mode 100644 .azuredevops/pipelines/publish-job.yml delete mode 100644 .azuredevops/pipelines/templates/build-steps.yml delete mode 100644 .azuredevops/pipelines/templates/publish-os-steps.yml delete mode 100644 .azuredevops/pipelines/templates/variables.yml diff --git a/.azuredevops/pipelines/publish-job.yml b/.azuredevops/pipelines/publish-job.yml deleted file mode 100644 index 435582858..000000000 --- a/.azuredevops/pipelines/publish-job.yml +++ /dev/null @@ -1,118 +0,0 @@ - -variables: - - template: templates/variables.yml - -stages: -- stage: build - jobs: - - job: Build - pool: - vmImage: ${{ variables.vmImage }} - steps: - - template: templates/build-steps.yml - -- stage: publish - jobs: - - job: - strategy: - matrix: - win10-x64: - runtime: win10-x64 - format: zip - compression: zip - win10-x86: - runtime: win10-x86 - format: zip - compression: zip - osx-x64: - runtime: osx-x64 - format: tar.gz - compression: tar - linux-x64: - runtime: linux-x64 - format: tar.gz - compression: tar - linux-arm: - runtime: linux-arm - format: tar.gz - compression: tar - linux-arm64: - runtime: linux-arm64 - format: tar.gz - compression: tar - pool: - vmImage: ${{ variables.vmImage }} - steps: - - template: templates/publish-os-steps.yml - -# - stage: deploy -# jobs: -# - job: -# condition: and(succeeded(), eq(variables.isMain, true)) -# steps: -# - task: DownloadPipelineArtifact@2 -# inputs: -# buildType: 'current' -# targetPath: '$(System.ArtifactsDirectory)' - -# - task: PowerShell@2 -# displayName: 'Get Release Notes' -# inputs: -# targetType: 'inline' -# script: | -# $response = Invoke-WebRequest -Uri "https://ombireleasenote.azurewebsites.net/api/ReleaseNotesFunction?buildId=$(Build.BuildId)" -# Write-Host "##vso[task.setvariable variable=ReleaseNotes;]$response" - -# - task: GitHubRelease@1 -# displayName: 'Ombi.Releases Release' -# inputs: -# gitHubConnection: 'PAT' -# repositoryName: 'Ombi-app/Ombi.Releases' -# action: 'create' -# target: 'c7fcbb77b58aef1076d635a9ef99e4374abc8672' -# tagSource: 'userSpecifiedTag' -# tag: '$(gitTag)' -# releaseNotesSource: 'inline' -# releaseNotesInline: '$(ReleaseNotes)' -# assets: | -# $(System.ArtifactsDirectory)/**/*.zip -# $(System.ArtifactsDirectory)/**/*.tar.gz -# isPreRelease: true -# changeLogCompareToRelease: 'lastNonDraftRelease' -# changeLogType: 'commitBased' - -# - task: GitHubRelease@1 -# displayName: 'Ombi Release' -# inputs: -# gitHubConnection: 'PAT' -# repositoryName: 'Ombi-app/Ombi' -# action: 'create' -# target: '$(Build.SourceVersion)' -# tagSource: 'userSpecifiedTag' -# tag: '$(gitTag)' -# releaseNotesSource: 'inline' -# releaseNotesInline: '$(ReleaseNotes)' -# assets: | -# $(System.ArtifactsDirectory)/**/*.zip -# $(System.ArtifactsDirectory)/**/*.tar.gz -# isPreRelease: true -# changeLogCompareToRelease: 'lastNonDraftRelease' -# changeLogType: 'commitBased' - -# - task: PowerShell@2 -# displayName: "Trigger APT build" -# inputs: -# targetType: 'inline' -# script: | -# $body = @{ -# "ref"="main" -# "inputs"= @{"version"= "$(gitTag)"} -# } | ConvertTo-Json - -# $header = @{ -# "Accept"="application/vnd.github.v3+json" -# "Authorization"="Bearer $(APTPAT)" -# "User-Agent"="Ombi" -# } - -# Invoke-RestMethod -Uri "https://api.github.com/repos/Ombi-app/Ombi.Apt/actions/workflows/build-deb.yml/dispatches" -Method 'Post' -Body $body -Headers $header \ No newline at end of file diff --git a/.azuredevops/pipelines/templates/build-steps.yml b/.azuredevops/pipelines/templates/build-steps.yml deleted file mode 100644 index 111424222..000000000 --- a/.azuredevops/pipelines/templates/build-steps.yml +++ /dev/null @@ -1,34 +0,0 @@ -steps: -## This is needed due to https://github.com/microsoft/azure-pipelines-tasks/issues/8429 -## For the set version tool... -- task: DotNetCoreInstaller@1 - displayName: 'Use .NET Core sdk ' - inputs: - packageType: 'sdk' - version: '5.x' - -- task: Yarn@3 - displayName: 'Install UI Dependancies' - inputs: - projectDirectory: '$(UiLocation)' - arguments: 'install' - -- task: Yarn@3 - displayName: 'Build and Publish Angular App' - inputs: - projectDirectory: '$(UiLocation)' - arguments: 'run build' - -- task: PublishPipelineArtifact@1 - inputs: - targetPath: '$(UiLocation)dist' - artifact: 'angular_dist' - publishLocation: 'pipeline' - -- task: DotNetCoreCLI@2 - displayName: Run Unit Tests - inputs: - command: 'custom' - projects: '$(TestProject)' - custom: 'test' - continueOnError: false diff --git a/.azuredevops/pipelines/templates/publish-os-steps.yml b/.azuredevops/pipelines/templates/publish-os-steps.yml deleted file mode 100644 index 2f63fa4a4..000000000 --- a/.azuredevops/pipelines/templates/publish-os-steps.yml +++ /dev/null @@ -1,57 +0,0 @@ -steps: -- task: DotNetCoreInstaller@1 - displayName: 'Use .NET Core sdk ' - inputs: - packageType: 'sdk' - version: '5.x' - -- task: DotNetCoreInstaller@1 - displayName: 'Use .NET Core sdk for versioning' - inputs: - packageType: 'sdk' - version: '3.1.x' - -- task: PowerShell@2 - displayName: 'Set Version' - inputs: - targetType: 'inline' - script: | - dotnet tool install -g dotnet-setversion - setversion -r $(BuildVersion) - -- task: DotNetCoreCLI@2 - displayName: 'publish $(runtime)' - inputs: - command: 'publish' - publishWebProjects: true - arguments: '-c $(BuildConfiguration) -r "$(runtime)" -o $(Build.ArtifactStagingDirectory)/$(runtime) --self-contained true -p:PublishSingleFile=true' - zipAfterPublish: false - modifyOutputPath: false - -- task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: 'angular_dist' - targetPath: '$(Build.ArtifactStagingDirectory)/angular_dist' - -- task: CopyFiles@2 - displayName: 'Copy Angular App $(runtime)' - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/angular_dist' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/$(runtime)/ClientApp/dist' - -- task: ArchiveFiles@2 - displayName: 'Zip $(runtime)' - inputs: - rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/$(runtime)' - includeRootFolder: false - archiveType: $(compression) - archiveFile: '$(Build.ArtifactStagingDirectory)/$(runtime).$(format)' - replaceExistingArchive: true - -- task: PublishPipelineArtifact@1 - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/$(runtime).$(format)' - artifact: '$(runtime)' - publishLocation: 'pipeline' diff --git a/.azuredevops/pipelines/templates/variables.yml b/.azuredevops/pipelines/templates/variables.yml deleted file mode 100644 index e90ecc049..000000000 --- a/.azuredevops/pipelines/templates/variables.yml +++ /dev/null @@ -1,30 +0,0 @@ -variables: - - name: "BuildConfiguration" - value: "Release" - - - name: "vmImage" - value: "ubuntu-latest" - - - name: "Solution" - value: "**/*.sln" - - - name: "TestProject" - value: "**/*.Tests.csproj" - - - name: "NetCoreVersion" - value: "5.0" - - - name: "PublishLocation" - value: "$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp$(NetCoreVersion)" - - - name: "GitTag" - value: "v$(buildVersion)" - - - name: "UiLocation" - value: "$(Build.SourcesDirectory)/src/Ombi/ClientApp/" - - - name: "BuildVersion" - value: "4.0.$(Build.BuildId)" - - - name: isMain - value: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/develop'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))] From 21f07181c3f2e93884bbdedc19fb154f9dfaec2b Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Oct 2021 20:28:48 +0100 Subject: [PATCH 11/13] ci: :construction: fixed versioning --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7011a5943..333cd4410 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -192,9 +192,9 @@ jobs: if: contains(github.ref, 'develop') with: prerelease: true - body: ${{ needs.versioning.outputs.changelog }} - name: ${{ needs.versioning.outputs.tag }} - tag_name: ${{ needs.versioning.outputs.tag }} + body: ${{ steps.changelog.outputs.changelog }} + name: ${{ steps.changelog.outputs.tag }} + tag_name: ${{ steps.changelog.outputs.tag }} files: | artifacts/**/*.tar.gz artifacts/**/*.zip From 031082eabfc7676875caaeef74babb5f50b31ad3 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Oct 2021 20:29:34 +0100 Subject: [PATCH 12/13] chore: bump version --- version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index 0fcc04492..2277f023b 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "4.0.1511" -} \ No newline at end of file + "version": "4.1.0" +} From 804f257040f2fdfa4713961646ca390511c35e19 Mon Sep 17 00:00:00 2001 From: Conventional Changelog Action Date: Fri, 8 Oct 2021 19:35:58 +0000 Subject: [PATCH 13/13] chore(release): :rocket: v4.1.1 --- CHANGELOG.md | 9 +++++++++ version.json | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f86f28f..e3fb23ed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [4.1.1](https://github.com/Ombi-app/Ombi/compare/v4.0.1511...v4.1.1) (2021-10-08) + + +### Bug Fixes + +* **4153:** :bug: fixed gravitar issues ([ec963d8](https://github.com/Ombi-app/Ombi/commit/ec963d869a2bf57edfcfef418e2bf8a1d679d8ca)) + + + ## [4.0.1511](https://github.com/Ombi-app/Ombi/compare/v4.1.0...v4.0.1511) (2021-10-07) diff --git a/version.json b/version.json index 2277f023b..d5081f27d 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "4.1.0" -} + "version": "4.1.1" +} \ No newline at end of file