Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clipboard-to-url

A self-hosted program that replaces the contents of your clipboard with a shareable URL. If clipboard contains a path to a file, the file is processed.

Features:

  • Basically free
  • Uploads files to your own Google Cloud Storage bucket
  • Generates permalinks (unless you set an expiration time)
  • Converts images to JPG to reduce storage size
  • Videos play right in the browser
  • Markdown files are converted to (GitHub-flavored) HTML so that they're viewable in a web browser, and the raw .md source is uploaded alongside at the same path (swap .html.md) so AI agents can fetch the source
  • Supports all file types
  • Preserves original filenames when uploading files (for "Save As" in browser)
  • JSON is prettified (via compact-json)
  • Integrates with Mac Finder

Quick Start

If you have uv installed and GCP credentials configured, you can run this directly without cloning:

PROJECT_ID=myproject BUCKET_ID=mybucket uv run https://raw.githubusercontent.com/kym6464/clipboard-to-url/main/main.py

Or export the variables in your shell profile for persistent use:

export PROJECT_ID=myproject
export BUCKET_ID=mybucket
export OBJECT_PREFIX=optional/prefix/  # optional
export JPEG_QUALITY=90                 # optional

uv run https://raw.githubusercontent.com/kym6464/clipboard-to-url/main/main.py

One-Time Setup

  1. Install uv
  2. Authenticate with google cloud https://cloud.google.com/docs/authentication/client-libraries
  3. Create a bucket https://cloud.google.com/storage/docs/creating-buckets
  4. Make the bucket public by granting the Storage Object Viewer role to the allUsers principal (see this guide for more details). This allows anyone on the internet to view files that are in this bucket, but only you can upload files to this bucket. When all is said and done, it should look like this.

Mac Finder Integration

To integrate with Quick Actions like in the above demo, use Automator to invoke the script with files — this is what the final product could look like

pbcopy && uv run -s "/Users/kym/repos/clipboard-to-url/main.py"

For more details/troubleshooting, see https://cloudinary.com/blog/upload-image-files-to-cloudinary-using-a-finder-custom-quick-action-on-a-mac

Image Video
finder image finder video
Code Zip
finder yml finder zip

Development

(1) Clone the repo

(2) Copy .env.example to .env and fill out the values

(3) Run uv run --script main.py

About

Replace the contents of your clipboard with a shareable URL

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages