Drop flash video onebox (#12261)
Flash was discontinued by Adobe at the end of 2020. There is no need to continue OneBox support for it
This commit is contained in:
parent
4adce0d844
commit
8fd46c04ea
|
@ -1802,8 +1802,6 @@ en:
|
||||||
|
|
||||||
simultaneous_uploads: "Maximum number of files that can be dragged & dropped in the composer"
|
simultaneous_uploads: "Maximum number of files that can be dragged & dropped in the composer"
|
||||||
|
|
||||||
enable_flash_video_onebox: "Enable embedding of swf and flv (Adobe Flash) links in oneboxes. WARNING: may introduce security risks."
|
|
||||||
|
|
||||||
default_invitee_trust_level: "Default trust level (0-4) for invited users."
|
default_invitee_trust_level: "Default trust level (0-4) for invited users."
|
||||||
default_trust_level: "Default trust level (0-4) for all new users. WARNING! Changing this will put you at serious risk for spam."
|
default_trust_level: "Default trust level (0-4) for all new users. WARNING! Changing this will put you at serious risk for spam."
|
||||||
|
|
||||||
|
|
|
@ -1596,7 +1596,6 @@ security:
|
||||||
hidden: true
|
hidden: true
|
||||||
|
|
||||||
onebox:
|
onebox:
|
||||||
enable_flash_video_onebox: false
|
|
||||||
post_onebox_maxlength:
|
post_onebox_maxlength:
|
||||||
default: 500
|
default: 500
|
||||||
locale_default:
|
locale_default:
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class DropFlashOneboxSiteSetting < ActiveRecord::Migration[6.0]
|
||||||
|
def up
|
||||||
|
execute <<~SQL
|
||||||
|
DELETE FROM site_settings
|
||||||
|
WHERE name = 'enable_flash_video_onebox'
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,19 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Onebox
|
|
||||||
module Engine
|
|
||||||
class FlashVideoOnebox
|
|
||||||
include Engine
|
|
||||||
|
|
||||||
matches_regexp /^https?:\/\/.*\.(swf|flv)$/
|
|
||||||
|
|
||||||
def to_html
|
|
||||||
if SiteSetting.enable_flash_video_onebox
|
|
||||||
"<object width='100%' height='100%'><param name='#{@url}' value='#{@url}'><embed src='#{@url}' width='100%' height='100%'></embed></object>"
|
|
||||||
else
|
|
||||||
"<a href='#{@url}'>#{@url}</a>"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,34 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
require 'onebox/engine/flash_video_onebox'
|
|
||||||
|
|
||||||
describe Onebox::Engine::FlashVideoOnebox do
|
|
||||||
before do
|
|
||||||
@o = Onebox::Engine::FlashVideoOnebox.new('http://player.56.com/v_OTMyNTk1MzE.swf')
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when SiteSetting.enable_flash_video_onebox is true" do
|
|
||||||
before do
|
|
||||||
SiteSetting.enable_flash_video_onebox = true
|
|
||||||
end
|
|
||||||
|
|
||||||
it "generates a flash video" do
|
|
||||||
expect(@o.to_html).to match_html(
|
|
||||||
"<object width='100%' height='100%'><param name='http://player.56.com/v_OTMyNTk1MzE.swf' value='http://player.56.com/v_OTMyNTk1MzE.swf'><embed src='http://player.56.com/v_OTMyNTk1MzE.swf' width='100%' height='100%'></embed></object>"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when SiteSetting.enable_flash_video_onebox is false" do
|
|
||||||
before do
|
|
||||||
SiteSetting.enable_flash_video_onebox = false
|
|
||||||
end
|
|
||||||
|
|
||||||
it "generates a link" do
|
|
||||||
expect(@o.to_html).to match_html(
|
|
||||||
"<a href='http://player.56.com/v_OTMyNTk1MzE.swf'>http://player.56.com/v_OTMyNTk1MzE.swf</a>"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue