Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Make Chrome splash screen same color as web UI's background color (ma…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Oct 1, 2017
1 parent 04fa4eb commit 47ecd65
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 21 deletions.
8 changes: 2 additions & 6 deletions app/controllers/manifests_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# frozen_string_literal: true

class ManifestsController < ApplicationController
before_action :set_instance_presenter

def show; end

def set_instance_presenter
@instance_presenter = InstancePresenter.new
def show
render json: InstancePresenter.new, serializer: ManifestSerializer
end
end
52 changes: 52 additions & 0 deletions app/serializers/manifest_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# frozen_string_literal: true

class ManifestSerializer < ActiveModel::Serializer
include RoutingHelper
include ActionView::Helpers::TextHelper

attributes :name, :short_name, :description,
:icons, :theme_color, :background_color,
:display, :start_url, :scope

def name
object.site_title
end

def short_name
object.site_title
end

def description
strip_tags(object.site_description.presence || I18n.t('about.about_mastodon_html'))
end

def icons
[
{
src: '/android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
},
]
end

def theme_color
'#282c37'
end

def background_color
'#191b22'
end

def display
'standalone'
end

def start_url
'/web/timelines/home'
end

def scope
root_url
end
end
11 changes: 0 additions & 11 deletions app/views/manifests/show.json.rabl

This file was deleted.

4 changes: 0 additions & 4 deletions spec/controllers/manifests_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
get :show, format: :json
end

it 'assigns @instance_presenter' do
expect(assigns(:instance_presenter)).to be_kind_of InstancePresenter
end

it 'returns http success' do
expect(response).to have_http_status(:success)
end
Expand Down

0 comments on commit 47ecd65

Please sign in to comment.