From 3f0a7b65ee4ccee6f8ada998545ae773128fbeb1 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sun, 8 Feb 2026 14:20:03 -0500 Subject: [PATCH] Server/Web: Support "copy" action button to copy a value to the clipboard --- docs/publish.md | 266 ++++++++++++++++++++++++++- docs/releases.md | 2 + server/actions.go | 19 +- server/actions_test.go | 45 ++++- server/types.go | 3 +- web/public/sw.js | 25 ++- web/src/app/actions.js | 7 + web/src/app/notificationUtils.js | 3 +- web/src/components/Notifications.jsx | 27 ++- web/src/registerSW.js | 9 + 10 files changed, 384 insertions(+), 22 deletions(-) create mode 100644 web/src/app/actions.js diff --git a/docs/publish.md b/docs/publish.md index 8b267150..4f68c572 100644 --- a/docs/publish.md +++ b/docs/publish.md @@ -1134,6 +1134,7 @@ As of today, the following actions are supported: * [`broadcast`](#send-android-broadcast): Sends an [Android broadcast](https://developer.android.com/guide/components/broadcasts) intent when the action button is tapped (only supported on Android) * [`http`](#send-http-request): Sends HTTP POST/GET/PUT request when the action button is tapped +* [`copy`](#copy-to-clipboard): Copies a given value to the clipboard when the action button is tapped Here's an example of what a notification with actions can look like: @@ -1164,9 +1165,12 @@ To define actions using the `X-Actions` header (or any of its aliases: `Actions` Multiple actions are separated by a semicolon (`;`), and key/value pairs are separated by commas (`,`). Values may be quoted with double quotes (`"`) or single quotes (`'`) if the value itself contains commas or semicolons. -The `action=` and `label=` prefix are optional in all actions, and the `url=` prefix is optional in the `view` and -`http` action. The only limitation of this format is that depending on your language/library, UTF-8 characters may not -work. If they don't, use the [JSON array format](#using-a-json-array) instead. +Each action type has a short format where some key prefixes can be omitted: + +* [`view`](#open-websiteapp): `view,