/iqdb_queries: support both GET and POST; add GET /posts/1/similar.

This commit is contained in:
evazion
2016-12-23 01:33:40 -06:00
parent f2da569978
commit c402e15cca
2 changed files with 6 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
class IqdbQueriesController < ApplicationController class IqdbQueriesController < ApplicationController
before_filter :member_only before_filter :member_only
def create def index
if !Danbooru.config.iqdbs_server if !Danbooru.config.iqdbs_server
raise NotImplementedError.new("the IQDBs service isn't configured. Similarity searches are not available.") raise NotImplementedError.new("the IQDBs service isn't configured. Similarity searches are not available.")
end end
@@ -16,6 +16,9 @@ class IqdbQueriesController < ApplicationController
end end
end end
# Support both POST /iqdb_queries and GET /iqdb_queries.
alias_method :create, :index
protected protected
def create_by_url def create_by_url
@download = Iqdb::Download.new(params[:url]) @download = Iqdb::Download.new(params[:url])

View File

@@ -147,7 +147,7 @@ Rails.application.routes.draw do
resource :visit, :controller => "forum_topic_visits" resource :visit, :controller => "forum_topic_visits"
end end
resources :ip_bans resources :ip_bans
resources :iqdb_queries, :only => [:create] resources :iqdb_queries, :only => [:create, :index]
resources :janitor_trials do resources :janitor_trials do
collection do collection do
get :test get :test
@@ -206,6 +206,7 @@ Rails.application.routes.draw do
get :show_seq get :show_seq
put :mark_as_translated put :mark_as_translated
end end
get :similar, :to => "iqdb_queries#index"
end end
resources :post_appeals resources :post_appeals
resources :post_flags resources :post_flags