/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
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])

View File

@@ -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