Skip to content

eli-rich/radar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Radar

A file watcher that automatically uploads new files to S3-compatible storage and copies the public URL to your clipboard. Especially useful with screenshot tools.

Features

  • Monitors a directory for new files
  • Uploads to AWS S3 or Cloudflare R2
  • Copies public URLs to clipboard
  • Supports both X11 and Wayland on Linux
  • Generates unique filenames using Snowflake IDs

Installation

git clone https://github.com/eli-rich/radar
cd radar
pnpm install

Configuration

Copy .env.example to .env and configure:

cp .env.example .env

Required environment variables:

  • ACCOUNT_ID - Your AWS/Cloudflare account ID
  • ACCESS_KEY_ID - Your access key ID
  • SECRET_ACCESS_KEY - Your secret access key
  • WATCH_DIR - Directory to watch for new files (e.g., ~/Pictures/Screenshots)
  • BUCKET - Storage bucket name
  • BASE_URL - Public URL for accessing uploaded files
  • MACHINE_ID - Unique identifier for this machine (prevents Snowflake ID conflicts)

Usage

Build the project:

pnpm build

Run the watcher:

pnpm start

Running as a Service

For production use, run Radar as a system service:

Linux (systemd)

Create /etc/systemd/system/radar.service:

[Unit]
Description=Radar file watcher
After=network.target

[Service]
Type=simple
User=your-username
WorkingDirectory=/path/to/radar
ExecStart=/usr/bin/node dist/index.js
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl enable radar
sudo systemctl start radar

macOS (launchd)

Use a plist file in ~/Library/LaunchAgents/.

Cross-platform

Use pm2:

pm2 start dist/index.js --name radar
pm2 save
pm2 startup

Platform Support

Tested on Linux (X11 and Wayland) and macOS. Windows support is untested.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors