diff --git a/app/controllers/iqdb_queries_controller.rb b/app/controllers/iqdb_queries_controller.rb index 8f1393ed2..19e8fa536 100644 --- a/app/controllers/iqdb_queries_controller.rb +++ b/app/controllers/iqdb_queries_controller.rb @@ -2,7 +2,7 @@ class IqdbQueriesController < ApplicationController before_filter :member_only - def create + def index if !Danbooru.config.iqdbs_server raise NotImplementedError.new("the IQDBs service isn't configured. Similarity searches are not available.") end @@ -16,6 +16,9 @@ class IqdbQueriesController < ApplicationController end end + # Support both POST /iqdb_queries and GET /iqdb_queries. + alias_method :create, :index + protected def create_by_url @download = Iqdb::Download.new(params[:url]) diff --git a/config/routes.rb b/config/routes.rb index c8877a524..45cddb0fc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -147,7 +147,7 @@ Rails.application.routes.draw do resource :visit, :controller => "forum_topic_visits" end resources :ip_bans - resources :iqdb_queries, :only => [:create] + resources :iqdb_queries, :only => [:create, :index] resources :janitor_trials do collection do get :test @@ -206,6 +206,7 @@ Rails.application.routes.draw do get :show_seq put :mark_as_translated end + get :similar, :to => "iqdb_queries#index" end resources :post_appeals resources :post_flags