From ac597af7026a114ea14a1235e70bba8163b00953 Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 25 Apr 2018 21:10:26 +0100 Subject: [PATCH 1/7] Fix build !wip --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 58eadd651..a497c5f77 100644 --- a/build.cake +++ b/build.cake @@ -1,7 +1,7 @@ #tool "nuget:?package=GitVersion.CommandLine" #addin "Cake.Gulp" -#addin "Cake.Npm" +#addin "nuget:?package=Cake.Npm&version=0.13.0" #addin "SharpZipLib" #addin nuget:?package=Cake.Compression&version=0.1.4 #addin "Cake.Incubator" From 28159cdf5301322687b8d8796ca733aae89be4c8 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 27 Apr 2018 20:49:18 +0100 Subject: [PATCH 2/7] Potential fix for #2119 --- .../createadmin/createadmin.component.ts | 18 +---------------- .../app/wizard/plex/plex.component.ts | 20 +------------------ src/Ombi/Controllers/IdentityController.cs | 9 +++++++++ 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts index 07f47f265..f36b7ee36 100644 --- a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts +++ b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts @@ -20,23 +20,7 @@ export class CreateAdminComponent { public createUser() { this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => { if (x) { - // Log me in. - this.auth.login({ username: this.username, password: this.password, rememberMe: false, usePlexOAuth:false }).subscribe(c => { - - localStorage.setItem("id_token", c.access_token); - - // Mark that we have done the settings now - this.settings.getOmbi().subscribe(ombi => { - ombi.wizard = true; - - this.settings.saveOmbi(ombi).subscribe(x => { - - this.router.navigate(["search"]); - }); - - }); - - }); + this.router.navigate(["login"]); } else { this.notificationService.error("There was an error... You might want to put this on Github..."); } diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index bafe67756..6d3d8b69c 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -32,25 +32,7 @@ export class PlexComponent { usePlexAdminAccount: true, }).subscribe(y => { if (y) { - this.auth.login({ username: this.login, password: this.password, rememberMe: false, usePlexOAuth: false }).subscribe(c => { - localStorage.setItem("id_token", c.access_token); - - // Mark that we have done the settings now - this.settings.getOmbi().subscribe(ombi => { - ombi.wizard = true; - - this.settings.saveOmbi(ombi).subscribe(s => { - this.settings.getUserManagementSettings().subscribe(usr => { - - usr.importPlexAdmin = true; - this.settings.saveUserManagementSettings(usr).subscribe(saved => { - this.router.navigate(["login"]); - }); - }); - - }); - }); - }); + this.router.navigate(["login"]); } else { this.notificationService.error("Could not get the Plex Admin Information"); return; diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs index 8a9c76a34..ffaff8ff0 100644 --- a/src/Ombi/Controllers/IdentityController.cs +++ b/src/Ombi/Controllers/IdentityController.cs @@ -48,6 +48,7 @@ namespace Ombi.Controllers public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager rm, IEmailProvider prov, ISettingsService s, ISettingsService c, + ISettingsService ombiSettings, IWelcomeEmail welcome, IMovieRequestRepository m, ITvRequestRepository t, @@ -73,6 +74,7 @@ namespace Ombi.Controllers _issuesRepository = issues; _requestLogRepository = requestLog; _issueCommentsRepository = issueComments; + OmbiSettings = ombiSettings; } private OmbiUserManager UserManager { get; } @@ -81,6 +83,7 @@ namespace Ombi.Controllers private IEmailProvider EmailProvider { get; } private ISettingsService EmailSettings { get; } private ISettingsService CustomizationSettings { get; } + private ISettingsService OmbiSettings { get; } private IWelcomeEmail WelcomeEmail { get; } private IMovieRequestRepository MovieRepo { get; } private ITvRequestRepository TvRepo { get; } @@ -174,6 +177,12 @@ namespace Ombi.Controllers { LogErrors(result); } + + // Update the wizard flag + var settings = await OmbiSettings.GetSettingsAsync(); + settings.Wizard = true; + await OmbiSettings.SaveSettingsAsync(settings); + return result.Succeeded; } From 0bbeeaeb3ef9fbb11199a6e0293818a013bb5dba Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 27 Apr 2018 21:36:34 +0100 Subject: [PATCH 3/7] Fix build !wip --- .../app/wizard/createadmin/createadmin.component.ts | 4 +--- src/Ombi/ClientApp/app/wizard/plex/plex.component.ts | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts index f36b7ee36..b997f1d9f 100644 --- a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts +++ b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts @@ -1,10 +1,8 @@ import { Component } from "@angular/core"; import { Router } from "@angular/router"; -import { AuthService } from "../../auth/auth.service"; import { IdentityService } from "../../services"; import { NotificationService } from "../../services"; -import { SettingsService } from "../../services"; @Component({ templateUrl: "./createadmin.component.html", @@ -15,7 +13,7 @@ export class CreateAdminComponent { public password: string; constructor(private identityService: IdentityService, private notificationService: NotificationService, - private router: Router, private auth: AuthService, private settings: SettingsService) { } + private router: Router) { } public createUser() { this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => { diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index 6d3d8b69c..0ba476fc0 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -2,8 +2,7 @@ import { Router } from "@angular/router"; import { PlexService } from "../../services"; -import { IdentityService, NotificationService, SettingsService } from "../../services"; -import { AuthService } from "./../../auth/auth.service"; +import { IdentityService, NotificationService, } from "../../services"; @Component({ templateUrl: "./plex.component.html", @@ -15,9 +14,7 @@ export class PlexComponent { constructor(private plexService: PlexService, private router: Router, private notificationService: NotificationService, - private identityService: IdentityService, - private settings: SettingsService, - private auth: AuthService) { } + private identityService: IdentityService) { } public requestAuthToken() { this.plexService.logIn(this.login, this.password).subscribe(x => { From 3532c20ea62853909c5adf5f1617488d1605f1ca Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 27 Apr 2018 22:00:12 +0100 Subject: [PATCH 4/7] Really fixed #2119 this time !wip --- src/Ombi/Controllers/IdentityController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs index ffaff8ff0..4aaf86d4b 100644 --- a/src/Ombi/Controllers/IdentityController.cs +++ b/src/Ombi/Controllers/IdentityController.cs @@ -110,7 +110,7 @@ namespace Ombi.Controllers public async Task CreateWizardUser([FromBody] CreateUserWizardModel user) { var users = UserManager.Users; - if (users.Any()) + if (users.Any(x => !x.UserName.Equals("api", StringComparison.CurrentCultureIgnoreCase))) { // No one should be calling this. Only the wizard return false; From affbd2ff657053f7b11056eb817e91319435a3bb Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 27 Apr 2018 22:01:38 +0100 Subject: [PATCH 5/7] !wip --- src/Ombi/ClientApp/app/wizard/plex/plex.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index 0ba476fc0..67bd672dc 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -2,7 +2,7 @@ import { Router } from "@angular/router"; import { PlexService } from "../../services"; -import { IdentityService, NotificationService, } from "../../services"; +import { IdentityService, NotificationService } from "../../services"; @Component({ templateUrl: "./plex.component.html", From 647a01ebb064faccbf3095b02db46494ded62973 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 28 Apr 2018 20:47:42 +0100 Subject: [PATCH 6/7] Use the Application URL if we have it to fix #2201 --- .../Authentication/PlexOAuthManager.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/Ombi.Core/Authentication/PlexOAuthManager.cs b/src/Ombi.Core/Authentication/PlexOAuthManager.cs index f3a3e4d01..37ed7d2f7 100644 --- a/src/Ombi.Core/Authentication/PlexOAuthManager.cs +++ b/src/Ombi.Core/Authentication/PlexOAuthManager.cs @@ -57,21 +57,8 @@ namespace Ombi.Core.Authentication public async Task GetOAuthUrl(int pinId, string code, string websiteAddress = null) { - Uri url; - if (websiteAddress.IsNullOrEmpty()) - { - var settings = await _customizationSettingsService.GetSettingsAsync(); - if (settings.ApplicationUrl.IsNullOrEmpty()) - { - return null; - } - - url = _api.GetOAuthUrl(pinId, code, settings.ApplicationUrl, false); - } - else - { - url = _api.GetOAuthUrl(pinId, code, websiteAddress, false); - } + var settings = await _customizationSettingsService.GetSettingsAsync(); + var url = _api.GetOAuthUrl(pinId, code, settings.ApplicationUrl.IsNullOrEmpty() ? websiteAddress : settings.ApplicationUrl, false); return url; } From 675ed52c938f7d5b09d9f5cd6e2225e595802d41 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 28 Apr 2018 20:48:48 +0100 Subject: [PATCH 7/7] !wip changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e94945927..adf162831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,19 @@ ## (unreleased) +### **Fixes** + +- Potential fix for #2119. [Jamie Rees] + +- Use the Application URL if we have it to fix #2201. [Jamie] + + +## v3.0.3239 (2018-04-26) + ### **New Features** +- Update appveyor.yml. [Jamie] + - Added paging to the TV Requests page. [Jamie Rees] - Added Paging to the Movie Requests Page. [Jamie Rees] @@ -18,6 +29,8 @@ ### **Fixes** +- Clean up the error code when the OAuth user is not authorized. [Jamie] + - More improvements to the Plex OAuth, Added the ability to turn it off if needed. [Jamie] - Fixed bug #2188 #2134. [Jamie]