fix(electron): app couldn't copy share links to clipboard

This commit is contained in:
Tom (plebeius.eth)
2025-06-03 22:11:17 +02:00
parent 9fbfcb3630
commit 104c9c0eba
3 changed files with 31 additions and 10 deletions
+5 -8
View File
@@ -1,3 +1,5 @@
import { copyToClipboard } from './clipboard-utils';
export const getHostname = (url: string) => {
try {
return new URL(url).hostname.replace(/^www\./, '');
@@ -15,12 +17,7 @@ export const isValidURL = (url: string) => {
}
};
export const copyShareLinkToClipboard = (subplebbitAddress: string, cid: string) => {
const shareLink = `https://pleb.bz/p/${subplebbitAddress}/c/${cid}?redirect=plebchan.eth.limo`;
if (navigator.clipboard) {
navigator.clipboard.writeText(shareLink);
} else {
alert('Your browser does not support clipboard API');
}
export const copyShareLinkToClipboard = async (subplebbitAddress: string, cid: string) => {
const shareLink = `https://pleb.bz/p/${subplebbitAddress}/c/${cid}?redirect=plebchan.app`;
await copyToClipboard(shareLink);
};