Table of Contents
Simple CDN Server Documentation
Overview
Simple CDN Server is a lightweight, Flask-based file storage and content delivery system designed for internal use.
This application provides a web interface for uploading, managing, and serving files with built-in storage monitoring and file management capabilities.
Features
- File upload with optional custom naming
- Real-time storage monitoring
- File preview for images and videos
- Bootstrap-based responsive UI
- File management (open, download, delete)
- Token-based authentication
- Configurable storage location
- RESTful API endpoints
API Reference
Upload File
POST /new?token=<TOKEN>
Parameters:
file
(required): The file to uploadcustom_name
(optional): Custom name for the file
Response:
{"status": "true", "message": "File uploaded successfully", "url": "/f/filename.ext"}
List Files
GET /api/files
Response:
[
{
"filename": "abc123.mp4",
"display_name": "My Video",
"size": 1048576,
"type": "video/mp4",
"upload_date": "2023-01-01T12:00:00Z"
}
]
Delete File
DELETE /api/files/<filename>
Headers:
Authorization: Bearer <TOKEN>
Response:
{"status": "success", "message": "File deleted successfully"}
Serve File
GET /f/<filename>
Serves the requested file directly.
Storage Info
GET /api/storage
Response:
{
"total_gb": 100.0,
"used_gb": 25.5,
"free_gb": 74.5,
"used_percent": 25.5
}
File Upload
Files can be uploaded through the web interface or via API calls.
Web Interface Upload
- Navigate to the main page
- Select a file using the file picker
- Optionally provide a custom name
- Click the "Upload" button
API Upload
Example using curl:
curl -X POST "http://localhost:5000/new?token=helgilibrarytokenplaceholder" \
-F "file=@/path/to/your/file.mp4" \
-F "custom_name=My Custom Video Name"
File Management
The main interface provides several file management operations:
Available Operations
- Open: Opens the file in a new tab
- Download: Downloads the file to your device
- Publish: Placeholder for future publishing functionality
- Delete: Permanently removes the file from the server
File Information
The file table displays:
- Preview thumbnail for images and videos
- File name (custom name if provided, with original filename below)
- File size in appropriate units
- File type badge
- Upload date and time
Storage Monitoring
The application provides real-time storage usage information:
Storage Dashboard
- Visual progress bar showing storage usage percentage
- Total, used, and available space in GB
- File count and total file size statistics
Storage information is updated automatically when files are uploaded or deleted.
Configuration
Environment Variables
Variable | Description | Default |
---|---|---|
HOST |
Server host address | localhost |
UPLOAD_FOLDER |
Directory for file storage | uploads |
TOKEN |
Authentication token | helgilibrarytokenplaceholder |
Docker Deployment
docker build -t simple-cdn-server .
docker run -p 5000:5000 -v /path/to/storage:/app/uploads simple-cdn-server