|
|
@@ -4,7 +4,7 @@ import { NavigationRoute, registerRoute } from "workbox-routing";
|
|
|
import { NetworkFirst } from "workbox-strategies";
|
|
|
import { clientsClaim } from "workbox-core";
|
|
|
import { dbAsync } from "../src/app/db";
|
|
|
-import { ACTION_COPY, ACTION_HTTP, ACTION_VIEW } from "../src/app/actions";
|
|
|
+import { ACTION_HTTP, ACTION_VIEW } from "../src/app/actions";
|
|
|
import { badge, icon, messageWithSequenceId, notificationTag, toNotificationParams } from "../src/app/notificationUtils";
|
|
|
import initI18n from "../src/app/i18n";
|
|
|
import {
|
|
|
@@ -256,26 +256,6 @@ const handleClick = async (event) => {
|
|
|
if (action.clear) {
|
|
|
await clearNotification();
|
|
|
}
|
|
|
- } else if (action.action === ACTION_COPY) {
|
|
|
- try {
|
|
|
- // Service worker can't access the clipboard API directly, so we try to
|
|
|
- // open a focused client and use it, or fall back to opening a window
|
|
|
- const allClients = await self.clients.matchAll({ type: "window" });
|
|
|
- const focusedClient = allClients.find((c) => c.focused) || allClients[0];
|
|
|
- if (focusedClient) {
|
|
|
- focusedClient.postMessage({ type: "copy", value: action.value });
|
|
|
- }
|
|
|
- if (action.clear) {
|
|
|
- await clearNotification();
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.error("[ServiceWorker] Error performing copy action", e);
|
|
|
- self.registration.showNotification(`${t("notifications_actions_failed_notification")}: ${action.label} (${action.action})`, {
|
|
|
- body: e.message,
|
|
|
- icon,
|
|
|
- badge,
|
|
|
- });
|
|
|
- }
|
|
|
} else if (action.action === ACTION_HTTP) {
|
|
|
try {
|
|
|
const response = await fetch(action.url, {
|