nicoseiga: fix inability to login to nicoseiga.

NicoSeiga changed it so that on every login, you must enter a 2FA code
sent by email. This broke the NicoSeiga strategy. The fix is to just use
a static session cookie instead (and hope it doesn't expire, and isn't
tied to an IP).

The `nico_seiga_login` and `nico_seiga_password` config settings have
been removed from config/danbooru_default_config.rb and replaced by
`nico_seiga_user_session`. If you run your own Danbooru instance, you
will have to update your config file manually.
This commit is contained in:
evazion
2022-02-22 12:23:01 -06:00
parent c5777f360e
commit 7b009cc893
4 changed files with 20 additions and 24 deletions

View File

@@ -53,7 +53,7 @@ module Sources
PROFILE_PAGE = %r{\Ahttps?://seiga\.nicovideo\.jp/user/illust/(?<artist_id>\d+)}i
def self.enabled?
Danbooru.config.nico_seiga_login.present? && Danbooru.config.nico_seiga_password.present?
Danbooru.config.nico_seiga_user_session.present?
end
def domains
@@ -79,7 +79,7 @@ module Sources
def image_url_for(url)
return url if api_client.blank?
resp = api_client.login.head(url)
resp = api_client.head(url)
if resp.uri.to_s =~ %r{https?://.+/(\w+/\d+/\d+)\z}i
"https://lohas.nicoseiga.jp/priv/#{$1}"
else