0
0
Fork 0

Allow admins to configure instance favicon and logo (#30040)

This commit is contained in:
Fawaz Farid 2024-05-06 18:06:52 +03:00 committed by GitHub
parent b152f936c1
commit bc24c4792d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 87 additions and 19 deletions

View file

@ -37,6 +37,8 @@ class Form::AdminSettings
status_page_url
captcha_enabled
authorized_fetch
app_icon
favicon
).freeze
INTEGER_KEYS = %i(
@ -63,6 +65,8 @@ class Form::AdminSettings
UPLOAD_KEYS = %i(
thumbnail
mascot
app_icon
favicon
).freeze
OVERRIDEN_SETTINGS = {

View file

@ -19,7 +19,15 @@
class SiteUpload < ApplicationRecord
include Attachmentable
FAVICON_SIZES = [16, 32, 48].freeze
APPLE_ICON_SIZES = [57, 60, 72, 76, 114, 120, 144, 152, 167, 180, 1024].freeze
ANDROID_ICON_SIZES = [36, 48, 72, 96, 144, 192, 256, 384, 512].freeze
APP_ICON_SIZES = (APPLE_ICON_SIZES + ANDROID_ICON_SIZES).uniq.freeze
STYLES = {
app_icon: APP_ICON_SIZES.each_with_object({}) { |size, hash| hash[size.to_s.to_sym] = "#{size}x#{size}#" }.freeze,
favicon: FAVICON_SIZES.each_with_object({}) { |size, hash| hash[size.to_s.to_sym] = "#{size}x#{size}#" }.freeze,
thumbnail: {
'@1x': {
format: 'png',