about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-10-02 01:23:32 +0200
committerGitHub <noreply@github.com>2017-10-02 01:23:32 +0200
commit47ecd652d3f8256a191401f005d42760e858e6de (patch)
treeaa536551b0722bfc15c26d9b5bc4b54b63d2d4f4 /app
parent04fa4eb7f95a53138949aac9dd5041a2bdade277 (diff)
Make Chrome splash screen same color as web UI's background color (#5169)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/manifests_controller.rb8
-rw-r--r--app/serializers/manifest_serializer.rb52
-rw-r--r--app/views/manifests/show.json.rabl11
3 files changed, 54 insertions, 17 deletions
diff --git a/app/controllers/manifests_controller.rb b/app/controllers/manifests_controller.rb
index 832e1eb6f..ac267c229 100644
--- a/app/controllers/manifests_controller.rb
+++ b/app/controllers/manifests_controller.rb
@@ -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
diff --git a/app/serializers/manifest_serializer.rb b/app/serializers/manifest_serializer.rb
new file mode 100644
index 000000000..95bcc21bb
--- /dev/null
+++ b/app/serializers/manifest_serializer.rb
@@ -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
diff --git a/app/views/manifests/show.json.rabl b/app/views/manifests/show.json.rabl
deleted file mode 100644
index ee0a70324..000000000
--- a/app/views/manifests/show.json.rabl
+++ /dev/null
@@ -1,11 +0,0 @@
-object false
-
-node(:name)             { Setting.site_title }
-node(:short_name)       { Setting.site_title }
-node(:description)      { strip_tags(Setting.site_description.presence || I18n.t('about.about_mastodon_html')) }
-node(:icons)            { [{ src: '/android-chrome-192x192.png', sizes: '192x192', type: 'image/png' }] }
-node(:theme_color)      { '#282c37' }
-node(:background_color) { '#d9e1e8' }
-node(:display)          { 'standalone' }
-node(:start_url)        { '/web/timelines/home' }
-node(:scope)            { root_url }