Server/Web: Support "copy" action button to copy a value to the clipboard

This commit is contained in:
binwiederhier
2026-02-08 14:20:03 -05:00
parent 65050ef4dc
commit 3f0a7b65ee
10 changed files with 384 additions and 22 deletions

7
web/src/app/actions.js Normal file
View File

@@ -0,0 +1,7 @@
// Action types for ntfy messages
// These correspond to the server action types in server/actions.go
export const ACTION_VIEW = "view";
export const ACTION_BROADCAST = "broadcast";
export const ACTION_HTTP = "http";
export const ACTION_COPY = "copy";

View File

@@ -2,6 +2,7 @@
// and cannot be used in the service worker
import emojisMapped from "./emojisMapped";
import { ACTION_COPY, ACTION_HTTP, ACTION_VIEW } from "./actions";
const toEmojis = (tags) => {
if (!tags) return [];
@@ -81,7 +82,7 @@ export const toNotificationParams = ({ message, defaultTitle, topicRoute, baseUr
topicRoute,
},
actions: message.actions
?.filter(({ action }) => action === "view" || action === "http")
?.filter(({ action }) => action === ACTION_VIEW || action === ACTION_HTTP || action === ACTION_COPY)
.map(({ label }) => ({
action: label,
title: label,