Merge pull request #20 from nostrband/develop

Add referrer parsing to connect modal
This commit is contained in:
Nostr.Band 2024-02-08 20:38:05 +03:00 committed by GitHub
commit 0bf6fafb3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,7 +33,15 @@ export const ModalConfirmConnect = () => {
const triggerApp = apps.find((app) => app.appNpub === appNpub)
const { name, url = '', icon = '' } = triggerApp || {}
const appUrl = url || searchParams.get('appUrl') || ''
let appUrl = url || searchParams.get('appUrl') || ''
if (!appUrl && window.document.referrer) {
try {
const u = new URL(window.document.referrer)
appUrl = u.origin
} catch {}
}
const appDomain = getDomain(appUrl)
const appName = name || appDomain || getShortenNpub(appNpub)
const appAvatarTitle = getAppIconTitle(name || appDomain, appNpub)