mirror of https://github.com/Radarr/Radarr
Swap to servarr trakt auth
This commit is contained in:
parent
6ecffc9bed
commit
f2a34e5eda
|
@ -50,7 +50,10 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
if (action == "startOAuth")
|
if (action == "startOAuth")
|
||||||
{
|
{
|
||||||
var request = new HttpRequestBuilder(Settings.OAuthUrl)
|
var request = new HttpRequestBuilder(Settings.OAuthUrl)
|
||||||
.AddQueryParam("target", query["callbackUrl"])
|
.AddQueryParam("client_id", Settings.ClientId)
|
||||||
|
.AddQueryParam("response_type", "code")
|
||||||
|
.AddQueryParam("redirect_uri", Settings.RedirectUri)
|
||||||
|
.AddQueryParam("state", query["callbackUrl"])
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
@ -62,10 +65,10 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
{
|
{
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
accessToken = query["access"],
|
accessToken = query["access_token"],
|
||||||
expires = DateTime.UtcNow.AddSeconds(4838400),
|
expires = DateTime.UtcNow.AddSeconds(int.Parse(query["expires_in"])),
|
||||||
refreshToken = query["refresh"],
|
refreshToken = query["refresh_token"],
|
||||||
authUser = GetUserName(query["access"])
|
authUser = GetUserName(query["access_token"])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +112,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
Settings.Validate().Filter("RefreshToken").ThrowOnError();
|
Settings.Validate().Filter("RefreshToken").ThrowOnError();
|
||||||
|
|
||||||
var request = new HttpRequestBuilder(Settings.RenewUri)
|
var request = new HttpRequestBuilder(Settings.RenewUri)
|
||||||
.AddQueryParam("refresh", Settings.RefreshToken)
|
.AddQueryParam("refresh_token", Settings.RefreshToken)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -39,8 +39,6 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
// Limit not smaller than 1 and not larger than 100
|
// Limit not smaller than 1 and not larger than 100
|
||||||
RuleFor(c => c.Limit)
|
RuleFor(c => c.Limit)
|
||||||
.GreaterThan(0)
|
.GreaterThan(0)
|
||||||
|
|
||||||
// .InclusiveBetween(1, 500)
|
|
||||||
.WithMessage("Must be integer greater than 0");
|
.WithMessage("Must be integer greater than 0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +50,6 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
|
|
||||||
public TraktSettingsBase()
|
public TraktSettingsBase()
|
||||||
{
|
{
|
||||||
Link = "https://api.trakt.tv";
|
|
||||||
SignIn = "startOAuth";
|
SignIn = "startOAuth";
|
||||||
Rating = "0-100";
|
Rating = "0-100";
|
||||||
Certification = "NR,G,PG,PG-13,R,NC-17";
|
Certification = "NR,G,PG,PG-13,R,NC-17";
|
||||||
|
@ -61,9 +58,11 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
Limit = 100;
|
Limit = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OAuthUrl => "http://radarr.aeonlucid.com/v1/trakt/redirect";
|
public string Link => "https://api.trakt.tv";
|
||||||
public string RenewUri => "http://radarr.aeonlucid.com/v1/trakt/refresh";
|
public string OAuthUrl => "https://api.trakt.tv/oauth/authorize";
|
||||||
public string ClientId => "964f67b126ade0112c4ae1f0aea3a8fb03190f71117bd83af6a0560a99bc52e6";
|
public string RedirectUri => "https://auth.servarr.com/v1/trakt/auth";
|
||||||
|
public string RenewUri => "https://auth.servarr.com/v1/trakt/renew";
|
||||||
|
public string ClientId => "64508a8bf370cee550dde4806469922fd7cd70afb2d5690e3ee7f75ae784b70e";
|
||||||
public virtual string Scope => "";
|
public virtual string Scope => "";
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Access Token", Type = FieldType.Textbox, Hidden = HiddenType.Hidden)]
|
[FieldDefinition(0, Label = "Access Token", Type = FieldType.Textbox, Hidden = HiddenType.Hidden)]
|
||||||
|
@ -78,9 +77,6 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||||
[FieldDefinition(0, Label = "Auth User", Type = FieldType.Textbox, Hidden = HiddenType.Hidden)]
|
[FieldDefinition(0, Label = "Auth User", Type = FieldType.Textbox, Hidden = HiddenType.Hidden)]
|
||||||
public string AuthUser { get; set; }
|
public string AuthUser { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Trakt API URL", HelpText = "Link to to Trakt API URL, do not change unless you know what you are doing.")]
|
|
||||||
public string Link { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Rating", HelpText = "Filter movies by rating range (0-100)")]
|
[FieldDefinition(1, Label = "Rating", HelpText = "Filter movies by rating range (0-100)")]
|
||||||
public string Rating { get; set; }
|
public string Rating { get; set; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue