Autodelete phpsessid

fixes #2382
This commit is contained in:
Toks
2015-05-08 13:30:26 -04:00
parent 95abc58a23
commit 6faa6305dd

View File

@@ -57,7 +57,15 @@ module Sources
end end
def get def get
agent.get(URI.parse(normalized_url)) do |page| page = agent.get(URI.parse(normalized_url))
if page.search("body.not-logged-in").any?
# Session cache is invalid, clear it and log in normally.
Cache.delete("pixiv-phpsessid")
@agent = nil
page = agent.get(URI.parse(normalized_url))
end
@artist_name, @profile_url = get_profile_from_page(page) @artist_name, @profile_url = get_profile_from_page(page)
@pixiv_moniker = get_moniker_from_page(page) @pixiv_moniker = get_moniker_from_page(page)
@zip_url, @ugoira_frame_data, @ugoira_content_type = get_zip_url_from_page(page) @zip_url, @ugoira_frame_data, @ugoira_content_type = get_zip_url_from_page(page)
@@ -71,7 +79,6 @@ module Sources
@image_url = get_image_url_from_page(page, is_manga) @image_url = get_image_url_from_page(page, is_manga)
end end
end end
end
def rewrite_thumbnails(thumbnail_url, is_manga=nil) def rewrite_thumbnails(thumbnail_url, is_manga=nil)
thumbnail_url = rewrite_new_medium_images(thumbnail_url) thumbnail_url = rewrite_new_medium_images(thumbnail_url)