From d5404eaad7837010d6e4563cd8f7a1009231d362 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 11 Dec 2021 22:39:09 +0000 Subject: [PATCH] fix(oauth): :lock: Fixed the issue where some users running their browsers in a different language could not open the Plex OAuth window #4408 --- src/Ombi/ClientApp/src/app/login/login.component.ts | 6 ++++++ .../src/app/services/applications/plextv.service.ts | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/login/login.component.ts b/src/Ombi/ClientApp/src/app/login/login.component.ts index 592758c9f..235e31a8e 100644 --- a/src/Ombi/ClientApp/src/app/login/login.component.ts +++ b/src/Ombi/ClientApp/src/app/login/login.component.ts @@ -177,6 +177,7 @@ export class LoginComponent implements OnDestroy, OnInit { if (this.oAuthWindow) { this.oAuthWindow.close(); } + this.oAuthWindow = window.open( window.location.toString(), "_blank", @@ -214,6 +215,11 @@ export class LoginComponent implements OnDestroy, OnInit { } public getPinResult(pinId: number) { + if (this.oAuthWindow.closed) { + if (this.pinTimer) { + clearInterval(this.pinTimer); + } + } this.authService.oAuth(pinId).subscribe( (x) => { if (x.access_token) { diff --git a/src/Ombi/ClientApp/src/app/services/applications/plextv.service.ts b/src/Ombi/ClientApp/src/app/services/applications/plextv.service.ts index 3ce0e0a8b..4a492ccae 100644 --- a/src/Ombi/ClientApp/src/app/services/applications/plextv.service.ts +++ b/src/Ombi/ClientApp/src/app/services/applications/plextv.service.ts @@ -1,10 +1,8 @@ -import { PlatformLocation, APP_BASE_HREF } from "@angular/common"; -import { HttpClient, HttpHeaders } from "@angular/common/http"; -import { Injectable, Inject } from "@angular/core"; - -import { Observable } from "rxjs"; +import { HttpClient, HttpHeaders } from "@angular/common/http"; import { IPlexPin } from "../../interfaces"; +import { Injectable } from "@angular/core"; +import { Observable } from "rxjs"; @Injectable() export class PlexTvService { @@ -13,7 +11,7 @@ export class PlexTvService { } public GetPin(clientId: string, applicationName: string): Observable { - const headers = new HttpHeaders({"Content-Type": "application/json", + const headers = new HttpHeaders({"Content-Type": "application/json; charset=ISO-8859-1", "X-Plex-Client-Identifier": clientId, "X-Plex-Product": applicationName, "X-Plex-Version": "3",