fix: logo optimization, deprecated meta tag, and clipboard copy fallback (#306)
- Replace 2 MB favicon.svg (base64-PNG-in-SVG) with optimized 43 KB app-logo.png (256x256) - Update AppHeader and AboutModal references to use new logo - Remove SVG favicon link from index.html (PNG/ICO favicons remain) - Fix deprecated apple-mobile-web-app-capable → mobile-web-app-capable meta tag - Add clipboard copy fallback for non-secure contexts (LAN IP over HTTP) Closes #303
This commit is contained in:
@@ -106,10 +106,40 @@ export function useShare(): UseShareReturn {
|
||||
|
||||
const copyShareLink = useCallback(() => {
|
||||
if (shareLink) {
|
||||
navigator.clipboard.writeText(shareLink);
|
||||
setShareCopied(true);
|
||||
log.debug("[ShareDialog] Share link copied to clipboard");
|
||||
setTimeout(() => setShareCopied(false), 2000);
|
||||
if (navigator.clipboard?.writeText) {
|
||||
navigator.clipboard.writeText(shareLink).then(
|
||||
() => {
|
||||
setShareCopied(true);
|
||||
log.debug("[ShareDialog] Share link copied to clipboard");
|
||||
setTimeout(() => setShareCopied(false), 2000);
|
||||
},
|
||||
() => {
|
||||
// Clipboard API blocked (non-secure context / permissions)
|
||||
fallbackCopyToClipboard(shareLink);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
fallbackCopyToClipboard(shareLink);
|
||||
}
|
||||
}
|
||||
|
||||
function fallbackCopyToClipboard(text: string) {
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.value = text;
|
||||
textarea.style.position = "fixed";
|
||||
textarea.style.opacity = "0";
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
setShareCopied(true);
|
||||
log.debug("[ShareDialog] Share link copied via fallback");
|
||||
setTimeout(() => setShareCopied(false), 2000);
|
||||
} catch {
|
||||
log.warn("[ShareDialog] Clipboard copy failed — not in secure context");
|
||||
} finally {
|
||||
document.body.removeChild(textarea);
|
||||
}
|
||||
}
|
||||
}, [shareLink]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user