Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/ship.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ const onEmbed = (rootNode, deployment, hull) => {
let endpoint;
if (hull && deployment) {
const { ship, platform } = deployment;
platformId = platform.id;
shipId = ship.id;
endpoint = `${ship.source_url.replace(/\/$/, "")}`;
if (platform) {
platformId = platform.id;
shipId = ship.id;
endpoint = `${ship.source_url.replace(/\/$/, "")}`;
} else if (ship && ship.index) {
platformId = 'website';
const shipSource = document.createElement('a')
shipSource.href = deployment.ship.index;
if (shipSource.hash.match(/^\#[a-z0-9]{24}$/)) {
shipId = shipSource.hash.substr(1);
endpoint = shipSource.origin;
}
}
} else if (scriptTag) {
shipId = scriptTag.getAttribute("data-hull-id");
endpoint = scriptTag.getAttribute("data-hull-endpoint");
Expand Down
6 changes: 4 additions & 2 deletions views/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
<h3 class="panel-title text-center">Client-side data connector</h3>
</div>
<div class="panel-body">
<h5>If you use the <code>Hull.js</code> library</h5>
Simply deploy this connector to the Platform you wish to use it on.
<h5>If you use the <code>Website connector</code></h5>
Simply use the following URL to load this connector as a custom script :
<pre><code style="word-break: break-all;">https://<%=host%>/ship.js#<%= <%= id %> %></code></pre>

<fieldset class="text-center mt-1 pt-05 mb-1">
<legend class="text-muted"><small>ELSE</small></legend>
</fieldset>
Expand Down