mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop
This commit is contained in:
commit
6fdeeea87b
14 changed files with 107 additions and 330 deletions
|
@ -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
|
|
@ -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
|
|
@ -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'
|
|
@ -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'))]
|
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -184,26 +192,13 @@ 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
|
||||
|
||||
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
|
||||
|
@ -214,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'}"
|
||||
|
||||
|
||||
|
|
56
CHANGELOG.md
56
CHANGELOG.md
|
@ -1,3 +1,25 @@
|
|||
## [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)
|
||||
|
||||
|
||||
|
||||
# [4.1.0](https://github.com/Ombi-app/Ombi/compare/v4.0.1510...v4.1.0) (2021-10-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* :sparkles: Added the ability to specify which branch you are on ([61f3e94](https://github.com/Ombi-app/Ombi/commit/61f3e94308fb3d239140b73d34c12f1496459989))
|
||||
|
||||
|
||||
|
||||
## [4.0.1510](https://github.com/Ombi-app/Ombi/compare/v4.0.1602...v4.0.1510) (2021-10-07)
|
||||
|
||||
|
||||
|
@ -5,6 +27,7 @@
|
|||
|
||||
* :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))
|
||||
* :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))
|
||||
|
@ -13,36 +36,3 @@
|
|||
|
||||
|
||||
|
||||
## [4.1.9](https://github.com/Ombi-app/Ombi/compare/v4.1.8...v4.1.9) (2021-09-29)
|
||||
|
||||
|
||||
|
||||
## [4.1.7](https://github.com/Ombi-app/Ombi/compare/v4.1.6...v4.1.7) (2021-09-29)
|
||||
|
||||
|
||||
|
||||
## [4.1.6](https://github.com/Ombi-app/Ombi/compare/v4.1.5...v4.1.6) (2021-09-29)
|
||||
|
||||
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :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)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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();"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -89,8 +89,10 @@
|
|||
</div>
|
||||
<div class="profile-block">
|
||||
<a routerLink="/user-preferences">
|
||||
<div class="profile-username" data-test="profile-username">{{username}}</div>
|
||||
<div class="profile-img" data-test="profile-image"><img [src]="getUserImage()" /></div>
|
||||
<div class="profile-username" data-test="profile-username">{{userName}}</div>
|
||||
<div class="profile-img" data-test="profile-image">
|
||||
<img [src]="userProfileImageUrl" (error)="onProfileImageError()" >
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div class="small-middle-container" *ngIf="username">
|
||||
<div class="d-flex">
|
||||
<img class="profile-img" [src]="getProfileImage()">
|
||||
<img class="profile-img" [src]="userProfileImageUrl" (error)="onProfileImageError()" >
|
||||
<h2 id="usernameTitle">{{username}}
|
||||
<small id="emailTitle" *ngIf="user.emailAddress">({{user.emailAddress}})</small>
|
||||
<small id="emailTitle" *ngIf="user?.emailAddress">({{user.emailAddress}})</small>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
User Type:
|
||||
</div>
|
||||
<div class="col-7 col-sm-9 col-md-10">
|
||||
{{UserType[user.userType]}}
|
||||
{{UserType[user?.userType]}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
|||
</div>
|
||||
|
||||
</mat-tab>
|
||||
<mat-tab *ngIf="user.userType === UserType.LocalUser" label="Security">
|
||||
<mat-tab *ngIf="user?.userType === UserType.LocalUser" label="Security">
|
||||
<div class="tab-content">
|
||||
<h2>Change Details</h2>
|
||||
<form novalidate [formGroup]="passwordForm" (ngSubmit)="updatePassword()">
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -182,7 +182,7 @@
|
|||
<button type="button" data-test="deletebtn" mat-raised-button color="warn" class="btn btn-danger-outline" (click)="delete()">Delete</button>
|
||||
<button type="button" style="float:right;" mat-raised-button color="primary" class="btn btn-info-outline" (click)="resetPassword()" matTooltip="You need your SMTP settings setup">Send
|
||||
Reset Password Link</button>
|
||||
<button *ngIf="customization.applicationUrl" type="button" mat-raised-button color="accent" class="btn btn-info-outline" (click)="appLink()" matTooltip="Send this link to the user and they can then open the app and directly login">Copy users App Link</button>
|
||||
<button *ngIf="customization?.applicationUrl" type="button" mat-raised-button color="accent" class="btn btn-info-outline" (click)="appLink()" matTooltip="Send this link to the user and they can then open the app and directly login">Copy users App Link</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "4.0.1510"
|
||||
"version": "4.1.1"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue