diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-26 10:20:15 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-26 10:20:15 -0500 |
| commit | 686e17f489b05dfb2114db529eb68d5db51e888c (patch) | |
| tree | cfad54cc8307859c80bfc10c910c3c0d65b756b4 /src/invidious.cr | |
| parent | 73443143cf90cca97965b2d438e7f33e436bd4cd (diff) | |
| download | invidious-686e17f489b05dfb2114db529eb68d5db51e888c.tar.gz invidious-686e17f489b05dfb2114db529eb68d5db51e888c.tar.bz2 invidious-686e17f489b05dfb2114db529eb68d5db51e888c.zip | |
Add fix to switch to supported authentication schemes
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 2cc34d61..b16af9a4 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1124,7 +1124,18 @@ post "/login" do |env| if challenge_results[0][-1][0].as_a? # Prefer Authenticator app and SMS over unsupported protocols - tfa = challenge_results[0][-1][0].as_a.select { |auth_type| auth_type[8] == 6 || auth_type[8] == 9 }[0] + if challenge_results[0][-1][0][0][8] != 6 || challenge_results[0][-1][0][0][8] != 9 + tfa = challenge_results[0][-1][0].as_a.select { |auth_type| auth_type[8] == 6 || auth_type[8] == 9 }[0] + select_challenge = "[#{challenge_results[0][-1][0].as_a.index(tfa).not_nil!}]" + + tl = challenge_results[1][2] + + tfa = client.post("/_/signin/selectchallenge?TL=#{tl}", headers, login_req(inputs, select_challenge)).body + tfa = tfa[5..-1] + tfa = JSON.parse(tfa)[0][-1] + else + tfa = challenge_results[0][-1][0][0] + end if tfa[2] == "TWO_STEP_VERIFICATION" if tfa[5] == "QUOTA_EXCEEDED" |
