iqdb: proxy iqdb searches through danbooru.

Previously the search form on the /iqdb_queries page submitted directly
to the iqdb service (karasuma.donmai.us), which redirected back to
Danbooru with the search results.

This was different than API requests, which submitted to
/iqdb_queries.json which proxied the call to iqdb through Danbooru.
Because of this, searches on the /iqdb_queries page had different
behavior than API requests. Things like filesize limits and referrer
spoofing were handled differently.

Now searches on the /iqdb_queries page submit directly to Danbooru. This
is simpler and it means that API requests and HTML requests have the
same behavior.
This commit is contained in:
evazion
2019-10-14 21:16:04 -05:00
parent f7116ad1c4
commit ae521e600e
5 changed files with 43 additions and 34 deletions

View File

@@ -164,11 +164,11 @@ module ApplicationHelper
end
end
def search_form_for(url, classes: "inline-form", &block)
def search_form_for(url, classes: "inline-form", method: :get, &block)
defaults = { required: false }
html_options = { autocomplete: "off", class: "search-form #{classes}" }
simple_form_for(:search, method: :get, url: url, defaults: defaults, html: html_options, &block)
simple_form_for(:search, method: method, url: url, defaults: defaults, html: html_options, &block)
end
def body_attributes(user = CurrentUser.user)