aboutsummaryrefslogtreecommitdiffstats
path: root/src/asset-url.js
blob: 89ad1ea07cb01cc7785b6fbd77978acaabe18589 (plain) (blame)
1
2
3
4
5
6
7
8
// 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 are from the site root:
// relative ones resolved against a deep page (/feed/…, /nevent1…, /chat)
// and fetched the app's HTML instead (the coinos community's logo broke).
export const SITE = 'https://v3.coinos.io/';
const fromDisk = () => typeof location !== 'undefined' && location.protocol === 'file:';
export const assetUrl = (path) => (fromDisk() ? SITE : '/') + path.replace(/^\//, '');