- Host images with nginx from a single directory
./data
- SFTPd with access to
./data
for managing image files
git clone https://github.com/anxdpanic/image-short-codes
cd docker
# generate encrypted sftp password, and ssh keys
# configure SFTP_USERNAME, USER_UID, and USER_GID in .env
./run-first.sh
docker-compose up --build -d
Requires NodeJS
- Handle incoming http requests for shortcodes
- Manage Cloudflare D1 database with shortcode <-> url references based on the http request (authentication header required)
- Resolve shortcode to it's url (hosted by the nginx docker) and display the image
git clone https://github.com/anxdpanic/image-short-codes
cd cloudflare_worker/image-short
# configure settings in .toml
# [vars]
# CF_WORKER_BASE_URL = "https://img.example.com"
# RAW_IMG_BASE_URL = "https://images.example.com"
# [[d1_databases]]
# database_id = ""
cp wrangler.toml.template wrangler.toml
nano wrangler.toml
# install wrangler
npm install wrangler@latest
# or
yarn add wrangler@latest
# add authentication token as a secret on cloudflare
npx wrangler@latest add secret AUTHENTICATION_TOKEN
# deploy worker
npx wrangler@latest deploy
- Monitor a single folder for changes to image files
- Mirror those changes to the sftp server to be hosted by nginx
- Manage shortcodes through the cloudflare worker via http requests
- Send Discord notification with new shortcodes
git clone https://github.com/anxdpanic/image-short-codes
cd watchdog
# configure settings for watchdog, discord webhook settings are optional
cp config.json.template config.json
nano config.json
# install
pip install .
# confirm working
watchdog-imgshort -f config.json
# run in the background
screen -dmS ImageWatchdog watchdog-imgshort -f config.json