fixes #2130
This commit is contained in:
@@ -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
|
||||
30
app/controllers/iqdb_queries_controller.rb
Normal file
30
app/controllers/iqdb_queries_controller.rb
Normal 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
|
||||
Reference in New Issue
Block a user