diff --git a/library/src/utils/dapp.util.ts b/library/src/utils/dapp.util.ts index d2e65ba..93cba16 100644 --- a/library/src/utils/dapp.util.ts +++ b/library/src/utils/dapp.util.ts @@ -1,10 +1,15 @@ const dappIdRegex = new RegExp('.+/bzz/([^/]+).*') +const subdomainDappIdRegex = new RegExp('https?://(.+).swarm.localhost:.*') export function getDappId(): string | null { const url = window.location.href // extracts dApp ENS name from a bzz link (e.g http://localhost:1633/bzz/ENS/...) - const result = dappIdRegex.exec(url) + let result = dappIdRegex.exec(url) + + if (!result || !result[1]) { + result = subdomainDappIdRegex.exec(url) + } if (!result || !result[1]) { return null