2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 01:47:48 +00:00

Assetify favicons and set correct url scheme

This commit is contained in:
nanaya 2022-06-11 03:42:56 +09:00
parent 216e28c0d7
commit 7c24699c06
8 changed files with 17 additions and 9 deletions

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -41,7 +41,7 @@ module Post::ImageStore::Local2
def preview_url
if status == "deleted"
ApplicationController.helpers.image_path 'deleted-preview.png', host: base_url(:assets)
ApplicationController.helpers.image_url 'deleted-preview.png'
elsif image?
"#{base_url :assets}/data/preview/#{file_hierarchy}/#{md5}.jpg"
else

View File

@ -54,8 +54,9 @@ module Moebooru
# This one is never reliable because there's no standard controlling this.
config.action_dispatch.ip_spoofing_check = false
config.action_controller.asset_host = CONFIG[:file_hosts][:assets] if CONFIG[:file_hosts]
config.action_mailer.default_url_options = { :host => CONFIG["server_host"] }
scheme = "#{CONFIG['secure'] ? 'https' : 'http'}://"
config.action_controller.asset_host = "#{scheme}#{CONFIG[:file_hosts][:assets]}" if CONFIG[:file_hosts]
config.action_mailer.default_url_options = { :host => "#{scheme}#{CONFIG["server_host"]}" }
config.ssl_options = { hsts: false }

View File

@ -4,13 +4,20 @@ class ExternalPost
class << self
def get_service_icon(service)
filename =
case service
when CONFIG["local_image_service"]
"/favicon.ico"
nil
when "gelbooru.com" # hack
"/favicon-#{service}.png"
"#{service}.png"
else
"/favicon-#{service}.ico"
"#{service}.ico"
end
if filename.present?
ApplicationController.helpers.image_url "favicons/#{filename}"
else
"/favicon.ico"
end
end
end