From e15f955677a6443d370fde57808830e6087fcb0e Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 23 Dec 2016 18:44:43 -0600 Subject: [PATCH] /iqdb_queries: support json/xml api responses. --- app/controllers/iqdb_queries_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/iqdb_queries_controller.rb b/app/controllers/iqdb_queries_controller.rb index 19e8fa536..e5b88b425 100644 --- a/app/controllers/iqdb_queries_controller.rb +++ b/app/controllers/iqdb_queries_controller.rb @@ -1,6 +1,7 @@ # todo: move this to iqdbs class IqdbQueriesController < ApplicationController before_filter :member_only + respond_to :html, :json, :xml def index if !Danbooru.config.iqdbs_server @@ -24,7 +25,9 @@ protected @download = Iqdb::Download.new(params[:url]) @download.find_similar @results = @download.matches - render :layout => false, :action => "create_by_url" + respond_with(@results) do |fmt| + fmt.html { render :layout => false, :action => "create_by_url" } + end end def create_by_post @@ -32,6 +35,8 @@ protected @download = Iqdb::Download.new(@post.complete_preview_file_url) @download.find_similar @results = @download.matches - render :layout => false, :action => "create_by_post" + respond_with(@results) do |fmt| + fmt.js { render :layout => false, :action => "create_by_post" } + end end end