Fix embedded player

(broken because I forgot to adapt it to glitch-soc's theming system)
This commit is contained in:
Thibaut Girka 2020-08-11 23:15:32 +02:00 committed by ThibG
parent 0376b6b92b
commit 7c20530fb7
2 changed files with 13 additions and 1 deletions

View file

@ -11,6 +11,7 @@ class MediaController < ApplicationController
before_action :verify_permitted_status! before_action :verify_permitted_status!
before_action :check_playable, only: :player before_action :check_playable, only: :player
before_action :allow_iframing, only: :player before_action :allow_iframing, only: :player
before_action :set_pack, only: :player
content_security_policy only: :player do |p| content_security_policy only: :player do |p|
p.frame_ancestors(false) p.frame_ancestors(false)
@ -43,4 +44,8 @@ class MediaController < ApplicationController
def allow_iframing def allow_iframing
response.headers['X-Frame-Options'] = 'ALLOWALL' response.headers['X-Frame-Options'] = 'ALLOWALL'
end end
def set_pack
use_pack 'public'
end
end end

View file

@ -1,6 +1,13 @@
- content_for :header_tags do - content_for :header_tags do
= render_initial_state = render_initial_state
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' = javascript_pack_tag "locales", integrity: true, crossorigin: 'anonymous'
- if @theme
- if @theme[:supported_locales].include? I18n.locale.to_s
= javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", integrity: true, crossorigin: 'anonymous'
- elsif @theme[:supported_locales].include? 'en'
= javascript_pack_tag "locales/#{@theme[:flavour]}/en", integrity: true, crossorigin: 'anonymous'
= render partial: 'layouts/theme', object: @core
= render partial: 'layouts/theme', object: @theme
- if @media_attachment.video? - if @media_attachment.video?
= react_component :video, src: @media_attachment.file.url(:original), preview: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.file.url(:small), blurhash: @media_attachment.blurhash, width: 670, height: 380, editable: true, detailed: true, inline: true, alt: @media_attachment.description do = react_component :video, src: @media_attachment.file.url(:original), preview: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.file.url(:small), blurhash: @media_attachment.blurhash, width: 670, height: 380, editable: true, detailed: true, inline: true, alt: @media_attachment.description do