Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Ombi/commit/e12146c98666d5de0471b106e918ff8ea7568468
You should set ROOT_URL correctly, otherwise the web may not work correctly.
10 changed files with
40 additions and
14 deletions
@ -55,15 +55,24 @@ namespace Ombi.Core.Authentication
return await _api . GetAccount ( accessToken ) ;
}
public async Task < Uri > GetOAuthUrl ( int pinId , string code )
public async Task < Uri > GetOAuthUrl ( int pinId , string code , string websiteAddress = null )
{
var settings = await _customizationSettingsService . GetSettingsAsync ( ) ;
if ( settings. ApplicationUrl . IsNullOrEmpty ( ) )
Uri url ;
if ( websiteAddress . IsNullOrEmpty ( ) )
{
return null ;
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 url = _api . GetOAuthUrl ( pinId , code , settings . ApplicationUrl , false ) ;
return url ;
}
@ -9,7 +9,7 @@ namespace Ombi.Core.Authentication
{
Task < string > GetAccessTokenFromPin ( int pinId ) ;
Task < OAuthPin > RequestPin ( ) ;
Task < Uri > GetOAuthUrl ( int pinId , string code );
Task < Uri > GetOAuthUrl ( int pinId , string code , string websiteAddress = null );
Uri GetWizardOAuthUrl ( int pinId , string code , string websiteAddress ) ;
Task < PlexAccount > GetAccount ( string accessToken ) ;
}
@ -112,6 +112,7 @@ namespace Ombi.Helpers
return uriBuilder . Uri ;
}
}
public class ApplicationSettingsException : Exception
@ -6,6 +6,7 @@ namespace Ombi.Core.Settings.Models.External
public sealed class PlexSettings : Ombi . Settings . Settings . Models . Settings
{
public bool Enable { get ; set ; }
public bool EnableOAuth { get ; set ; }
public List < PlexServers > Servers { get ; set ; }
}
@ -43,6 +43,7 @@ export interface IEmbyServer extends IExternalSettings {
export interface IPlexSettings extends ISettings {
enable : boolean ;
enableOAuth : boolean ;
servers : IPlexServer [ ] ;
}
@ -17,7 +17,7 @@ include the remember me checkbox
< / div >
< p id = "profile-name" class = "profile-name-card" > < / p >
< div * ngIf = "!plexEnabled || !customizationSettings.applicationUrl || loginWithOmbi">
< div * ngIf = "!plexEnabled || loginWithOmbi">
< form * ngIf = "authenticationSettings" class = "form-signin" novalidate [ formGroup ] = " form " ( ngSubmit ) = " onSubmit ( form ) " >
@ -41,15 +41,16 @@ include the remember me checkbox
<!-- /form -->
< / div >
<!-- Main OAuth Flow -->
< div class = "form-signin" * ngIf = "plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi" >
< div * ngIf = "plexEnabled && !loginWithOmbi" >
< div class = "form-signin" >
< button class = "btn btn-success" type = "button" ( click ) = " loginWithOmbi = true" >
Sign In With {{appName}}< / button >
< / div >
< div class = "form-signin" * ngIf = "plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi" >
< div class = "form-signin" >
< button class = "btn btn-primary" type = "button" ( click ) = " oauth ( ) " >
Sign In With Plex< / button >
< / div >
< / div >
< / div >
<!-- /card - container -->
@ -125,7 +125,13 @@ export class LoginComponent implements OnDestroy, OnInit {
public oauth() {
this . authService . login ( { usePlexOAuth : true , password : "" , rememberMe :true , username : "" } ) . subscribe ( x = > {
window . location . href = x . url ;
if ( window . frameElement ) {
// in frame
window . open ( x . url , "_blank" ) ;
} else {
// not in frame
window . location . href = x . url ;
}
} ) ;
}
@ -17,6 +17,12 @@
< label for = "enable" > Enable< / label >
< / div >
< / div >
< div class = "form-group col-md-3" >
< div class = "checkbox" >
< input type = "checkbox" id = "enableOAuth" [ ( ngModel ) ] = " settings . enableOAuth " [ checked ] = " settings . enableOAuth " >
< label for = "enableOAuth" > Enable OAuth< / label >
< / div >
< / div >
< div class = "col-md-2 col-md-push-7" >
< button type = "button" ( click ) = " addTab ( ) " class = "btn btn-success-outline" > Add Server< / button >
< / div >
@ -154,7 +154,7 @@ namespace Ombi.Controllers
var s = await Get < PlexSettings > ( ) ;
return s . Enable ;
return s . Enable & & s . EnableOAuth ;
}
/// <summary>
@ -23,7 +23,7 @@ namespace Ombi.Controllers
{
[ApiV1]
[Produces("application/json")]
public class TokenController
public class TokenController : Controller
{
public TokenController ( OmbiUserManager um , IOptions < TokenAuthentication > ta , IAuditRepository audit , ITokenRepository token ,
IPlexOAuthManager oAuthManager )
@ -83,8 +83,9 @@ namespace Ombi.Controllers
// We need a PIN first
var pin = await _plexOAuthManager . RequestPin ( ) ;
var websiteAddress = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}" ;
//https://app.plex.tv/auth#?forwardUrl=http://google.com/&clientID=Ombi-Test&context%5Bdevice%5D%5Bproduct%5D=Ombi%20SSO&pinID=798798&code=4lgfd
var url = await _plexOAuthManager . GetOAuthUrl ( pin . id , pin . code );
var url = await _plexOAuthManager . GetOAuthUrl ( pin . id , pin . code , websiteAddress );
if ( url = = null )
{
return new JsonResult ( new