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