Universal Clipboard API service on Cloudflare Workers.
- Create own clipboard API service
- Simple GET/POST API
- Delete data automatically. Default: 60 seconds
This button introduce Fork this repo and set GitHub Actions to deploy to Cloudflare Workers.
On Web:
- Create Worker KV namespace from
https://dash.cloudflare.com/{yourid}/workers/kv/namespaces
- Bind Created KV to
UNI_CLIPBOARD
fromhttps://dash.cloudflare.com/{yourid}/workers/services/view/uni-clipboard/production/settings/bindings
On Local:
npx wrangler kv:namespace create "UNI_CLIPBOARD"
On Web:
- Input your access token to
UNI_TOKEN
fromhttps://dash.cloudflare.com/{yourid}/workers/services/view/uni-clipboard/production/settings/bindings
On Local:
$ npx wrangler secret put UNI_TOKEN
XXX
Get clipboard
await fetch('https://uni-clipboard.{your}.workers.dev/?token=XXX')
Update clipboard
await fetch("https://uni-clipboard.{your}.workers.dev/?token=XXX", { method: "post", body: "New Content"})
Redirect to clipboard
https://uni-clipboard.{your}.workers.dev/?token=XXX&redirect=1
You can use Shortcuts and Alfred as client.
For example, Alfred allow you to use ShellScript.
Push your clipboard to uni-clipboard.
c=$(pbpaste | /usr/local/bin/jq -aRs .)
curl -X POST -H "Content-Type: application/json" -d "{\"value\":${c}}" \
"https://uni-clipboard.{you}.workers.dev/?token={token}"
Read clipboard text from uni-clipboard
curl "https://uni-clipboard.{you}.workers.dev/?token={token}" | pbocpy
wranger dev
wranger publish
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT