mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:11:16 +08:00
FIX: Make discobot certificate faster/non blocking (#11344)
This moves the way we add the user avatar and site logo to the discobot certificates from embeded base64 png to just using the files urls in the href to the image tag. This will make generation faster and the certificate smaller overall, but it can't be used in a `img` tag anymore, since SVGs in `img` tags don't load the external images In order to work around that we will move the certificate in posts to an iframe, which works fine without any user visible changes. For this to be possible the plugin automatically adds the site current domain to the list of allowed iframe origins.
This commit is contained in:

committed by
GitHub

parent
ca4a962766
commit
bf5611f7eb
@ -137,7 +137,7 @@ module DiscourseNarrativeBot
|
||||
src = Discourse.base_url + DiscourseNarrativeBot::Engine.routes.url_helpers.certificate_path(options)
|
||||
alt = CGI.escapeHTML(I18n.t("#{self.class::I18N_KEY}.certificate.alt"))
|
||||
|
||||
"<img class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{alt}'>"
|
||||
"<iframe class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{alt}'>"
|
||||
end
|
||||
|
||||
protected
|
||||
|
Reference in New Issue
Block a user