This commit is contained in:
r888888888
2014-04-25 17:15:09 -07:00
parent ceddf792f1
commit 9e2c664a41
10 changed files with 56 additions and 16 deletions

View File

@@ -1,8 +0,0 @@
class IqdbController < ApplicationController
def similar_by_source
@download = Iqdb::Download.new(params[:source])
@download.download_from_source
@download.find_similar
render :layout => false
end
end

View File

@@ -0,0 +1,30 @@
class IqdbQueriesController < ApplicationController
before_filter :member_only
def create
if !Danbooru.config.iqdb_hostname_and_port
render :nothing => true
return
end
if params[:url]
create_by_url
elsif params[:post_id]
create_by_post
end
end
protected
def create_by_url
@download = Iqdb::Download.new(params[:url])
@download.download_from_source
@download.find_similar
render :layout => false, :action => "create_by_url"
end
def create_by_post
@post = Post.find(params[:post_id])
@results = Iqdb::Server.default.similar(@post.id, 3)
render :layout => false, :action => "create_by_post"
end
end