introduce
Based on Cloudflare Worker and Pages, serverless deployment is easily achieved!
Change log
November 1, 2024
- Fixed the problem of being unable to load after uploading
October 19, 2024
- Fix the bug that webp cannot upload.
- Optimize database structure. Existing data needs to be migrated, click to view the tutorial.
September 29, 2024
- Optimize the cache function and use the cache.put() and cache.match() methods provided by Cloudflare for processing.
September 25, 2024
- Fixed the GIF file upload problem, thanks to nodeseek user @Libs for the idea.
- The Telegraph interface has been moved to the telegraph branch, and the main branch is the TG_BOT interface, which can be deployed to pages by directly forking the warehouse.
September 23, 2024
- Fixed the link failure problem and supported video file upload.
September 14, 2024
- Files uploaded through the Telegraph interface are time-sensitive , so it is recommended to use TG_BOT to upload them.
September 13, 2024
- Support uploading to channels through TG_BOT.
September 12, 2024
- It has been fixed and can be uploaded to telegraph normally.
September 6, 2024
From September 6, 2024, telegra.ph has banned the upload of media files, and this project has been terminated.
Function
- Support visitor verification.
- Support paste upload.
- Supports multiple file uploads.
- Support viewing history records.
- Supports image and video file upload.
- Supports batch management of background files.
- Supports modifying the background path, the default is /admin.
- Supports displaying image upload time on the management interface and sorting by upload time.
- By default, only the image links in the database are proxy, and the links cannot be accessed after being deleted in the background.
- Supports URL, BBCode and Markdown formats. Click the corresponding button to automatically copy the link in the corresponding format.
- For users who need to customize the user interface, you can modify the code yourself. I hope you can keep the open source address of the project when making modifications.
Deployment tutorial
Variable description
Required items:
variable name | illustrate |
---|
DOMAIN | Custom domain name for Workers or Pages. |
USERNAME | Username used for authentication. |
PASSWORD | Password used for authentication. |
ADMIN_PATH | The path to the management page, no / is required. Example:admin |
TG_BOT_TOKEN | Telegram bot token via @BotFather. |
TG_CHAT_ID | If you fill in the account ID, the robot will send it to you. If you fill in the channel or group, the robot will send it to the channel or group. The final file link is the same. |
⚠️ Note: If you fill in TG_CHAT_ID
of the channel, you need to add TG_BOT to the channel and set it as an administrator!
Use the bot @VersaToolsBot to get the ID and forward your messages with the bot or channel to the bot!
Used when binding the database
variable name | illustrate |
---|
DATABASE | Database variables, used to bind the database. |
Optional:
variable name | illustrate |
---|
ENABLE_AUTH | When set to true , guest verification is enabled. If it is empty or not set, guest verification is turned off. |
Database initialization instructions
CREATE TABLE media (
url TEXT PRIMARY KEY,
fileId TEXT NOT NULL
);
Fill in example:
Pages deployment tutorial
Worker deployment tutorial
Pages deployment tutorial:
1. Initialize the database
⚠️ ⚠️ ⚠️ Fill in the initialization instructions
2. Deploy to pages
- 2.1 Download _worker.js, package it into zip and upload it to pages
- 2.2 Deploy to pages by forking this warehouse
3. Set variables
4. Set a custom domain name.
5. Redeploy the custom domain name and variables just configured to take effect.
Worker deployment tutorial:
1. Initialize the database
⚠️ ⚠️ ⚠️ Fill in the initialization instructions
2. Create worker
3. Set up a custom domain name
4. Set variables
5. Copy and paste the code in _worker.js into the editor
6. Click Deploy