| 329 | } |
| 330 | |
| 331 | function getSourceParts(payload: PageCapturePayload): { |
| 332 | path: string |
| 333 | title: string |
| 334 | } { |
| 335 | try { |
| 336 | const url = new URL(payload.sourceUrl) |
| 337 | |
| 338 | return { |
| 339 | path: payload.contextLabel ?? (url.pathname || '/'), |
| 340 | title: url.hostname.replace(/^www\./, ''), |
| 341 | } |
| 342 | } |
| 343 | catch { |
| 344 | return { |
| 345 | path: payload.contextLabel ?? payload.sourceUrl, |
| 346 | title: payload.sourceTitle || 'Current page', |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | function updateSourceIcon(faviconUrl?: string): void { |
| 352 | if (!sourceMark) { |