浏览代码

fix CSP / X-Frame-Options for media embeds (#9558)

master
jomo 5 年前
committed by Eugen Rochko
父节点
当前提交
2c1a6f746f
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      app/controllers/media_controller.rb

+ 5
- 0
app/controllers/media_controller.rb 查看文件

@@ -6,12 +6,17 @@ class MediaController < ApplicationController
before_action :set_media_attachment
before_action :verify_permitted_status!

content_security_policy only: :player do |p|
p.frame_ancestors(false)
end

def show
redirect_to @media_attachment.file.url(:original)
end

def player
@body_classes = 'player'
response.headers['X-Frame-Options'] = 'ALLOWALL'
raise ActiveRecord::RecordNotFound unless @media_attachment.video? || @media_attachment.gifv?
end



正在加载...
取消
保存