Add referrer parsing to connect modal

This commit is contained in:
artur 2024-02-08 20:37:21 +03:00
parent 4aa4f7f175
commit 12afbaa76b

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)