2022-12-16 22:59:40 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Onebox
|
|
|
|
module Engine
|
|
|
|
class MotokoOnebox
|
|
|
|
include Engine
|
|
|
|
include StandardEmbed
|
|
|
|
|
2023-07-26 09:41:01 +08:00
|
|
|
matches_regexp(%r{^https?://embed\.(motoko|smartcontracts)\.org/?.*})
|
|
|
|
requires_iframe_origins("https://embed.motoko.org", "https://embed.smartcontracts.org")
|
2022-12-16 22:59:40 +08:00
|
|
|
always_https
|
|
|
|
|
|
|
|
def to_html
|
|
|
|
get_oembed.html
|
|
|
|
end
|
|
|
|
|
|
|
|
def placeholder_html
|
|
|
|
::Onebox::Helpers.generic_placeholder_html
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def get_oembed_url
|
2023-07-26 09:41:01 +08:00
|
|
|
"https://embed.smartcontracts.org/services/onebox?url=#{url}"
|
2022-12-16 22:59:40 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|