From a90fa33b36ce365eb8be44112065541cfe1c3c1a Mon Sep 17 00:00:00 2001 From: Stephane Bellity Date: Mon, 9 Dec 2019 12:34:25 +0100 Subject: [PATCH 1/2] alternative method to boot with the website connector --- src/ship.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ship.js b/src/ship.js index 2cb5744..de1f14e 100644 --- a/src/ship.js +++ b/src/ship.js @@ -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"); From 32e9c0430523933d2f1ebf84a0c4c50f33b91bf2 Mon Sep 17 00:00:00 2001 From: Stephane Bellity Date: Mon, 9 Dec 2019 12:48:59 +0100 Subject: [PATCH 2/2] update instructions to load with website connector --- views/admin.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/views/admin.html b/views/admin.html index 8f75a9b..a95e76f 100644 --- a/views/admin.html +++ b/views/admin.html @@ -30,8 +30,10 @@

Client-side data connector

-
If you use the Hull.js library
- Simply deploy this connector to the Platform you wish to use it on. +
If you use the Website connector
+ Simply use the following URL to load this connector as a custom script : +
https://<%=host%>/ship.js#<%= <%= id %> %>
+
ELSE