Skip to content

Replace the contents of your clipboard with a shareable URL

License

Notifications You must be signed in to change notification settings

kym6464/clipboard-to-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clipboard-to-url

A self-hosted program that replaces the contents of your clipboard with a shareable URL. Features:

  • Basically free
  • Uploads files to your very own google cloud storage bucket
  • Generates permalinks (unless you set an expiration time)
  • Converts PNG and HEIF to JPG to reduce storage size
  • Videos play right in the browser
  • JSON is prettified and compacted via compact-json
  • Supports all file types
  • Integrates with Mac Finder
  • Less than 200 lines of Python
Image Video
finder image finder video
Code Zip
finder yml finder zip

Usage

(1) Copy an image or path to a file to your clipboard

(2) Run python clipboard_to_url.py

(3) Paste the URL

Setup

(1) Create a bucket https://cloud.google.com/storage/docs/creating-buckets

(2) 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

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

(4) Authenticate with google cloud https://cloud.google.com/docs/authentication/client-libraries

(5) Create a python virtual environment python -m venv env

(6) Install dependencies pip install wheel && pip install -r requirements.txt

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 && /Users/kym/repos/clipboard-to-url/env/bin/python "/Users/kym/repos/clipboard-to-url/clipboard_to_url.py"

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