katelya77/K-Vault
About
A Cloudflare-based serverless cloud-drive aggregator. Telegram is at its core, with direct uploads via webhook and support for files up to 2 GB. It is also fully compatible with storage backends such as R2, S3, Discord, and HuggingFace. Build an all-purpose private data vault at zero cost.
Other ProjectsMeasured star growth
- in 24h
- +2
- in 7 days
- +4
- in 15 days
- +5
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README-EN.md
Original
K-Vault
Free image/file hosting solution with dual deployment modes (Cloudflare Pages + Docker), supporting multiple storage backends.
English | 中文
Screenshots
Features
- Unlimited Storage - Upload unlimited images and files
- Completely Free - Hosted on Cloudflare, zero cost within the free quota
- Free Domain - Uses
*.pages.devsubdomain, and also supports custom domains - Multiple Storage Backends - Supports Telegram, Cloudflare R2, S3-compatible storage, Discord, HuggingFace, WebDAV, and GitHub
- Telegram Webhook Backlink - Bot can automatically reply with direct links after receiving files in channels/groups
- KV Write Optimization - Telegram can use signed direct links to significantly reduce KV read/write usage
- Content Moderation - Optional image moderation API to automatically block inappropriate content
- Multi-format Support - Images, videos, audio, documents, archives, and more
- Online Preview - Supports preview for images, videos, audio, and documents (pdf, docx, txt)
- Chunked Upload - Supports files up to 100MB (with R2/S3)
- Guest Upload - Optional guest upload with file size and daily upload limits
- Multiple Views - Grid, list, and waterfall management views
- Storage Classification - Clearly distinguishes files from different storage backends
- Dual Deployment Modes - Keep Cloudflare Pages deployment, and add Docker self-host deployment (
docker compose up -d) - Dynamic Storage Config Management - Add/Edit/Delete/Test storage configs and switch default storage via admin API
- Pluggable Settings Store (Docker) - Basic app settings can use
sqlite(default) or Redis protocol backends (Upstash / Redis / KVrocks) - Simplified Frontend - Root pages remain the primary UX for upload/admin deployment.
- GitHub Actions Docker Build - Auto-build/push the single
ghcr.io/katelya77/k-vaultimage on main/tag push
2026-03 Product Update
- Admin and folder console are now on root page (
/admin.html) with:- folder tree + breadcrumbs
- file/folder operations (create, rename, move, delete, batch actions)
- drag upload queue (progress, retry, cancel)
- direct link + signed share link copy
- Storage capability cards now keep all adapters visible (configured or not) with explicit status/hints.
- Existing direct links (
/file/:id) remain compatible.
Cloudflare Pages (No Build Step)
A lightweight workflow note is included in .github/workflows/pages-deploy.yml.
- No Cloudflare API secrets are required in this repository by default.
- Recommended deployment path is Cloudflare Pages Git integration (connect your fork directly in Cloudflare Dashboard).
- Leave Build command and Build output directory empty. K-Vault serves the root static pages plus
functions/;frontend/distis not part of the current Pages deployment. - If you want CLI deployment, run Wrangler locally with your own credentials.
Recommended architecture for multi-cloud mounts:
- Use
WebDAVadapter in K-Vault as a mounted entry. - Use
alist/openlistas aggregation layer for other providers. - This keeps K-Vault focused on UX/link/auth while reducing adapter maintenance complexity.
Deployment
K-Vault has two official deployment modes:
- Cloudflare Pages: static root pages plus Pages Functions. This is best for Cloudflare KV/R2, edge functions, and free-tier deployments.
- Docker: one image,
ghcr.io/katelya77/k-vault:latest, for VPS/NAS/private self-hosting and long-running multi-storage deployments.
Both modes expose the same main entrypoints:
- Upload UI:
/ - Admin console:
/admin.html - WebDAV page:
/webdav.html - Admin/API routes:
/api/* - Browser upload:
POST /upload - API Token upload:
/api/v1/upload - Direct/share links:
/file/*,/share/*,/s/*
The Docker image runs Nginx and the Node API inside one container. From the user's perspective, the UI, admin console, WebDAV page, API Token upload, direct links, short links, and storage profile management should match the Cloudflare Pages deployment.
Option 1: Cloudflare Pages
Use this when you want Cloudflare-hosted static pages, Pages Functions, KV, and R2.
Fork this repository
Create a Pages project
- Log in to Cloudflare Dashboard
- Go to
Workers and Pages->Create Application->Pages->Connect to Git - Select the forked repository
- Use these build settings:
| Item | Value |
|---|---|
| Framework preset | None |
| Root directory | Empty (repository root) |
| Install command | Empty |
| Build command | Empty |
| Build output directory | Empty |
| Deploy command | Empty |
Bind KV
- Open Cloudflare Dashboard ->
Workers and Pages->KV - Create a namespace, for example
k-vault - Open the Pages project ->
Settings->Functions->KV namespace bindings - The binding variable name must be
img_url
- Open Cloudflare Dashboard ->
Configure at least one storage backend
- Go to project
Settings->Environment variables - Telegram example:
- Go to project
| Variable | Description | Required |
|---|---|---|
TG_Bot_Token |
Telegram Bot Token | Yes |
TG_Chat_ID |
Telegram channel ID | Yes |
BASIC_USER |
Admin username | Optional |
BASIC_PASS |
Admin password | Optional |
You can also use R2, S3-compatible storage, Discord, HuggingFace, WebDAV, or GitHub. See the Storage Configuration section below for backend-specific variables.
- Redeploy
- Environment variable or binding changes require a new deployment.
- Visit
/api/statusand confirm the expected storage and KV/R2 status.
Common Pages mistakes:
- Do not set Deploy command to
npx wrangler deploy; that is a Workers command, not a Pages command. - Do not set Build command to
npm run build. - Do not set Build output directory to
distorfrontend/dist. - If R2 binding deployment fails with
invalid jurisdiction, follow Cloudflare Pages R2 binding troubleshooting.
Option 2: Docker
Use this for VPS, NAS, private network, or self-hosted multi-storage deployments. Docker does not depend on the Cloudflare Pages runtime.
Simplest Docker Run
No repository checkout and no local Node/npm installation are required:
docker volume create kvault_data
docker run -d \
--name kvault \
--restart unless-stopped \
-p 8080:8080 \
-v kvault_data:/app/data \
ghcr.io/katelya77/k-vault:latest
Open:
- Upload UI:
http://<host>:8080/ - Admin:
http://<host>:8080/admin.html - WebDAV page:
http://<host>:8080/webdav.html - Health check:
http://<host>:8080/api/health
On first start, if CONFIG_ENCRYPTION_KEY and SESSION_SECRET are not provided, the container generates persistent values in /app/data/runtime.env. Recreating the container keeps them as long as the Docker volume is kept.
Production warning: The credential-free command above is for isolated local testing only. Do not expose port 8080 to the Internet without admin authentication, upload limits, and network protection. Generate a unique admin password first:
export BASIC_PASS="$(openssl rand -base64 32)"
docker run -d \
--name kvault \
--restart unless-stopped \
-p 8080:8080 \
-v kvault_data:/app/data \
-e BASIC_USER=admin \
-e BASIC_PASS \
ghcr.io/katelya77/k-vault:latest
Recommended Docker Compose
If you cloned the repository:
docker compose up -d
The Compose file pulls ghcr.io/katelya77/k-vault:latest by default. .env is optional. Create it only when you want fixed credentials, domain, upload limits, or environment-bootstrapped storage:
cp .env.example .env
# Set a strong unique BASIC_PASS in .env before exposing the service.
docker compose up -d
Common Docker variables:
| Variable | Description |
|---|---|
BASIC_USER / BASIC_PASS |
Admin login credentials, recommended for public deployments |
PUBLIC_BASE_URL |
Public URL used for generated links and webhooks |
DEFAULT_STORAGE_TYPE |
Default storage: telegram / r2 / s3 / discord / huggingface / webdav / github |
TG_BOT_TOKEN + TG_CHAT_ID |
Telegram bootstrap storage variables for Docker |
R2_* / S3_* / WEBDAV_* / GITHUB_* / HF_* |
Other storage backend configuration |
UPLOAD_MAX_SIZE / CHUNK_SIZE |
Upload limits and chunk size |
WEB_PORT |
Public Compose port, default 8080 |
You can also start Docker first and add/test/switch storage profiles later in the admin console. The WebDAV page, API Tokens, API v1 uploads, direct links, and short links all use the same 8080 entrypoint.
For full Docker guide, see README-DOCKER.md. Read the public deployment security guide before exposing your instance.
For local Pages development, npm start creates gitignored .dev.vars with unique administrator credentials. Do not commit it or reuse local credentials in production.
WebDAV Regression Validation (Works for Pages and Docker)
After deployment, run at least one WebDAV smoke check to verify the full flow: config test -> upload -> download -> delete.
Example:
BASE_URL=https://your-domain \
BASIC_USER=admin BASIC_PASS="$BASIC_PASS" \
SMOKE_STORAGE_TYPE=webdav \
SMOKE_STORAGE_CONFIG_JSON='{"baseUrl":"https://dav.example.com","username":"u","password":"p","rootPath":"uploads"}' \
node scripts/storage-regression.js
Validation criteria:
webdav.connectedin/api/statusmust betrue- Docker/self-hosted deployments can additionally verify
/api/storage/:id/testreturnsconnected=true - WebDAV
upload / download / deletein the regression script must all pass
For Docker deployment, simply change BASE_URL to your self-hosted address, for example http://localhost:8080.
Storage Configuration
Telegram Enhanced Mode (Self-hosted Bot API + Webhook)
This project supports switching the Telegram API base URL to a self-hosted Bot API and replying with direct links automatically via Webhook when files are received in groups/channels.
Key environment variables:
| Variable | Description | Example |
|---|---|---|
CUSTOM_BOT_API_URL |
Self-hosted Bot API URL reachable by K-Vault (uses the official API if unset) | https://bot-api.example.com |
PUBLIC_BASE_URL |
Public base URL for webhook replies and optional sharing links in the uploader and gallery. A reverse-proxy path prefix is supported | https://img.example.com |
TG_WEBHOOK_SECRET |
Webhook secret, verified by header X-Telegram-Bot-Api-Secret-Token |
your-secret |
TELEGRAM_LINK_MODE |
Telegram link mode; set signed to enable signed direct links |
signed |
MINIMIZE_KV_WRITES |
Set true to enable low-KV-write mode (also enables signed direct links) |
true |
TELEGRAM_METADATA_MODE |
Telegram metadata write mode: off disables admin index writes; lightweight index is default |
off |
TG_UPLOAD_NOTIFY |
Whether to send extra "direct link + File ID" notification after web upload succeeds | true |
FILE_URL_SECRET |
Signed direct-link secret (falls back to TG_Bot_Token if unset) |
random-long-secret |
Webhook deployment steps:
- Add the bot to the target channel/group on Telegram and grant permission to post (admin recommended for channels).
- Set
TG_Bot_Token,PUBLIC_BASE_URL, andTG_WEBHOOK_SECRETin Cloudflare Pages, then redeploy. - Call
setWebhookand point to this project endpoint:https://your-domain/api/telegram/webhook. - Send images/files in the channel/group, and the bot will auto-reply with
/file/...direct links.
setWebhook example (official API):
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://img.example.com/api/telegram/webhook\",\"secret_token\":\"<YOUR_SECRET>\",\"allowed_updates\":[\"message\",\"channel_post\"]}"
setWebhook example (run on the self-hosted Bot API machine):
curl -X POST "http://127.0.0.1:8081/bot<YOUR_BOT_TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://img.example.com/api/telegram/webhook\",\"secret_token\":\"<YOUR_SECRET>\",\"allowed_updates\":[\"message\",\"channel_post\"]}"
Verify and troubleshoot the webhook
- Open
https://img.example.com/api/telegram/webhook. A GET response withok: trueconfirms the K-Vault route is reachable. Verify POST delivery separately. - Call
getWebhookInfoon the same Bot API used for registration. Check the fullurl, thepending_update_count, and the latestlast_error_message. If the URL points to an old domain, callsetWebhookagain with the current endpoint and matchingsecret_token. Telegram Bot API - Send a fresh file and check the POST status in Pages Functions. A 401 indicates a mismatch between
secret_tokenandTG_WEBHOOK_SECRET(orTELEGRAM_WEBHOOK_SECRET). Subscribe tochannel_postfor channels andmessagefor groups. - If the POST returns
directLinkwithout a chat reply, inspectreply.okandreply.reason. A reason ofdisabledmeansTG_UPLOAD_NOTIFYorTELEGRAM_UPLOAD_NOTIFYis off. If Telegram rejects the reply, check the bot's posting permissions. If group updates never arrive, check the bot's privacy mode.
Use a Bot API URL that Cloudflare Pages can reach. The 127.0.0.1 example above is for registration from the Bot API machine.
About 2GB files:
With a self-hosted Bot API (CUSTOM_BOT_API_URL), when files are sent directly from a Telegram client to a group/channel and returned via Webhook links, you can use the Bot API large-file capability (commonly up to 2GB).
But the web upload path is still constrained by current frontend strategy and Cloudflare request size limits (see "Usage Limits" below), so it is not equivalent to direct 2GB upload from the web UI.Note: Downloading files through a self-hosted Bot API first caches files on local disk. Reserve enough space and monitor I/O.
Telegram Low-KV-Write Mode (Optional)
If you are concerned about Cloudflare KV daily quota usage, you can enable:
TELEGRAM_LINK_MODE=signed(signed direct links for Telegram files only)- Or
MINIMIZE_KV_WRITES=true(also affects chunked upload task write strategy)
After enabling this, Telegram files still write a lightweight KV index by default (for admin list and management operations). Downloads resolve file_id through signed parameters, reducing KV read/write pressure. With TELEGRAM_METADATA_MODE=off, signed Telegram uploads skip the post-upload KV metadata lookup: password, expires_in, max_downloads, and slug are ignored, and the response has no delete link. With MINIMIZE_KV_WRITES=true, API Token validation still reads KV, but writes lastUsedAt only on first use and then at least one hour apart.
Optional tradeoff: If you want Telegram files to skip KV writes entirely, also set
TELEGRAM_METADATA_MODE=off. In this mode, files will not appear in the admin list, and tag/allowlist/denylist/delete flows that rely on KV metadata will be unavailable.
KV Storage (Required for Image Management)
To enable image management, configure KV:
- Go to Cloudflare Dashboard ->
Workers and Pages->KV - Click
Create namespace, name itk-vault - Go to your Pages project ->
Settings->Functions->KV namespace bindings - Add binding: variable name
img_url, choose the namespace you created - Redeploy the project
R2 Storage (Large File Support, Optional)
Bind a native R2 bucket to Cloudflare Pages:
Create a bucket
- Cloudflare Dashboard ->
R2 Object Storage->Create bucket - Name it
k-vault-files
- Cloudflare Dashboard ->
Bind to the project
- Pages project ->
Settings->Functions->R2 bucket bindings - Variable name
R2_BUCKET, choose your bucket
- Pages project ->
Enable R2
Settings->Environment variables-> addUSE_R2=true- Redeploy
With the img_url binding and BASIC_USER / BASIC_PASS configured, sign in as an administrator and choose R2 in the uploader. Local files over 100 MiB use native R2 multipart uploads. K-Vault allows up to 20 GiB per file and sends parts of at most 16 MiB.
- Retry a paused or interrupted upload from the queue. After reloading the page, select the original file and destination folder in the same browser to resume. If browser storage is unavailable, the checkpoint lives only in the current page. Changing the admin credentials invalidates existing sessions.
- Choose “Discard checkpoint” on a paused or failed item to abort its incomplete R2 upload. Keep the R2 bucket's default rule to reclaim abandoned parts seven days after initiation. A custom lifecycle rule can shorten the resume window. R2 object lifecycles
- If R2 completes the object while the KV index is temporarily unavailable, retry to repair the index and get the same link. URL imports, guest uploads, API Token uploads, and Docker use their respective size limits.
If redeploy fails with
binding R2_BUCKET of type r2_bucket contains an invalid jurisdiction, Cloudflare Pages is rejecting the R2 binding metadata before K-Vault code runs. Normal R2 buckets should not setjurisdiction; only residency-restricted buckets useeuorfedramp. Follow Cloudflare Pages R2 binding troubleshooting to rebuild Production/Preview bindings, or runnpm run pages:r2:doctor -- --checkto validatewrangler.jsonc.
S3-Compatible Storage (Optional)
Supports any S3-compatible object storage service, including AWS S3, MinIO, BackBlaze B2, Alibaba Cloud OSS, etc.
Environment variables:
| Variable | Description | Example |
|---|---|---|
S3_ENDPOINT |
S3 service endpoint URL | https://s3.us-east-1.amazonaws.com |
S3_REGION |
Region | us-east-1 |
S3_ACCESS_KEY_ID |
Access Key ID | AKIA... |
S3_SECRET_ACCESS_KEY |
Secret Access Key | wJalr... |
S3_BUCKET |
Bucket name | my-filebed |
Endpoint examples by provider:
| Provider | Endpoint format | Region |
|---|---|---|
| AWS S3 | https://s3.{region}.amazonaws.com |
us-east-1 etc. |
| MinIO | https://minio.example.com:9000 |
us-east-1 |
| BackBlaze B2 | https://s3.{region}.backblazeb2.com |
us-west-004 etc. |
| Alibaba Cloud OSS | https://oss-{region}.aliyuncs.com |
cn-hangzhou etc. |
| Cloudflare R2 | https://{account_id}.r2.cloudflarestorage.com |
auto |
Deployment steps:
- Create a bucket in your S3 provider
- Get Access Key ID and Secret Access Key
- Add the environment variables above in your Cloudflare Pages project
- Redeploy, and the frontend will automatically show S3 storage options
Discord Storage (Optional)
Store files through a Discord channel, supporting both Webhook and Bot modes.
Note: Discord attachment URLs expire after about 24 hours. This project provides downloads through a proxy and refreshes URLs automatically per request. The current version prioritizes Bot message lookup and falls back to Webhook lookup on failure. If both Bot and Webhook are configured, ensure the Bot has read access to the Webhook channel.
Environment variables:
| Variable | Description | Required |
|---|---|---|
DISCORD_WEBHOOK_URL |
Discord Webhook URL (recommended for uploads) | One of two |
DISCORD_BOT_TOKEN |
Discord Bot Token (for fetching and deleting files) | Recommended |
DISCORD_CHANNEL_ID |
Discord channel ID (required for Bot-mode upload) | Bot mode |
Webhook deployment (recommended):
- In your Discord server, go to channel settings -> Integrations -> Webhooks
- Create a new Webhook and copy the Webhook URL
- Add environment variable
DISCORD_WEBHOOK_URLin Cloudflare Pages - (Recommended) Also create a Discord Bot and set
DISCORD_BOT_TOKENfor file retrieval and deletion - Redeploy
Bot deployment:
- Go to Discord Developer Portal and create an application
- Create a Bot in the Bot tab and get the token
- In OAuth2 -> URL Generator, select
botscope and grantAdministratorpermission to the Bot - Use the generated URL to invite the Bot to your server
- Add
DISCORD_BOT_TOKENandDISCORD_CHANNEL_IDin Cloudflare Pages - Redeploy
Troubleshooting (File not found on Discord):
- Ensure the channel pointed to by
DISCORD_WEBHOOK_URLis also accessible by the Bot (channel mismatch can cause upload success but direct link failure). - Grant the Bot
Administratorpermission directly to avoid read failures from missing channel permissions. - You must redeploy Cloudflare Pages after changing environment variables (saving variables alone does not apply immediately).
- Open
/api/statusand check whether Discord status isbot,webhook, orbot+webhook.
Limits:
- Non-Boosted server: 25MB/file
- Level 2 Boost: 50MB/file
- Level 3 Boost: 100MB/file
HuggingFace Storage (Optional)
Use HuggingFace Datasets API to store files. Files are saved to a Dataset repository as git commits.
Environment variables:
| Variable | Description | Example |
|---|---|---|
HF_TOKEN |
HuggingFace token with write access | hf_xxxxxxxxxxxx |
HF_REPO |
Dataset repository ID | username/my-filebed |
Deployment steps:
- Register a HuggingFace account
- Create a new Dataset repository (Settings -> New Dataset)
- Go to Settings -> Access Tokens and create a token (requires Write permission)
- Add
HF_TOKENandHF_REPOenvironment variables in Cloudflare Pages - Redeploy
K-Vault automatically selects regular upload or LFS based on the Hugging Face preupload response. The Cloudflare Pages upload endpoints cap each file at 35 MiB before sending it to Hugging Face. Use R2, S3, or WebDAV for larger files.
Guest Upload Feature
Allows non-logged-in users to upload files. Site owners can configure whether it is enabled and apply restriction rules.
| Variable | Description | Default |
|---|---|---|
GUEST_UPLOAD |
Enable guest upload | false |
GUEST_MAX_FILE_SIZE |
Max guest single-file size (bytes) | 5242880 (5MB) |
GUEST_DAILY_LIMIT |
Guest daily upload limit (by IP) | 10 |
How to enable:
- Set
GUEST_UPLOAD=truein environment variables - Adjust
GUEST_MAX_FILE_SIZEandGUEST_DAILY_LIMITas needed - Ensure
BASIC_USERandBASIC_PASSare configured (otherwise guest/admin cannot be distinguished) - Redeploy
Feature behavior:
- Guests can upload directly from the homepage without login
- Guest uploads are limited by single-file size and daily count
- Guests cannot use chunked uploads or advanced storage options (S3/Discord/HuggingFace)
- Guests cannot access the admin panel or gallery page
- Limits are based on guest IP address and reset daily
Advanced Configuration
| Variable | Description | Default |
|---|---|---|
ModerateContentApiKey |
Image moderation API key (from moderatecontent.com) | - |
WhiteList_Mode |
Whitelist mode, only whitelisted images can be loaded | false |
USE_R2 |
Enable R2 storage | false |
CUSTOM_BOT_API_URL |
Telegram API base URL (supports self-hosted Bot API) | https://api.telegram.org |
PUBLIC_BASE_URL |
Public domain used for Webhook backlinks | Current request domain |
TG_WEBHOOK_SECRET |
Telegram Webhook secret (also compatible with TELEGRAM_WEBHOOK_SECRET) |
- |
TELEGRAM_LINK_MODE |
Telegram link mode (signed for signed direct links) |
- |
MINIMIZE_KV_WRITES |
Reduce KV writes (also enables signed direct links) | false |
TELEGRAM_METADATA_MODE |
Telegram metadata write mode (off disables admin index writes) |
on |
TG_UPLOAD_NOTIFY |
Send "direct link + File ID" notification after web upload succeeds | true |
FILE_URL_SECRET |
Signed direct-link secret (also compatible with TG_FILE_URL_SECRET) |
TG_Bot_Token |
CHUNK_BACKEND |
Chunk temporary storage backend (auto/r2/kv) |
auto |
disable_telemetry |
Disable telemetry | - |
Docker Runtime Variables (Self-host Mode)
| Variable | Description | Default |
|---|---|---|
PORT |
API service port inside container | 8787 |
DATA_DIR |
Data directory | /app/data |
DB_PATH |
SQLite database path | /app/data/k-vault.db |
CHUNK_DIR |
Chunk temp directory | /app/data/chunks |
CONFIG_ENCRYPTION_KEY |
Required key for encrypting storage config secrets | - |
SESSION_SECRET |
Session/signing secret (recommended, separate from encryption key) | - |
UPLOAD_MAX_SIZE |
Max upload size in bytes | 104857600 |
UPLOAD_SMALL_FILE_THRESHOLD |
Threshold for direct upload vs chunk strategy | 20971520 |
CHUNK_SIZE |
Chunk upload size in bytes | 5242880 |
DEFAULT_STORAGE_TYPE |
Bootstrap default storage type (telegram/r2/s3/discord/huggingface) |
telegram |
SETTINGS_STORE |
Basic app settings backend (sqlite or redis) |
sqlite |
SETTINGS_REDIS_URL |
Redis URL for Upstash/Redis/KVrocks (required when SETTINGS_STORE=redis) |
- |
SETTINGS_REDIS_PREFIX |
Redis key prefix for settings hash | k-vault |
SETTINGS_REDIS_CONNECT_TIMEOUT_MS |
Redis connect/ping timeout in milliseconds | 5000 |
WEB_PORT |
Public web port for docker compose |
8080 |
Pages
| Page | Path | Description |
|---|---|---|
| Home/Upload | / |
Batch upload, drag-and-drop, paste upload |
| WebDAV Page | /webdav.html |
Dedicated WebDAV upload page with root-style UI |
| Gallery | /gallery.html |
Image grid browsing |
| Admin Panel | /admin.html |
File management, blacklist/whitelist |
| File Preview | /preview.html |
Multi-format file preview |
| Login Page | /login.html |
Admin login |
Usage Limits
Cloudflare free quota:
- 100,000 requests/day
- KV: 1,000 writes/day, 100,000 reads/day, 1,000 list operations/day
- Upgrade to a paid plan if exceeded (starting from $5/month)
- For Telegram-heavy scenarios, signed direct links or low-KV-write mode are recommended to reduce quota pressure
- In Docker self-host mode, these Cloudflare quotas do not apply to the Node runtime itself (limits depend on your server/storage backend)
File size limits by storage backend:
| Storage backend | Max single-file size |
|---|---|
| Telegram (web direct upload) | Small-file direct upload 20MB; current chunked flow limit 100MB |
| Telegram (self-hosted Bot API + Telegram client + Webhook) | Depends on Bot API and deployment environment, commonly up to 2GB |
| Cloudflare Pages R2 | 20 GiB for admin browser uploads (native multipart above 100 MiB) |
| S3-compatible storage | 100MB (chunked upload) |
| Discord (non-Boosted) | 25MB |
| Discord (Level 2+) | 50-100MB |
| HuggingFace (Cloudflare Pages) | 35 MiB |
On Cloudflare Pages,
/api/upload-from-urlsends files up to 20 MiB to Telegram in Telegram mode. WithR2_BUCKETbound, larger files automatically go to R2. The endpoint accepts files up to 100 MiB.
Full Environment Variable Reference
| Variable | Description | Required |
|---|---|---|
TG_Bot_Token |
Telegram Bot Token | Required when Telegram is the selected Pages storage |
TG_Chat_ID |
Telegram channel ID | Required when Telegram is the selected Pages storage |
CUSTOM_BOT_API_URL |
Self-hosted Telegram Bot API URL | Optional |
PUBLIC_BASE_URL |
Webhook backlink domain | Optional |
TG_WEBHOOK_SECRET |
Telegram Webhook secret | Optional |
TELEGRAM_WEBHOOK_SECRET |
Same as above (compatible variable name) | Optional |
TELEGRAM_LINK_MODE |
Telegram link mode (signed) |
Optional |
MINIMIZE_KV_WRITES |
Reduce KV writes and enable signed direct links | Optional |
TELEGRAM_METADATA_MODE |
Telegram metadata write mode (off disables admin index writes) |
Optional |
TG_UPLOAD_NOTIFY |
Send "direct link + File ID" notification after web upload succeeds | Optional |
FILE_URL_SECRET |
Signed direct-link secret | Optional |
TG_FILE_URL_SECRET |
Same as above (compatible variable name) | Optional |
BASIC_USER |
Admin username | Optional |
BASIC_PASS |
Admin password | Optional |
USE_R2 |
Enable R2 storage | Optional |
CHUNK_BACKEND |
Chunk temporary storage backend (auto/r2/kv) |
Optional |
S3_ENDPOINT |
S3 endpoint URL | Optional |
S3_REGION |
S3 region | Optional |
S3_ACCESS_KEY_ID |
S3 access key | Optional |
S3_SECRET_ACCESS_KEY |
S3 secret key | Optional |
S3_BUCKET |
S3 bucket name | Optional |
DISCORD_WEBHOOK_URL |
Discord Webhook URL | Optional |
DISCORD_BOT_TOKEN |
Discord Bot Token | Optional |
DISCORD_CHANNEL_ID |
Discord channel ID | Optional |
HF_TOKEN |
HuggingFace token | Optional |
HF_REPO |
HuggingFace repository ID | Optional |
GUEST_UPLOAD |
Enable guest upload | Optional |
GUEST_MAX_FILE_SIZE |
Guest file size limit (bytes) | Optional |
GUEST_DAILY_LIMIT |
Guest daily upload count | Optional |
ModerateContentApiKey |
Image moderation API key | Optional |
WhiteList_Mode |
Whitelist mode | Optional |
disable_telemetry |
Disable telemetry | Optional |
PORT |
Internal API port for the single Docker image, keep 8787 |
Optional |
DATA_DIR |
Data directory in Docker self-host mode | Optional |
DB_PATH |
SQLite database path in Docker self-host mode | Optional |
CHUNK_DIR |
Chunk temp directory in Docker self-host mode | Optional |
CONFIG_ENCRYPTION_KEY |
Docker storage-config encryption key; generated and persisted if omitted | Optional |
SESSION_SECRET |
Docker session/signing secret; generated and persisted if omitted | Optional |
UPLOAD_MAX_SIZE |
Max upload size (bytes) in Docker self-host mode | Optional |
UPLOAD_SMALL_FILE_THRESHOLD |
Direct-upload threshold (bytes) in Docker self-host mode | Optional |
CHUNK_SIZE |
Chunk size (bytes) in Docker self-host mode | Optional |
DEFAULT_STORAGE_TYPE |
Bootstrap default storage type in Docker self-host mode | Optional |
SETTINGS_STORE |
Basic app settings backend in Docker mode (sqlite/redis) |
Optional |
SETTINGS_REDIS_URL |
Redis URL in Docker mode (Upstash/Redis/KVrocks) | Optional |
SETTINGS_REDIS_PREFIX |
Redis key prefix for Docker settings store | Optional |
SETTINGS_REDIS_CONNECT_TIMEOUT_MS |
Redis connect/ping timeout in Docker mode (ms) | Optional |
WEB_PORT |
Exposed web port for docker compose |
Optional |
Related Links
- Cloudflare Pages Documentation
- Docker Deployment Guide
- Docker Image Workflow
- Telegram Bot API
- Telegram Bot API Server (Self-hosted)
- Issue Tracker
Acknowledgements
This project references the following open-source project:
- Telegraph-Image - Original inspiration
License
MIT License
Star History
Explore related projects
Loading…