fixes #2444
This commit is contained in:
@@ -18,6 +18,10 @@ class ApplicationController < ActionController::Base
|
|||||||
rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit
|
rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
def enable_cors
|
||||||
|
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
end
|
||||||
|
|
||||||
def api_check
|
def api_check
|
||||||
if request.format.to_s =~ /\/json|\/xml/ || params[:controller] == "iqdb"
|
if request.format.to_s =~ /\/json|\/xml/ || params[:controller] == "iqdb"
|
||||||
if ApiLimiter.throttled?(request.remote_ip)
|
if ApiLimiter.throttled?(request.remote_ip)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_filter :member_only, :except => [:show, :show_seq, :index, :home, :random]
|
before_filter :member_only, :except => [:show, :show_seq, :index, :home, :random]
|
||||||
before_filter :builder_only, :only => [:copy_notes]
|
before_filter :builder_only, :only => [:copy_notes]
|
||||||
|
before_filter :enable_cors, :only => [:index, :show]
|
||||||
after_filter :save_recent_tags, :only => [:update]
|
after_filter :save_recent_tags, :only => [:update]
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
rescue_from PostSets::SearchError, :with => :rescue_exception
|
rescue_from PostSets::SearchError, :with => :rescue_exception
|
||||||
|
|||||||
Reference in New Issue
Block a user