Skip to content

A platform for community discussion. Free, open, simple.

FIX: Update "Embed Motoko" Onebox URLs (#22198)

Ryan Vandersmith44a104dff824
diff --git a/lib/onebox/engine/motoko_onebox.rb b/lib/onebox/engine/motoko_onebox.rb
index 1656150fbfd..9a0243bf83f 100644
--- a/lib/onebox/engine/motoko_onebox.rb
+++ b/lib/onebox/engine/motoko_onebox.rb
@@ -6,8 +6,8 @@ module Onebox
include Engine
include StandardEmbed
- matches_regexp(%r{^https?://embed\.smartcontracts\.org/?.*})
- requires_iframe_origins "https://embed.smartcontracts.org"
+ matches_regexp(%r{^https?://embed\.(motoko|smartcontracts)\.org/?.*})
+ requires_iframe_origins("https://embed.motoko.org", "https://embed.smartcontracts.org")
always_https
def to_html
@@ -21,7 +21,7 @@ module Onebox
protected
def get_oembed_url
- "https://embed.smartcontracts.org/api/onebox?url=#{url}"
+ "https://embed.smartcontracts.org/services/onebox?url=#{url}"
end
end
end
diff --git a/spec/lib/onebox/engine/motoko_onebox_spec.rb b/spec/lib/onebox/engine/motoko_onebox_spec.rb
index ed58b81348f..1ffa368056a 100644
--- a/spec/lib/onebox/engine/motoko_onebox_spec.rb
+++ b/spec/lib/onebox/engine/motoko_onebox_spec.rb
@@ -3,17 +3,17 @@
RSpec.describe Onebox::Engine::MotokoOnebox do
before do
body =
- '{"version":"1.0","provider_name":"Embed Motoko","provider_url":"https://embed.smartcontracts.org","type":"rich","width":800,"height":500,"html":"<iframe src=\"https://embed.smartcontracts.org\" width=\"800\" height=\"500\" style=\"border:0\" />"}'
+ '{"version":"1.0","provider_name":"Embed Motoko","provider_url":"https://embed.motoko.org","type":"rich","width":800,"height":500,"html":"<iframe src=\"https://embed.motoko.org\" width=\"800\" height=\"500\" style=\"border:0\" />"}'
stub_request(
:get,
- "https://embed.smartcontracts.org/api/onebox?url=https://embed.smartcontracts.org",
+ "https://embed.smartcontracts.org/services/onebox?url=https://embed.motoko.org",
).to_return(status: 200, body: body, headers: {})
end
it "returns the expected iframe markup" do
- expect(Onebox.preview("https://embed.smartcontracts.org").to_s.chomp).to include(
- '<iframe src="https://embed.smartcontracts.org" width="800" height="500" style="border:0"',
+ expect(Onebox.preview("https://embed.motoko.org").to_s.chomp).to include(
+ '<iframe src="https://embed.motoko.org" width="800" height="500" style="border:0"',
)
end
end