Optimize the public sending page and navigation logic in presentation mode to ensure consistency in user experience

This commit is contained in:
shuaiplus
2026-05-04 21:35:21 +08:00
parent 70dc9a76a9
commit e0737006c2
6 changed files with 49 additions and 33 deletions
+10 -1
View File
@@ -224,8 +224,17 @@ export default function SendsPage(props: SendsPageProps) {
}
}
function getAccessUrl(send: Send): string {
const rawUrl = send.shareUrl || `/send/${send.accessId}`;
if (/^https?:\/\//i.test(rawUrl)) return rawUrl;
if (rawUrl.startsWith('/#/')) return `${window.location.origin}${rawUrl}`;
if (rawUrl.startsWith('#/')) return `${window.location.origin}/${rawUrl}`;
if (rawUrl.startsWith('/')) return `${window.location.origin}/#${rawUrl}`;
return `${window.location.origin}/#/${rawUrl.replace(/^\/+/, '')}`;
}
function copyAccessUrl(send: Send): void {
const url = send.shareUrl || `${window.location.origin}/#/send/${send.accessId}`;
const url = getAccessUrl(send);
void copyTextToClipboard(url, { successMessage: t('txt_link_copied') });
}