modify copy/share for external profiles
Some checks failed
pl-hooks CI / Test for a successful build (22.x) (push) Has been cancelled
pl-api CI / Test for pl-api formatting (22.x) (push) Has been cancelled
pl-fe CI / Test and upload artifacts (22.x) (push) Has been cancelled
pl-fe CI / deploy (push) Has been cancelled

This commit is contained in:
2026-01-12 02:05:21 +00:00
parent fdc53cb2cd
commit 55e2c885b2
2 changed files with 13 additions and 6 deletions

View File

@ -676,7 +676,7 @@ const MenuButton: React.FC<IMenuButton> = ({
getOrCreateChatByAccountId(account.id) getOrCreateChatByAccountId(account.id)
.then((chat) => navigate({ to: '/chats/{-$chatId}', params: { chatId: chat.id } })) .then((chat) => navigate({ to: '/chats/{-$chatId}', params: { chatId: chat.id } }))
.catch(() => {}); .catch(() => { });
}; };
const handleMuteClick: React.EventHandler<React.MouseEvent> = (e) => { const handleMuteClick: React.EventHandler<React.MouseEvent> = (e) => {
@ -717,15 +717,18 @@ const MenuButton: React.FC<IMenuButton> = ({
}; };
const handleCopy: React.EventHandler<React.MouseEvent> = (e) => { const handleCopy: React.EventHandler<React.MouseEvent> = (e) => {
const { uri } = status; const localDomain = window.location.hostname !== 'localhost' ? window.location.hostname : 'localhost:7312';
const copyString = `${window.location.protocol}//${localDomain}/@${status.account.acct}/posts/${status.id}`;
copy(uri); copy(copyString);
}; };
const handleShare = () => { const handleShare = () => {
const localDomain = window.location.hostname !== 'localhost' ? window.location.hostname : 'localhost:7312';
const copyString = `${window.location.protocol}//${localDomain}/@${status.account.acct}/posts/${status.id}`;
navigator.share({ navigator.share({
text: status.search_index, text: status.search_index,
url: status.uri, url: copyString,
}).catch((e) => { }).catch((e) => {
if (e.name !== 'AbortError') console.error(e); if (e.name !== 'AbortError') console.error(e);
}); });

View File

@ -335,16 +335,20 @@ const Header: React.FC<IHeader> = ({ account }) => {
}; };
const handleShare = () => { const handleShare = () => {
const localDomain = window.location.hostname !== 'localhost' ? window.location.hostname : 'localhost:7312';
const copyString = `${window.location.protocol}//${localDomain}/@${account.acct}`;
navigator.share({ navigator.share({
text: `@${account.acct}`, text: `@${account.acct}`,
url: account.url, url: copyString,
}).catch((e) => { }).catch((e) => {
if (e.name !== 'AbortError') console.error(e); if (e.name !== 'AbortError') console.error(e);
}); });
}; };
const handleCopy: React.EventHandler<React.MouseEvent> = (e) => { const handleCopy: React.EventHandler<React.MouseEvent> = (e) => {
copy(account.url); const localDomain = window.location.hostname !== 'localhost' ? window.location.hostname : 'localhost:7312';
const copyString = `${window.location.protocol}//${localDomain}/@${account.acct}`;
copy(copyString);
}; };
const makeMenu = () => { const makeMenu = () => {