mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38:51 +02:00
fix WebShare API permissions by checking the URL to share
This commit is contained in:
@ -84,14 +84,16 @@ const forwardToHTWKalendar = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const shareData = computed(() => ({
|
||||
title: t("calendarLink.shareTitle"),
|
||||
text: t("calendarLink.shareText") + getLink(),
|
||||
url: "https://" + domain + "/",
|
||||
}));
|
||||
|
||||
const shareLink = () => {
|
||||
if (typeof navigator.share === 'function' && navigator.canShare()) {
|
||||
if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) {
|
||||
navigator
|
||||
.share({
|
||||
title: t("calendarLink.shareTitle"),
|
||||
text: t("calendarLink.shareText") + getLink(),
|
||||
url: "https://" + domain + "/",
|
||||
})
|
||||
.share(shareData.value)
|
||||
.then(() => {
|
||||
toast.add({
|
||||
severity: "info",
|
||||
@ -142,7 +144,7 @@ const actions = computed(() => {
|
||||
}
|
||||
];
|
||||
|
||||
if (typeof navigator.share === 'function' && navigator.canShare()) {
|
||||
if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) {
|
||||
actionList.push({
|
||||
label: t("calendarLink.share"),
|
||||
icon: "pi pi-share-alt",
|
||||
|
@ -59,12 +59,14 @@ function shareLink() {
|
||||
}
|
||||
|
||||
const link = "https://" + window.location.hostname + "/calendar/view?token=" + token.value + datePart;
|
||||
if (typeof navigator.share === "function" && navigator.canShare()) {
|
||||
navigator.share({
|
||||
title: t("calendarLink.shareLinkTitle"),
|
||||
text: t("calendarLink.shareLinkText"),
|
||||
url: link,
|
||||
});
|
||||
const shareData = {
|
||||
title: t("calendarLink.shareLinkTitle"),
|
||||
text: t("calendarLink.shareLinkText"),
|
||||
url: link,
|
||||
};
|
||||
|
||||
if (typeof navigator.share === "function" && navigator.canShare(shareData)) {
|
||||
navigator.share(shareData);
|
||||
} else {
|
||||
navigator.clipboard.writeText(link).then(() => {
|
||||
toast.add({
|
||||
|
Reference in New Issue
Block a user