support url/post_id params on iqdb queries endpoint
This commit is contained in:
@@ -2,6 +2,19 @@ class IqdbQueriesController < ApplicationController
|
|||||||
respond_to :html, :json, :xml
|
respond_to :html, :json, :xml
|
||||||
|
|
||||||
def show
|
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]
|
if params[:matches]
|
||||||
@matches = JSON.parse(params[:matches])
|
@matches = JSON.parse(params[:matches])
|
||||||
@matches = @matches.map {|x| [Post.find(x[0]), x[1]]}
|
@matches = @matches.map {|x| [Post.find(x[0]), x[1]]}
|
||||||
|
|||||||
@@ -50,7 +50,8 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
$("#filedropzone").dropzone({
|
$("#filedropzone").dropzone({
|
||||||
paramName: "file",
|
paramName: "file",
|
||||||
url: "/iqdb_queries",
|
url: "<%= Danbooru.config.iqdbs_server %>/similar",
|
||||||
|
method: "post",
|
||||||
createImageThumbnails: false,
|
createImageThumbnails: false,
|
||||||
addRemoveLinks: false,
|
addRemoveLinks: false,
|
||||||
maxFiles: 1,
|
maxFiles: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user