Skip to content

Commit 43404a1

Browse files
committed
Fix HTTPS embedding
1 parent 5b49020 commit 43404a1

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,8 @@
824824
You can use the HTML code below to embed the current 3D model in your website.
825825
</p>
826826
<input id="embed-code" class="input" type="text" autocomplete="off" spellcheck="false" />
827+
<h4>Embed URL</h4>
828+
<input id="embed-url" class="input" type="text" autocomplete="off" spellcheck="false" />
827829
<div class="footer">
828830
<button class="btn close btn-primary">Close</button>
829831
</div>

php/cif.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
parse_str($_SERVER["QUERY_STRING"]);
3131
header("Content-Type: text");
3232

33-
//allow embed.molview.org
34-
if($_SERVER["HTTP_ORIGIN"] == "http://embed.molview.org")
33+
//allow embed.molview.org and molview.org
34+
$origin = $_SERVER["HTTP_ORIGIN"];
35+
if($origin == 'http://molview.org' || $origin == 'https://embed.molview.org')
3536
{
36-
header("Access-Control-Allow-Origin: ".$_SERVER["HTTP_ORIGIN"]);
37+
header("Access-Control-Allow-Origin: ".$origin);
3738
}
3839

3940
//connect to cod

src/js/Link.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ var Link = {
8989

9090
Link.embedHTML = '<iframe style="width: ' + $("#embed-width").val() + '; height: ' + $("#embed-height").val() + ';" frameborder="0" src="' + url + '"></iframe>';
9191
$("#embed-code").val(Link.embedHTML);
92+
$("#embed-url").val(url);
9293
}
9394
};

src/js/Request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ var Request = {
781781
AJAX({
782782
primary: true,
783783
dataType: "text",
784-
url: Request.API_ROOT + "api/cod/cif/" + codid + ".cif",
784+
url: "https://molview.org/api/cod/cif/" + codid + ".cif",
785785
defaultError: error,
786786
success: success
787787
});

0 commit comments

Comments
 (0)