FEATURE: custom setting for large square site icon
This icon is used for android splash screen
This commit is contained in:
parent
3c8a48f768
commit
56412adad5
|
@ -13,7 +13,7 @@ class MetadataController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def default_manifest
|
def default_manifest
|
||||||
logo = SiteSetting.mobile_logo_url.presence || SiteSetting.logo_small_url.presence || SiteSetting.apple_touch_icon_url.presence
|
logo = SiteSetting.large_icon_url.presence || SiteSetting.logo_small_url.presence || SiteSetting.apple_touch_icon_url.presence
|
||||||
|
|
||||||
manifest = {
|
manifest = {
|
||||||
name: SiteSetting.title,
|
name: SiteSetting.title,
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SiteController < ApplicationController
|
||||||
title: SiteSetting.title,
|
title: SiteSetting.title,
|
||||||
description: SiteSetting.site_description
|
description: SiteSetting.site_description
|
||||||
}
|
}
|
||||||
results[:mobile_logo_url] = SiteSetting.mobile_logo_url if SiteSetting.mobile_logo_url.present?
|
results[:mobile_logo_url] = SiteSetting.mobile_logo_url.presence
|
||||||
|
|
||||||
DiscourseHub.stats_fetched_at = Time.zone.now if request.user_agent == "Discourse Hub"
|
DiscourseHub.stats_fetched_at = Time.zone.now if request.user_agent == "Discourse Hub"
|
||||||
|
|
||||||
|
|
|
@ -1011,7 +1011,8 @@ en:
|
||||||
digest_logo_url: "The alternate logo image used at the top of your site's email summary. Should be a wide rectangle shape. Should not be an SVG image. If left blank `logo_url` will be used."
|
digest_logo_url: "The alternate logo image used at the top of your site's email summary. Should be a wide rectangle shape. Should not be an SVG image. If left blank `logo_url` will be used."
|
||||||
logo_small_url: "The small logo image at the top left of your site, should be a square shape, seen when scrolling down. If left blank a home glyph will be shown."
|
logo_small_url: "The small logo image at the top left of your site, should be a square shape, seen when scrolling down. If left blank a home glyph will be shown."
|
||||||
favicon_url: "A favicon for your site, see http://en.wikipedia.org/wiki/Favicon, to work correctly over a CDN it must be a png"
|
favicon_url: "A favicon for your site, see http://en.wikipedia.org/wiki/Favicon, to work correctly over a CDN it must be a png"
|
||||||
mobile_logo_url: "The fixed position logo image used at the top left of your mobile site and as your logo/splash image on Android. Recommended size is 512px by 512px. If left blank, `logo_url` will be used. eg: http://example.com/uploads/default/logo.png"
|
mobile_logo_url: "Custom logo url used on mobile version of your site. If left blank, `logo_url` will be used. eg: http://example.com/uploads/default/logo.png"
|
||||||
|
large_icon_url: "Image used as logo/splash image on Android. Recommended size is 512px by 512px."
|
||||||
apple_touch_icon_url: "Icon used for Apple touch devices. Recommended size is 144px by 144px."
|
apple_touch_icon_url: "Icon used for Apple touch devices. Recommended size is 144px by 144px."
|
||||||
|
|
||||||
notification_email: "The from: email address used when sending all essential system emails. The domain specified here must have SPF, DKIM and reverse PTR records set correctly for email to arrive."
|
notification_email: "The from: email address used when sending all essential system emails. The domain specified here must have SPF, DKIM and reverse PTR records set correctly for email to arrive."
|
||||||
|
|
|
@ -54,6 +54,8 @@ required:
|
||||||
mobile_logo_url:
|
mobile_logo_url:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ''
|
||||||
|
large_icon_url:
|
||||||
|
default: ''
|
||||||
favicon_url:
|
favicon_url:
|
||||||
client: true
|
client: true
|
||||||
default: '/images/default-favicon.ico'
|
default: '/images/default-favicon.ico'
|
||||||
|
|
|
@ -3,11 +3,17 @@ require 'rails_helper'
|
||||||
RSpec.describe MetadataController do
|
RSpec.describe MetadataController do
|
||||||
describe 'manifest.json' do
|
describe 'manifest.json' do
|
||||||
it 'returns the right output' do
|
it 'returns the right output' do
|
||||||
|
|
||||||
title = 'MyApp'
|
title = 'MyApp'
|
||||||
SiteSetting.title = title
|
SiteSetting.title = title
|
||||||
|
SiteSetting.large_icon_url = "http://big.square/png"
|
||||||
|
|
||||||
get :manifest
|
get :manifest
|
||||||
expect(response.body).to include(title)
|
|
||||||
expect(response.content_type).to eq('application/json')
|
expect(response.content_type).to eq('application/json')
|
||||||
|
manifest = JSON.parse(response.body)
|
||||||
|
|
||||||
|
expect(manifest["name"]).to eq(title)
|
||||||
|
expect(manifest["icons"].first["src"]).to eq("http://big.square/png")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue