discourse/lib/onebox/engine/motoko_onebox.rb
Ryan Vandersmith 44a104dff8
FIX: Update "Embed Motoko" Onebox URLs (#22198)
Embed Motoko service's primary URL is transiting from embed.smartcontracts.org to embed.motoko.org, this PR updates the Onebox logic to work for either domain.
2023-07-26 09:41:01 +08:00

29 lines
606 B
Ruby

# frozen_string_literal: true
module Onebox
module Engine
class MotokoOnebox
include Engine
include StandardEmbed
matches_regexp(%r{^https?://embed\.(motoko|smartcontracts)\.org/?.*})
requires_iframe_origins("https://embed.motoko.org", "https://embed.smartcontracts.org")
always_https
def to_html
get_oembed.html
end
def placeholder_html
::Onebox::Helpers.generic_placeholder_html
end
protected
def get_oembed_url
"https://embed.smartcontracts.org/services/onebox?url=#{url}"
end
end
end
end