aboutsummaryrefslogtreecommitdiffstats
path: root/src/asset-url.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/asset-url.js')
-rw-r--r--src/asset-url.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/asset-url.js b/src/asset-url.js
new file mode 100644
index 0000000..bd80240
--- /dev/null
+++ b/src/asset-url.js
@@ -0,0 +1,6 @@
+// The standalone wallet (standalone.html opened from a disk) has no files
+// beside it: punks, the lazy modules and the language packs come from the
+// site instead. Served from anywhere else, paths stay relative.
+export const SITE = 'https://v3.coinos.io/';
+const fromDisk = () => typeof location !== 'undefined' && location.protocol === 'file:';
+export const assetUrl = (path) => fromDisk() ? SITE + path.replace(/^\//, '') : path;