What is Flask Integration?
Flask integration provides:- Large file downloads: Bypass Discord’s 5MB limit
- Custom download links: Generate unique URLs for file access
- Configurable expiration: Single-use or persistent links
- Activity logging: Track all download requests
- HTTP file serving: Simple web server for file delivery
Flask is a lightweight Python web framework. McDis-RCON uses it to serve files over HTTP.
Configuration
Enable Flask inmd_config.yml:
md_config.yml
Configuration Parameters
Allow
Type: Boolean
Options:
Purpose: Enable or disable Flask integration
Options:
true / falsePurpose: Enable or disable Flask integration
IP
Type: String
Format: IPv4 address
Purpose: Public IP for download URLs
Example:
Format: IPv4 address
Purpose: Public IP for download URLs
Example:
"203.0.113.42"Port
Type: Integer
Default:
Purpose: TCP port for Flask server
Range: 1024-65535
Default:
5000Purpose: TCP port for Flask server
Range: 1024-65535
Network Setup
Port Forwarding
To make Flask accessible from the internet:Create port forward rule
- External Port: 5000
- Internal Port: 5000
- Internal IP: Your server’s local IP (e.g.,
192.168.1.100) - Protocol: TCP
Firewall Configuration
Linux (UFW):- Open Windows Defender Firewall
- Click “Advanced settings”
- Select “Inbound Rules” → “New Rule”
- Choose “Port” → TCP → Specific local ports:
5000 - Allow the connection
Using Flask
Enabling Flask Server
Flask Controls
🔄 Reload
Refresh the Flask interface
Run/Close
Start or stop the Flask web server
Single/Multi-Use
Configure whether links expire after first download
Temporary/Persistent
Configure whether links have a time-based expiration
Download Link Modes
Single-Use Links
- Link expires after one download
- Most secure option
- Ideal for one-time file transfers
Multi-Use Links
- Link can be used multiple times
- No download count limit
- Useful for team collaboration
Temporary Links
- Link expires after a time period (configurable)
- Automatic cleanup
- Good for scheduled downloads
Persistent Links
- Link never expires
- Remains active indefinitely
- Use with caution
Recommended Combinations
| Scenario | Link Type | Expiration |
|---|---|---|
| One-time backup share | Single-Use | Temporary |
| Team file distribution | Multi-Use | Temporary |
| Emergency access | Single-Use | Persistent |
| Public resource | Multi-Use | Persistent |
Downloading Files
Files under 5MB are sent directly via Discord attachment, even if Flask is enabled.
Flask Logging
All Flask activity is logged in the Console Flask thread:What’s Logged
- Server start/stop events
- File request originator (Discord user)
- Generated link IDs
- Download IP addresses
- File transfer completion
- Link expiration events
Security Considerations
HTTP vs HTTPS
McDis-RCON’s Flask server uses HTTP, not HTTPS:- ✅ Pros: Simple setup, no certificate required
- ❌ Cons: Traffic is unencrypted, visible to network observers
Best Practices
Disable when idle
Only enable Flask when actively downloading files
Use Single-Use links
Prevent link sharing and replay attacks
Monitor logs
Check Flask console for suspicious IPs
Temporary links
Add time-based expiration for added security
Firewall rules
Restrict port 5000 to known IPs if possible
VPN/private network
Use VPN for sensitive file transfers
IP Whitelisting
For advanced security, restrict Flask access to specific IPs: Linux (iptables):Troubleshooting
Download link doesn't work
Download link doesn't work
Symptoms: Clicking link shows “Connection refused” or timeoutPossible causes:
- Flask server not running
- Port not forwarded in router
- Firewall blocking port 5000
- Wrong IP in configuration
- Verify Flask status is Run in Tools panel
- Check port forwarding in router settings
- Test firewall:
sudo ufw status(Linux) - Confirm public IP: whatismyip.com
- Test port: canyouseeme.org
Link expired too quickly
Link expired too quickly
Problem: Link expired before download completedCauses:
- Single-Use mode with interrupted download
- Temporary mode with short timeout
- Switch to Multi-Use mode for large files
- Use Persistent mode to remove time limit
- Request a new link
- Improve internet connection speed
Internal IP in download link
Internal IP in download link
Problem: Link shows
192.168.x.x instead of public IPCause: Wrong IP configured in md_config.ymlSolution:- Find public IP: whatismyip.com
- Update
md_config.yml: - Restart McDis-RCON
Flask console shows errors
Flask console shows errors
Common errors:
Address already in use→ Port 5000 is occupied- Solution: Change port in config or stop conflicting service
Permission denied→ Insufficient permissions- Solution: Run McDis-RCON with appropriate permissions
Connection reset→ Download interrupted- Solution: Generate new link and try again
Advanced Configuration
Using a Different Port
If port 5000 is occupied:md_config.yml
- Update port forwarding rule
- Update firewall rules
- Restart McDis-RCON
HTTPS with Reverse Proxy
For production use, implement HTTPS using nginx: nginx configuration:md_config.yml:
Reverse proxy configuration requires SSL certificates (e.g., from Let’s Encrypt) and web server expertise.
Use Cases
1. Downloading Large Backups
2. Distributing Server Files
3. Emergency File Access
Performance Considerations
Bandwidth
Flask downloads consume bandwidth:- Large backup (5GB) = 5GB upload bandwidth
- Multiple concurrent downloads = multiplicative usage
Concurrent Downloads
Flask can handle multiple simultaneous downloads, limited by:- Server CPU and RAM
- Network bandwidth
- Disk I/O speed
- Use SSD for faster file access
- Limit concurrent downloads
- Schedule large transfers during off-peak hours
Next Steps
File Manager
Learn to navigate and manage files
Backup Management
Create and restore backups

