mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(electron): app couldn't copy share links to clipboard
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user