Skip to content

Commit 3bcac60

Browse files
author
Avaer Kazmer
committed
More download url debugging
1 parent a8323fd commit 3bcac60

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
default: 0x42a5f5,
3737
highlight: 0x9ccc65,
3838
};
39+
const _rewriteUrlToRaw = u => {
40+
const o = new URL(u);
41+
const match = o.host.match(/^(.+)\.proxy\.exokit\.org$/);
42+
const raw = match[1];
43+
const match2 = raw.match(/^(https?-)(.+?)(-[0-9]+)?$/);
44+
o.protocol = match2[1].replace(/-/g, ':');
45+
o.host = match2[2].replace(/--/g, '=').replace(/-/g, '.').replace(/=/g, '-').replace(/\.\./g, '-') + (match2[3] ? match2[3].replace(/-/g, ':') : '');
46+
return o.href;
47+
};
3948

4049
const LAMBDA_URLS = {
4150
login: `https://login.exokit.org/`,
@@ -6131,8 +6140,7 @@
61316140
const {labelMesh} = intersectionSpec;
61326141
const {xrIframe} = labelMesh;
61336142
let {src, name} = xrIframe;
6134-
src = new URL(src, xrIframe.ownerDocument.baseURI).href;
6135-
console.log('got download', src, name);
6143+
src = _rewriteUrlToRaw(new URL(src, xrIframe.ownerDocument.baseURI).href);
61366144

61376145
fetch(`${LAMBDA_URLS.inventory}add?email=${encodeURIComponent(loginToken.email)}&token=${encodeURIComponent(loginToken.token)}&src=${encodeURIComponent(src)}&name=${encodeURIComponent(name)}`, {
61386146
method: 'POST',
@@ -6144,7 +6152,7 @@
61446152
name,
61456153
});
61466154

6147-
console.log('downloaded to inventory');
6155+
console.log('downloaded to inventory', {src, name});
61486156
});
61496157
}
61506158
} else {

0 commit comments

Comments
 (0)