diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api_controller.rb | 8 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 0776f4ce8..273aaff85 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -4,6 +4,7 @@ class ApiController < ApplicationController skip_before_action :verify_authenticity_token before_action :set_rate_limit_headers + before_action :set_cors_headers rescue_from ActiveRecord::RecordInvalid do |e| render json: { error: e.to_s }, status: 422 @@ -46,6 +47,13 @@ class ApiController < ApplicationController response.headers['X-RateLimit-Reset'] = (now + (match_data[:period] - now.to_i % match_data[:period])).to_s end + def set_cors_headers + response.headers['Access-Control-Allow-Origin'] = '*' + response.headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' + response.headers['Access-Control-Request-Method'] = '*' + response.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization' + end + def current_resource_owner User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 89c7b14c4..3ec743768 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -5,6 +5,11 @@ %meta{:name => 'viewport', :content => 'width=device-width, initial-scale=1'}/ %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge'}/ + %link{:rel => "apple-touch-icon", :sizes => "180x180", :href => "/assets/apple-touch-icon.png"}/ + %link{:rel => "manifest", :href => "/assets/manifest.json"}/ + %meta{:name => "msapplication-config", :content => "/assets/browserconfig.xml"}/ + %meta{:name => "theme-color", :content => "#ffffff"}/ + %title = "#{yield(:page_title)} - " if content_for?(:page_title) Mastodon |