diff --git a/app/controllers/iqdb_queries_controller.rb b/app/controllers/iqdb_queries_controller.rb index b18425361..e6950e4f6 100644 --- a/app/controllers/iqdb_queries_controller.rb +++ b/app/controllers/iqdb_queries_controller.rb @@ -2,6 +2,19 @@ class IqdbQueriesController < ApplicationController respond_to :html, :json, :xml def show + if params[:url] + url = URI::HTTP.build(host: Danbooru.config.iqdbs_server, path: "/similar", query: URI.encode_www_form({callback: iqdb_queries_url, url: params[:url]})) + redirect_to url.to_s + return + end + + if params[:post_id] + post = Post.find(params[:post_id]) + url = URI::HTTP.build(host: Danbooru.config.iqdbs_server, path: "/similar", query: URI.encode_www_form({callback: iqdb_queries_url, url: post.preview_file_url})) + redirect_to url.to_s + return + end + if params[:matches] @matches = JSON.parse(params[:matches]) @matches = @matches.map {|x| [Post.find(x[0]), x[1]]} diff --git a/app/views/iqdb_queries/show.html.erb b/app/views/iqdb_queries/show.html.erb index 542be6a2f..c660ff143 100644 --- a/app/views/iqdb_queries/show.html.erb +++ b/app/views/iqdb_queries/show.html.erb @@ -50,7 +50,8 @@ $(function() { $("#filedropzone").dropzone({ paramName: "file", - url: "/iqdb_queries", + url: "<%= Danbooru.config.iqdbs_server %>/similar", + method: "post", createImageThumbnails: false, addRemoveLinks: false, maxFiles: 1,