add iqdb preview

This commit is contained in:
Albert Yi
2018-06-22 15:56:15 -07:00
parent bf9750c826
commit 56b40a0255
7 changed files with 44 additions and 17 deletions

View File

@@ -26,4 +26,12 @@ class IqdbQueriesController < ApplicationController
respond_with(@matches)
end
def preview
url = URI.parse(Danbooru.config.iqdbs_server)
url.path = "/similar"
url.query = {url: params[:url]}.to_query
@results = HTTParty.get(url.to_s).parsed_response
render layout: false
end
end