Compare commits

...

7 Commits

Author SHA1 Message Date
cd27cc8ad9 Major refactor: Fix SQLite concurrency, remove rate limiting, simplify architecture
- Switch to single Gunicorn worker to eliminate SQLite database locking issues
- Remove Flask-Limiter and all rate limiting complexity
- Remove Cloudflare proxy setup and dependencies
- Simplify configuration and remove unnecessary features
- Update all templates and static files for streamlined operation
- Clean up old files and documentation
- Restore stable database from backup
- System now runs fast and reliably without database locks
2025-09-21 19:45:08 +01:00
b08b81fec9 Fix quote submission bug and update copyright notice
- Fixed config access in submit route (config.min_quote_length -> config.get('quotes.min_length'))
- Fixed Flask-Limiter initialization syntax
- Reduced minimum quote length from 10 to 1 character
- Updated copyright notice from '© ircquotes 2024, All Rights Reserved.' to '@ ircquotes 2024-2025'
- Quote submission now works properly with correct status assignment (pending/approved)
- Quotes are properly created with status=0 (pending) when auto_approve=false
2025-09-20 20:44:30 +01:00
d1edf8fb50 Update Latest Updates section
- Added entry for September 2025 security and feature improvements
- Mentions copy quotes, bulk moderation, mobile support, rate limiting, and security enhancements
2025-09-20 20:26:36 +01:00
36e0ab9a88 Add password hash fix utility
- Created fix_password.py to repair corrupted admin password hash
- Addresses Argon2 InvalidHash error in login
2025-09-20 20:25:54 +01:00
720b89a296 Make Gunicorn respect config.json settings
- Updated gunicorn.conf.py to read host/port from config.json
- Added gunicorn section to config.json for server settings
- Created start_gunicorn.py as alternative launcher
- Updated config.json with server settings (127.0.0.1:6969)
- Updated documentation with new startup options
2025-09-20 20:25:36 +01:00
4b31d3b9e0 Include instance folder in git and improve setup
- Updated .gitignore to include instance folder but exclude sensitive files
- Added instance/README.md with setup instructions
- Updated setup script with better configuration examples
- Instance folder will now be tracked in git to preserve quotes.db
2025-09-20 20:09:15 +01:00
3dbb181cb0 Add Cloudflare/nginx proxy support and production setup
- Updated ProxyFix configuration for Cloudflare + nginx
- Added custom IP detection for real client IPs
- Updated rate limiting to use real IPs
- Added nginx configuration example
- Added Cloudflare setup guide
- Added production server setup script
2025-09-20 20:07:28 +01:00
28 changed files with 1600 additions and 442 deletions

8
.gitignore vendored
View File

@@ -2,8 +2,9 @@
venv/
.venv/
# Flask instance folder
instance/
# Flask instance folder - keep the folder but ignore sensitive files
instance/flask_secret_key
instance/*.log
# Python
__pycache__/
@@ -12,8 +13,7 @@ __pycache__/
*.pyd
.Python
# Database files
*.db
# Database WAL files (keep main .db file)
*.db-shm
*.db-wal

148
CONFIG_GUIDE.md Normal file
View File

@@ -0,0 +1,148 @@
# Configuration Guide
This guide explains how to configure the ircquotes application by editing `config.json` manually.
## Configuration File Structure
The `config.json` file is organized into sections:
### App Section
```json
"app": {
"name": "ircquotes", // Application name
"host": "127.0.0.1", // Host to bind to (use 0.0.0.0 for all interfaces)
"port": 6969, // Port number to run on
"debug": false // Enable debug mode (set to true for development)
}
```
### Gunicorn Section (Production Settings)
```json
"gunicorn": {
"workers": 4, // Number of worker processes
"timeout": 30, // Request timeout in seconds
"keepalive": 5, // Keep-alive timeout
"max_requests": 1000, // Max requests per worker before restart
"preload": true // Preload application code
}
```
### Database Section
```json
"database": {
"uri": "sqlite:///quotes.db?timeout=20", // Database connection string
"pool_timeout": 20, // Connection pool timeout
"pool_recycle": -1, // Connection recycle time (-1 = disabled)
"pool_pre_ping": true // Test connections before use
}
```
### Security Section
```json
"security": {
"csrf_enabled": true, // Enable CSRF protection
"csrf_time_limit": null, // CSRF token time limit (null = no limit)
"session_cookie_secure": false, // Require HTTPS for session cookies
"session_cookie_httponly": true, // Prevent JavaScript access to session cookies
"session_cookie_samesite": "Lax", // SameSite policy for session cookies
"security_headers": {
"x_content_type_options": "nosniff",
"x_frame_options": "DENY",
"x_xss_protection": "1; mode=block",
"strict_transport_security": "max-age=31536000; includeSubDomains",
"content_security_policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'"
}
}
```
### Admin Section
```json
"admin": {
"username": "admin", // Admin username
"password_hash": "..." // Argon2 password hash (use generate_password.py)
}
```
### Quotes Section
```json
"quotes": {
"min_length": 1, // Minimum quote length in characters
"max_length": 5000, // Maximum quote length in characters
"per_page": 25, // Quotes displayed per page
"auto_approve": false, // Automatically approve new quotes
"allow_html": false // Allow HTML in quotes (not recommended)
}
```
### Features Section
```json
"features": {
"voting_enabled": true, // Enable voting on quotes
"flagging_enabled": true, // Enable flagging inappropriate quotes
"copy_quotes_enabled": true, // Enable copy-to-clipboard feature
"dark_mode_enabled": true, // Enable dark mode toggle
"api_enabled": true, // Enable JSON API endpoints
"bulk_moderation_enabled": true // Enable bulk moderation actions
}
```
### Logging Section
```json
"logging": {
"level": "DEBUG", // Logging level (DEBUG, INFO, WARNING, ERROR)
"format": "%(asctime)s [%(levelname)s] %(message)s" // Log message format
}
```
## Common Configuration Tasks
### Change Admin Password
1. Run: `python generate_password.py`
2. Edit `config.json` and update `admin.password_hash` with the generated hash
3. Restart the application
### Change Port
Edit the `app.port` value in `config.json`:
```json
"app": {
"port": 8080
}
```
### Adjust Quote Limits
Edit the `quotes` section:
```json
"quotes": {
"min_length": 10,
"max_length": 2000,
"per_page": 50
}
```
### Disable Features
Set feature flags to `false`:
```json
"features": {
"voting_enabled": false,
"flagging_enabled": false
}
```
### Adjust Rate Limits
Modify the `rate_limiting.endpoints` section:
```json
"rate_limiting": {
"endpoints": {
"submit": "10 per minute",
"vote": "120 per minute"
}
}
```
## Important Notes
- Always restart the application after making configuration changes
- Use valid JSON syntax (no trailing commas, proper quotes)
- Test configuration changes in a development environment first
- Keep backups of your working configuration
- Use `python generate_password.py` to create secure password hashes

View File

@@ -13,29 +13,35 @@ All application settings are now centralized in `config.json`. You can easily mo
- **Admin credentials**
- **Feature toggles**
### Viewing Current Configuration
### Configuration Management
All configuration is done by editing `config.json` directly. This file contains all application settings organized in sections:
- **app**: Basic application settings (name, host, port, debug)
- **database**: Database connection settings
- **security**: Security headers, CSRF, proxy settings
- **rate_limiting**: Rate limiting configuration for different endpoints
- **admin**: Admin username and password hash
- **quotes**: Quote submission settings (length limits, pagination)
- **features**: Feature toggles (voting, flagging, dark mode, etc.)
- **logging**: Logging configuration
### Example Configuration Changes
```bash
python config_manager.py
```
# Edit config.json in any text editor
nano config.json
### Updating Configuration
```bash
# Change port
python config_manager.py app.port 8080
# Example changes:
# - Change port: "port": 8080 in the "app" section
# - Change quotes per page: "per_page": 50 in the "quotes" section
# - Disable CSRF: "csrf_enabled": false in the "security" section
# - Change rate limits: "login": "10 per minute" in rate_limiting.endpoints
# Change quotes per page
python config_manager.py quotes.per_page 50
# Disable CSRF (not recommended)
python config_manager.py security.csrf_enabled false
# Change rate limits
python config_manager.py rate_limiting.endpoints.login "10 per minute"
# After making changes, restart the application
```
## Running with Gunicorn (Production)
### Quick Start
### Quick Start - Uses config.json settings
```bash
# Activate virtual environment
source .venv/bin/activate
@@ -43,25 +49,28 @@ source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run with Gunicorn (recommended for production)
# Option 1: Run with config file (recommended - uses config.json)
gunicorn --config gunicorn.conf.py app:app
# Option 2: Run with Python launcher (also uses config.json)
python start_gunicorn.py
```
### Alternative Gunicorn Commands
### Manual Gunicorn Commands (ignores config.json)
**Basic production run:**
```bash
gunicorn -w 4 -b 0.0.0.0:5050 app:app
gunicorn -w 4 -b 127.0.0.1:6969 app:app
```
**With more workers (for higher traffic):**
```bash
gunicorn -w 8 -b 0.0.0.0:5050 --timeout 30 app:app
gunicorn -w 8 -b 127.0.0.1:6969 --timeout 30 app:app
```
**Behind a reverse proxy (nginx/apache):**
```bash
gunicorn -w 4 -b 127.0.0.1:5050 app:app
gunicorn -w 4 -b 127.0.0.1:6969 app:app
```
### Environment Variables for Production

862
app.py

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,16 @@
{
"app": {
"name": "ircquotes",
"host": "0.0.0.0",
"port": 5050,
"debug": false
"host": "127.0.0.1",
"port": 6969,
"debug": true
},
"gunicorn": {
"workers": 1,
"timeout": 30,
"keepalive": 5,
"max_requests": 1000,
"preload": true
},
"database": {
"uri": "sqlite:///quotes.db?timeout=20",
@@ -25,28 +32,12 @@
"content_security_policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'"
}
},
"rate_limiting": {
"enabled": true,
"global_limit": "1000 per hour",
"endpoints": {
"login": "5 per minute",
"submit": "5 per minute",
"modapp": "20 per minute",
"bulk_actions": "10 per minute",
"approve": "30 per minute",
"reject": "30 per minute",
"delete": "20 per minute",
"vote": "60 per minute",
"flag": "10 per minute",
"search": "30 per minute"
}
},
"admin": {
"username": "admin",
"password_hash": "$argon2i$v=19$m=65536,t=4,p=1$cWZDc1pQaUJLTUJoaVI4cw$kn8XKz6AEZi8ebXfyyZuzommSypliVFrsGqzOyUEIHA"
"username": "ComputerTech",
"password_hash": "$argon2id$v=19$m=65536,t=3,p=4$cIPRCJrjS1DwjaFov5G+BQ$yundbpf2i1jBrKsj96ra7wTNmVZ56SJR25XX4jp2yR8"
},
"quotes": {
"min_length": 10,
"min_length": 1,
"max_length": 5000,
"per_page": 25,
"auto_approve": false,
@@ -61,7 +52,7 @@
"bulk_moderation_enabled": true
},
"logging": {
"level": "WARNING",
"level": "DEBUG",
"format": "%(asctime)s [%(levelname)s] %(message)s"
}
}

View File

@@ -1,84 +0,0 @@
#!/usr/bin/env python3
"""
Configuration management utility for ircquotes.
Allows you to view and update configuration values easily.
"""
import json
import sys
from config_loader import config
def show_config():
"""Display current configuration."""
print("Current Configuration:")
print("=" * 50)
print(f"App Name: {config.app_name}")
print(f"Host: {config.app_host}")
print(f"Port: {config.app_port}")
print(f"Debug Mode: {config.debug_mode}")
print(f"Database URI: {config.database_uri}")
print(f"CSRF Enabled: {config.csrf_enabled}")
print(f"Rate Limiting: {config.rate_limiting_enabled}")
print(f"Quotes per Page: {config.quotes_per_page}")
print(f"Min Quote Length: {config.min_quote_length}")
print(f"Max Quote Length: {config.max_quote_length}")
print(f"Admin Username: {config.admin_username}")
print(f"Logging Level: {config.logging_level}")
print("=" * 50)
def update_config(key, value):
"""Update a configuration value."""
try:
# Load current config
with open('config.json', 'r') as f:
data = json.load(f)
# Navigate to the key using dot notation
keys = key.split('.')
current = data
for k in keys[:-1]:
if k not in current:
current[k] = {}
current = current[k]
# Convert value to appropriate type
if value.lower() == 'true':
value = True
elif value.lower() == 'false':
value = False
elif value.isdigit():
value = int(value)
elif value.replace('.', '').isdigit():
value = float(value)
# Set the value
current[keys[-1]] = value
# Save back to file
with open('config.json', 'w') as f:
json.dump(data, f, indent=2)
print(f"Updated {key} = {value}")
print("Restart the application for changes to take effect.")
except Exception as e:
print(f"Error updating configuration: {e}")
def main():
if len(sys.argv) == 1:
show_config()
elif len(sys.argv) == 3:
key, value = sys.argv[1], sys.argv[2]
update_config(key, value)
else:
print("Usage:")
print(" python config_manager.py # Show current config")
print(" python config_manager.py <key> <value> # Update config value")
print()
print("Examples:")
print(" python config_manager.py app.port 8080")
print(" python config_manager.py quotes.per_page 50")
print(" python config_manager.py security.csrf_enabled false")
if __name__ == "__main__":
main()

77
create_fresh_db.py Normal file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""Create a fresh quotes database with test data"""
import os
import sqlite3
from datetime import datetime
# Remove existing database files
db_files = ['instance/quotes.db', 'instance/quotes.db-shm', 'instance/quotes.db-wal']
for db_file in db_files:
if os.path.exists(db_file):
os.remove(db_file)
print(f"Removed {db_file}")
# Create fresh database
conn = sqlite3.connect('instance/quotes.db')
cursor = conn.cursor()
# Create the quote table with proper schema
cursor.execute("""
CREATE TABLE quote (
id INTEGER PRIMARY KEY AUTOINCREMENT,
text TEXT NOT NULL,
votes INTEGER DEFAULT 0,
date DATETIME,
status INTEGER DEFAULT 0,
ip_address TEXT,
user_agent TEXT,
submitted_at DATETIME,
flag_count INTEGER DEFAULT 0
)
""")
# Create indexes for performance
cursor.execute("CREATE INDEX idx_status_id ON quote(status, id)")
cursor.execute("CREATE INDEX idx_flag_count_id ON quote(flag_count, id)")
# Insert test data
test_quotes = [
("This is a pending quote for testing moderation", 0, 0), # pending
("This is an approved quote that should appear in browse", 5, 1), # approved
("Another approved quote with positive votes", 12, 1), # approved
("A rejected quote that was not good enough", -2, 2), # rejected
("Another pending quote to test approve/reject", 0, 0), # pending
("Third pending quote for comprehensive testing", 0, 0), # pending
]
current_time = datetime.now()
for i, (text, votes, status) in enumerate(test_quotes, 1):
cursor.execute("""
INSERT INTO quote (text, votes, status, submitted_at, ip_address, user_agent, flag_count)
VALUES (?, ?, ?, ?, ?, ?, ?)
""", (text, votes, status, current_time, '127.0.0.1', 'Test Script', 0))
# Set WAL mode for better concurrency
cursor.execute("PRAGMA journal_mode=WAL")
cursor.execute("PRAGMA busy_timeout=1000")
# Commit and close
conn.commit()
# Verify the data
cursor.execute("SELECT id, text, status FROM quote ORDER BY id")
results = cursor.fetchall()
print("\nCreated fresh database with test quotes:")
print("ID | Status | Text")
print("-" * 50)
for quote_id, text, status in results:
status_name = {0: "PENDING", 1: "APPROVED", 2: "REJECTED"}[status]
print(f"{quote_id:2d} | {status_name:8s} | {text[:40]}...")
conn.close()
print(f"\nFresh database created successfully!")
print(f"Total quotes: {len(test_quotes)}")
print("3 pending, 2 approved, 1 rejected")

55
fix_password.py Normal file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""
Fix corrupted admin password hash in config.json
"""
import json
from argon2 import PasswordHasher
import getpass
def fix_admin_password():
"""Fix the corrupted admin password hash"""
print("Current admin password hash appears to be corrupted.")
print("Let's generate a new one...")
# Get new password
password = getpass.getpass("Enter new admin password: ")
confirm = getpass.getpass("Confirm password: ")
if password != confirm:
print("Passwords don't match!")
return
# Generate new hash
ph = PasswordHasher()
new_hash = ph.hash(password)
# Load current config
try:
with open('config.json', 'r') as f:
config = json.load(f)
except Exception as e:
print(f"Error reading config.json: {e}")
return
# Update the password hash
if 'admin' not in config:
config['admin'] = {}
config['admin']['password_hash'] = new_hash
# Save config
try:
with open('config.json', 'w') as f:
json.dump(config, f, indent=2)
print("\nPassword hash updated successfully!")
print(f"New hash: {new_hash}")
print("\nRestart the application for changes to take effect.")
except Exception as e:
print(f"Error saving config.json: {e}")
if __name__ == "__main__":
fix_admin_password()

View File

@@ -29,8 +29,12 @@ def generate_password_hash():
print("\nGenerated password hash:")
print(hash_value)
print("\nTo set this as admin password, run:")
print(f'python config_manager.py admin.password_hash "{hash_value}"')
print("\nTo set this as admin password:")
print("1. Open config.json in a text editor")
print("2. Find the 'admin' section")
print("3. Replace the 'password_hash' value with:")
print(f' "{hash_value}"')
print("4. Save the file and restart the application")
if __name__ == "__main__":
generate_password_hash()

View File

@@ -1,38 +0,0 @@
# Gunicorn configuration file for ircquotes
import multiprocessing
# Server socket
bind = "0.0.0.0:5050"
backlog = 2048
# Worker processes
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = "sync"
worker_connections = 1000
timeout = 30
keepalive = 5
# Restart workers after this many requests, to help prevent memory leaks
max_requests = 1000
max_requests_jitter = 100
# Logging
accesslog = "-" # Log to stdout
errorlog = "-" # Log to stderr
loglevel = "info"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(D)s'
# Process naming
proc_name = 'ircquotes'
# Preload app for better performance
preload_app = True
# Security
limit_request_line = 4096
limit_request_fields = 100
limit_request_field_size = 8190
# SSL (uncomment and configure for HTTPS)
# keyfile = '/path/to/keyfile'
# certfile = '/path/to/certfile'

2
instance/README.md Normal file
View File

@@ -0,0 +1,2 @@
# This file will be generated automatically on each server
# Run: python -c "import secrets; print(secrets.token_hex(32))" > instance/flask_secret_key

BIN
instance/quotes.db Normal file

Binary file not shown.

113
nginx-ircquotes.conf Normal file
View File

@@ -0,0 +1,113 @@
# nginx configuration for ircquotes behind Cloudflare
# Place this in /etc/nginx/sites-available/ircquotes
server {
listen 80;
server_name your-domain.com; # Replace with your actual domain
# Cloudflare real IP restoration
# Updated Cloudflare IP ranges (as of September 2025)
# IPv4 ranges
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
# IPv6 ranges
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2a06:98c0::/29;
set_real_ip_from 2c0f:f248::/32;
# Use Cloudflare's CF-Connecting-IP header for real IP
real_ip_header CF-Connecting-IP;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private must-revalidate auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript;
# Rate limiting (additional layer)
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/m;
# Main application
location / {
proxy_pass http://127.0.0.1:5050;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Pass Cloudflare headers
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
proxy_set_header CF-Ray $http_cf_ray;
proxy_set_header CF-Visitor $http_cf_visitor;
# Timeouts
proxy_connect_timeout 30s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
}
# Rate limit login endpoint
location /login {
limit_req zone=login burst=3 nodelay;
proxy_pass http://127.0.0.1:5050;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
}
# Rate limit API endpoints
location /api/ {
limit_req zone=api burst=10 nodelay;
proxy_pass http://127.0.0.1:5050;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
}
# Static files (optional optimization)
location /static/ {
proxy_pass http://127.0.0.1:5050;
proxy_set_header Host $host;
# Cache static files
expires 1y;
add_header Cache-Control "public, immutable";
}
# Health check endpoint
location /health {
access_log off;
proxy_pass http://127.0.0.1:5050;
proxy_set_header Host $host;
}
}

83
production.py Executable file
View File

@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""
Production launcher for ircquotes using Gunicorn
Reads all configuration from config.json
"""
import subprocess
import sys
import os
from config_loader import config
def main():
"""Launch Gunicorn with settings from config.json"""
print("Starting ircquotes in production mode with Gunicorn...")
# Get configuration values from config.json
host = config.app_host
port = config.app_port
workers = config.get('gunicorn.workers', 1) # Default to 1 to avoid SQLite locking
timeout = config.get('gunicorn.timeout', 30)
keepalive = config.get('gunicorn.keepalive', 5)
max_requests = config.get('gunicorn.max_requests', 1000)
preload = config.get('gunicorn.preload', True)
# Use virtual environment's gunicorn if available
script_dir = os.path.dirname(os.path.abspath(__file__))
venv_gunicorn = os.path.join(script_dir, '.venv', 'bin', 'gunicorn')
if os.path.exists(venv_gunicorn):
gunicorn_cmd = venv_gunicorn
print(f"Using virtual environment Gunicorn: {venv_gunicorn}")
else:
gunicorn_cmd = 'gunicorn'
print("Using system Gunicorn")
# Build Gunicorn command with all config.json settings
cmd = [
gunicorn_cmd,
'--bind', f'{host}:{port}',
'--workers', str(workers),
'--timeout', str(timeout),
'--keep-alive', str(keepalive), # Fixed: --keep-alive not --keepalive
'--max-requests', str(max_requests),
'--max-requests-jitter', '100',
'--access-logfile', '-', # Log to stdout
'--error-logfile', '-', # Log to stderr
'--log-level', 'info'
]
# Add preload option if enabled
if preload:
cmd.append('--preload')
# Add the app module at the end
cmd.append('app:app')
print(f"Configuration:")
print(f" Host: {host}")
print(f" Port: {port}")
print(f" Workers: {workers}")
print(f" Timeout: {timeout}s")
print(f" Max Requests: {max_requests}")
print(f" Preload: {preload}")
print()
print(f"Gunicorn command: {' '.join(cmd)}")
print()
# Execute Gunicorn
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error starting Gunicorn: {e}")
sys.exit(1)
except KeyboardInterrupt:
print("\nStopping Gunicorn...")
sys.exit(0)
except FileNotFoundError:
print("Error: Gunicorn not found. Please install it with: pip install gunicorn")
sys.exit(1)
if __name__ == "__main__":
main()

View File

@@ -1,6 +1,5 @@
Flask==2.3.2
Flask-SQLAlchemy==3.0.5
Flask-Limiter==2.4
Flask-CORS==3.0.10
Flask-WTF==1.2.1
argon2-cffi==21.3.0

57
setup.sh Normal file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
# ircquotes production server setup script
# Run this after cloning the repository
echo "Setting up ircquotes on production server..."
# Instance directory should already exist from git
# But create it if it doesn't
mkdir -p instance
# Generate secret key
echo "Generating Flask secret key..."
python3 -c "import secrets; print(secrets.token_hex(32))" > instance/flask_secret_key
# Create empty database file if it doesn't exist
if [ ! -f "instance/quotes.db" ]; then
echo "Creating database file..."
touch instance/quotes.db
fi
# Set permissions
echo "Setting file permissions..."
chmod 600 instance/flask_secret_key
chmod 664 instance/quotes.db
# Create virtual environment
echo "Creating virtual environment..."
python3 -m venv .venv
# Activate and install dependencies
echo "Installing dependencies..."
source .venv/bin/activate
pip install -r requirements.txt
# Initialize database
echo "Initializing database..."
python -c "from app import app, db; app.app_context().push(); db.create_all(); print('Database initialized successfully!')"
echo ""
echo "Setup complete! You can now:"
echo "1. Configure admin credentials:"
echo " python generate_password.py"
echo " # Then edit config.json and update admin.username and admin.password_hash"
echo ""
echo "2. Configure other settings by editing config.json:"
echo " # app.port - Change server port"
echo " # quotes.min_length - Minimum quote length"
echo " # quotes.max_length - Maximum quote length"
echo " # security.csrf_enabled - Enable/disable CSRF protection"
echo ""
echo "3. Start the application:"
echo " source .venv/bin/activate"
echo " gunicorn --config gunicorn.conf.py app:app"
echo ""
echo "4. Or run in development mode:"
echo " python app.py"

189
static/modapp.js Normal file
View File

@@ -0,0 +1,189 @@
/**
* ModApp JavaScript - AJAX moderation actions without page refresh
*/
// Handle individual moderation actions (approve, reject, delete, clear_flags)
async function moderationAction(action, quoteId, element) {
try {
// Show loading state
const originalText = element.textContent;
element.textContent = 'Loading...';
element.style.pointerEvents = 'none';
const response = await fetch(`/${action}/${quoteId}`, {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest' // Tell server this is AJAX
}
});
const result = await response.json();
if (result.success) {
// Show success message briefly
showMessage(result.message, 'success');
// Remove the quote from the current view or update its display
const quoteRow = element.closest('tr');
if (quoteRow) {
// Fade out the quote
quoteRow.style.transition = 'opacity 0.3s ease';
quoteRow.style.opacity = '0';
setTimeout(() => {
quoteRow.remove();
updateCounters();
}, 300);
}
} else {
// Show error message
showMessage(result.message || 'Action failed', 'error');
// Restore original state
element.textContent = originalText;
element.style.pointerEvents = 'auto';
}
} catch (error) {
console.error('Moderation action failed:', error);
showMessage('Network error. Please try again.', 'error');
// Restore original state
element.textContent = originalText;
element.style.pointerEvents = 'auto';
}
return false; // Prevent default link behavior
}
// Show temporary message to user
function showMessage(message, type = 'info') {
// Remove any existing messages
const existingMsg = document.getElementById('temp-message');
if (existingMsg) {
existingMsg.remove();
}
// Create new message element
const msgDiv = document.createElement('div');
msgDiv.id = 'temp-message';
msgDiv.textContent = message;
msgDiv.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
color: white;
max-width: 300px;
word-wrap: break-word;
transition: opacity 0.3s ease;
${type === 'success' ? 'background-color: #28a745;' : ''}
${type === 'error' ? 'background-color: #dc3545;' : ''}
${type === 'info' ? 'background-color: #17a2b8;' : ''}
`;
document.body.appendChild(msgDiv);
// Auto-remove after 3 seconds
setTimeout(() => {
msgDiv.style.opacity = '0';
setTimeout(() => msgDiv.remove(), 300);
}, 3000);
}
// Update quote counters (simplified - could be enhanced with actual counts)
function updateCounters() {
// This could be enhanced to fetch actual counts from server
// For now, just indicate that counts may have changed
const statusElements = document.querySelectorAll('.quote-status');
statusElements.forEach(el => {
el.style.opacity = '0.8';
setTimeout(() => el.style.opacity = '1', 100);
});
}
// Handle bulk actions form
async function handleBulkAction(form, event) {
event.preventDefault();
const formData = new FormData(form);
const action = formData.get('action');
const quoteIds = formData.getAll('quote_ids');
if (quoteIds.length === 0) {
showMessage('Please select at least one quote', 'error');
return false;
}
if (!confirm(`Are you sure you want to ${action} ${quoteIds.length} quote(s)?`)) {
return false;
}
try {
const response = await fetch('/modapp/bulk', {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest'
},
body: formData
});
const result = await response.json();
if (result.success) {
showMessage(result.message, 'success');
// Remove processed quotes from view
quoteIds.forEach(quoteId => {
const checkbox = document.querySelector(`input[value="${quoteId}"]`);
if (checkbox) {
const quoteRow = checkbox.closest('tr');
if (quoteRow) {
quoteRow.style.transition = 'opacity 0.3s ease';
quoteRow.style.opacity = '0';
setTimeout(() => quoteRow.remove(), 300);
}
}
});
// Reset form
form.reset();
updateCounters();
} else {
showMessage(result.message || 'Bulk action failed', 'error');
}
} catch (error) {
console.error('Bulk action failed:', error);
showMessage('Network error. Please try again.', 'error');
}
return false;
}
// Initialize when page loads
document.addEventListener('DOMContentLoaded', function() {
// Convert all moderation links to AJAX
document.querySelectorAll('a[href^="/approve/"], a[href^="/reject/"], a[href^="/delete/"], a[href^="/clear_flags/"]').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const href = this.getAttribute('href');
const parts = href.split('/');
const action = parts[1]; // approve, reject, delete, clear_flags
const quoteId = parts[2];
moderationAction(action, quoteId, this);
});
});
// Convert bulk form to AJAX
const bulkForm = document.querySelector('form[action="/modapp/bulk"]');
if (bulkForm) {
bulkForm.addEventListener('submit', function(e) {
handleBulkAction(this, e);
});
}
});

View File

@@ -116,6 +116,9 @@ input.button:hover {
display: inline-block;
min-width: 12px;
text-align: center;
border-radius: 2px;
user-select: none;
-webkit-user-select: none;
}
.qa:hover {
@@ -129,6 +132,13 @@ input.button:hover {
border: 1px inset #808080;
}
/* Quote controls wrapper for better mobile layout */
.quote-controls {
display: inline-block;
white-space: nowrap;
margin: 0 2px;
}
.quote {
font-family: 'Courier New', 'Lucida Console', monospace;
font-size: smaller;
@@ -187,10 +197,14 @@ footer {
color: #c08000;
text-decoration: none;
font-weight: bold;
padding: 2px 4px;
margin-right: 4px;
}
.quote-id:hover {
text-decoration: underline;
background-color: rgba(192, 128, 0, 0.1);
border-radius: 2px;
}
/* Dark Mode Toggle Button */
@@ -415,14 +429,17 @@ html.dark-theme font {
padding: 5px;
}
/* Quote buttons - make them touch-friendly */
/* Quote buttons - compact but touch-friendly */
.qa {
padding: 8px 12px;
margin: 2px;
min-width: 35px;
font-size: 16px;
padding: 6px 8px;
margin: 1px 2px;
min-width: 28px;
min-height: 32px;
font-size: 14px;
display: inline-block;
text-align: center;
border-radius: 3px;
line-height: 1.2;
}
/* Quote text - ensure readability */
@@ -430,40 +447,43 @@ html.dark-theme font {
font-size: 14px;
line-height: 1.4;
word-wrap: break-word;
padding: 8px;
}
/* Quote header - adjust spacing */
/* Quote header - adjust spacing and make more compact */
.quote {
font-size: 14px;
margin-bottom: 8px;
font-size: 13px;
margin-bottom: 6px;
line-height: 1.3;
}
/* Form elements - make touch-friendly */
input[type="text"], input[type="number"], textarea, select {
width: 90%;
padding: 10px;
padding: 8px;
font-size: 16px; /* Prevents zoom on iOS */
margin: 5px 0;
margin: 3px 0;
}
input[type="submit"], button {
padding: 10px 15px;
font-size: 16px;
margin: 5px;
min-height: 44px; /* iOS touch target */
padding: 8px 12px;
font-size: 14px;
margin: 3px;
min-height: 40px; /* Reasonable touch target */
}
/* Pagination - mobile friendly */
#pagination {
font-size: 14px;
font-size: 13px;
text-align: center;
padding: 10px;
padding: 8px;
}
#pagination a {
padding: 8px 12px;
padding: 6px 10px;
margin: 2px;
display: inline-block;
border-radius: 3px;
}
/* ModApp table - horizontal scroll for wide tables */
@@ -477,24 +497,35 @@ html.dark-theme font {
width: auto;
}
/* Hide less important columns on mobile */
/* Compact view for smaller screens */
@media screen and (max-width: 480px) {
.mobile-hide {
display: none;
}
.qa {
padding: 6px 10px;
font-size: 14px;
min-width: 30px;
padding: 5px 7px;
font-size: 13px;
min-width: 26px;
min-height: 30px;
margin: 1px;
}
.quote {
font-size: 12px;
margin-bottom: 5px;
}
.qt {
font-size: 13px;
padding: 6px;
}
/* Stack quote controls for very small screens */
.quote-controls {
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
}
}
@@ -503,22 +534,30 @@ html.dark-theme font {
@media (hover: none) and (pointer: coarse) {
/* This targets touch devices */
.qa {
padding: 10px 15px;
margin: 3px;
min-height: 44px;
min-width: 44px;
padding: 7px 10px;
margin: 2px;
min-height: 36px;
min-width: 32px;
border-radius: 4px;
}
a {
padding: 5px;
margin: 2px;
padding: 3px;
margin: 1px;
}
/* Ensure all interactive elements are large enough */
/* Ensure all interactive elements are large enough but not oversized */
button, input[type="submit"], input[type="button"] {
min-height: 44px;
min-width: 44px;
padding: 10px;
min-height: 40px;
min-width: 40px;
padding: 8px 12px;
}
/* Theme toggle button - keep compact */
#theme-toggle {
min-height: 36px;
min-width: 36px;
padding: 6px 10px;
}
}

View File

@@ -1,11 +1,11 @@
// AJAX voting functionality
function vote(quoteId, action, buttonElement) {
// Prevent multiple clicks
// Prevent multiple clicks on the same button
if (buttonElement.disabled) {
return false;
}
// Disable button temporarily
// Disable button temporarily to prevent double-clicks
buttonElement.disabled = true;
// Make AJAX request
@@ -15,9 +15,16 @@ function vote(quoteId, action, buttonElement) {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
.then(response => {
// Handle both successful and error responses with JSON
return response.json().then(data => {
return { data, status: response.status, ok: response.ok };
});
})
.then(result => {
const { data, status, ok } = result;
if (ok && data.success) {
// Update vote count display
const voteElement = document.getElementById(`votes-${quoteId}`);
if (voteElement) {
@@ -27,7 +34,15 @@ function vote(quoteId, action, buttonElement) {
// Update button states based on user's voting history
updateButtonStates(quoteId, data.user_vote);
} else {
alert(data.message || 'Sorry, your vote could not be recorded. Please try again.');
// Show the server's error message, with special handling for rate limiting
let errorMessage = data.message || 'Sorry, your vote could not be recorded. Please try again.';
if (status === 429) {
// Rate limiting or flood control
errorMessage = data.message || 'Please slow down! You\'re voting too quickly. Wait a moment and try again.';
}
alert(errorMessage);
}
})
.catch(error => {
@@ -35,7 +50,7 @@ function vote(quoteId, action, buttonElement) {
alert('Connection error while voting. Please check your internet connection and try again.');
})
.finally(() => {
// Re-enable button
// Re-enable the button immediately
buttonElement.disabled = false;
});

View File

@@ -30,7 +30,7 @@
<font size="+1"><b><i>ircquotes</i></b></font>
</td>
<td bgcolor="#c08000" align="right">
<font face="arial" size="+1"><b>Browse Quotes</b></font>
<font face="arial" size="+1"><b>{% if is_top %}Top Quotes{% else %}Browse Quotes{% endif %}</b></font>
</td>
</tr>
</table>
@@ -69,6 +69,14 @@
<a href="#" onclick="return flag({{ quote.id }}, this)" class="qa">X</a>
&nbsp;
<a href="#" onclick="return copyQuote({{ quote.id }}, this)" class="qa" title="Copy quote to clipboard">C</a>
&nbsp;
<span style="color: #666; font-size: 0.9em;">
{% if quote.submitted_at %}
{{ quote.submitted_at.strftime('%d/%m/%y %H:%M') }}
{% elif quote.date %}
{{ quote.date.strftime('%d/%m/%y') }}
{% endif %}
</span>
</p>
<p class="qt">{{ quote.text|e }}</p>
<hr>
@@ -111,7 +119,7 @@
<font size="-1">
<a href="#">Hosted by YourHostingProvider</a><br>
&#169; ircquotes 2024, All Rights Reserved.
@ ircquotes 2024-2025
</font>
</center>

View File

@@ -56,37 +56,24 @@
<h2>Frequently Asked Questions (FAQ)</h2>
<h3>What is ircquotes?</h3>
<p>ircquotes is a community-driven website where users can submit and browse memorable quotes from IRC (Internet Relay Chat). You can browse quotes, submit your own, and vote on others.</p>
<p>ircquotes is a community-driven website where users can submit and browse memorable quotes from IRC (Internet Relay Chat) and other chat platforms. You can browse quotes, submit your own, and vote on others.</p>
<h3>How does the API work?</h3>
<p>The ircquotes API allows users to retrieve quotes programmatically. It is designed for developers who want to integrate IRC quotes into their own applications.</p>
<p>The ircquotes API is a read-only interface that allows users to retrieve quotes programmatically. It is designed for developers who want to integrate IRC quotes into their own applications. Quote submissions must be done through the web interface to prevent abuse.</p>
<h4>Available API Endpoints</h4>
<ul>
<li><strong>Get All Approved Quotes</strong>: <code>GET /api/quotes</code></li>
<li><strong>Get a Specific Quote by ID</strong>: <code>GET /api/quotes/&lt;id&gt;</code></li>
<li><strong>Get a Random Quote</strong>: <code>GET /api/random</code></li>
<li><strong>Get Top Quotes</strong>: <code>GET /api/top</code></li>
<li><strong>Search Quotes</strong>: <code>GET /api/search?q=&lt;search_term&gt;</code></li>
</ul>
<h4>Submitting Quotes via the API</h4>
<p>The API also allows you to submit quotes, but this feature is rate-limited to prevent abuse. Each user is allowed 5 submissions per minute.</p>
<ul>
<li><strong>Submit a Quote</strong>: <code>POST /api/submit</code></li>
<li><strong>Request Body</strong>: The request body should be in JSON format and contain the quote text like this:</li>
<pre><code>{
"text": "This is a memorable quote!"
}</code></pre>
<li><strong>Validation Rules</strong>: Quotes must be between 5 and 1000 characters.</li>
</ul>
<h3>Rules for Submitting Quotes</h3>
<p>To ensure that ircquotes remains a fun and enjoyable platform for everyone, we ask that you follow a few simple rules when submitting quotes:</p>
<ul>
<li><strong>No Offensive Content</strong>: Do not submit quotes that contain offensive language, hate speech, or other harmful content.</li>
<li><strong>No Spam</strong>: Please avoid submitting irrelevant or repetitive content. The site is for memorable IRC quotes, not spam.</li>
<li><strong>Stay On-Topic</strong>: Ensure that your submissions are actual quotes from IRC, not made-up content.</li>
<li><strong>Stay On-Topic</strong>: Ensure that your submissions are actual quotes from chat platforms, not made-up content.</li>
<li><strong>Rate Limiting</strong>: The submission rate is limited to 5 quotes per minute to prevent spam.</li>
<li><strong>Moderation</strong>: All quotes are subject to approval by site moderators. Rejected quotes will not be publicly visible.</li>
</ul>

View File

@@ -68,7 +68,8 @@
<td class="bodytext" width="50%" valign="top">
<b>Latest Updates</b>
<p><strong>13/10/24</strong><br>Added dark theme and re added all of bash.org's old quotes.</p>
<p><strong>20/09/25</strong><br>Improved some things in the backend and added Dark theme</p>
<p><strong>13/10/24</strong><br>Re added all of bash.org's old quotes.</p>
<p><strong>09/10/24</strong><br>We are now live! Start submitting your favourite IRC quotes.</p>
</td>
</tr>
@@ -84,7 +85,7 @@
</tr>
</table>
<font size="-1"><a href="#"></a><br>&#169; ircquotes 2024, All Rights Reserved.</font>
<font size="-1"><a href="#"></a><br>@ ircquotes 2024-2025</font>
</center>
</body>

View File

@@ -93,7 +93,7 @@
</tr>
</table>
<font size="-1">&#169; ircquotes 2024, All Rights Reserved.</font>
<font size="-1">@ ircquotes 2024-2025</font>
</center>
</body>

View File

@@ -16,6 +16,7 @@
})();
</script>
<script src="{{ url_for('static', filename='theme.js') }}"></script>
<script src="{{ url_for('static', filename='modapp.js') }}"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#c08000" vlink="#c08000" alink="#c08000">
@@ -125,7 +126,15 @@
0
{% endif %}
</td>
<td class="mobile-hide">{{ quote.submitted_at.strftime('%Y-%m-%d %H:%M:%S') if quote.submitted_at else 'N/A' }}</td>
<td class="mobile-hide">
{% if quote.submitted_at %}
{{ quote.submitted_at.strftime('%d/%m/%y %H:%M:%S') }}
{% elif quote.date %}
{{ quote.date.strftime('%d/%m/%y') }} (legacy)
{% else %}
No date
{% endif %}
</td>
<td class="mobile-hide">{{ quote.ip_address|e }}</td>
<td class="mobile-hide">{{ quote.user_agent|e|truncate(50) }}</td>
<td>

View File

@@ -68,6 +68,14 @@
<a href="#" onclick="return flag({{ quote.id }}, this)" class="qa">X</a>
&nbsp;
<a href="#" onclick="return copyQuote({{ quote.id }}, this)" class="qa" title="Copy quote to clipboard">C</a>
&nbsp;
<span style="color: #666; font-size: 0.9em;">
{% if quote.submitted_at %}
{{ quote.submitted_at.strftime('%d/%m/%y %H:%M') }}
{% elif quote.date %}
{{ quote.date.strftime('%d/%m/%y') }}
{% endif %}
</span>
</p>
<p class="qt">{{ quote.text|e }}</p>
@@ -95,7 +103,7 @@
</table>
<font size="-1">
&#169; ircquotes 2024, All Rights Reserved.
@ ircquotes 2024-2025
</font>
</center>

View File

@@ -64,6 +64,14 @@
<a href="#" onclick="return flag({{ quote.id }}, this)" class="qa">X</a>
&nbsp;
<a href="#" onclick="return copyQuote({{ quote.id }}, this)" class="qa" title="Copy quote to clipboard">C</a>
&nbsp;
<span style="color: #666; font-size: 0.9em;">
{% if quote.submitted_at %}
{{ quote.submitted_at.strftime('%d/%m/%y %H:%M') }}
{% elif quote.date %}
{{ quote.date.strftime('%d/%m/%y') }}
{% endif %}
</span>
</p>
<p class="qt">{{ quote.text|e }}</p>
</td>
@@ -91,7 +99,7 @@
</table>
<font size="-1">
&#169; ircquotes 2024, All Rights Reserved.
@ ircquotes 2024-2025
</font>
</center>

View File

@@ -94,6 +94,14 @@
<a href="#" onclick="return flag({{ quote.id }}, this)" class="qa">X</a>
&nbsp;
<a href="#" onclick="return copyQuote({{ quote.id }}, this)" class="qa" title="Copy quote to clipboard">C</a>
&nbsp;
<span style="color: #666; font-size: 0.9em;">
{% if quote.submitted_at %}
{{ quote.submitted_at.strftime('%d/%m/%y %H:%M') }}
{% elif quote.date %}
{{ quote.date.strftime('%d/%m/%y') }}
{% endif %}
</span>
</p>
<p class="qt">{{ quote.text|e }}</p>
<hr>
@@ -129,7 +137,7 @@
<font size="-1">
<a href="#">Hosted by YourHostingProvider</a><br>
&#169; ircquotes 2024, All Rights Reserved.
@ ircquotes 2024-2025
</font>
</center>

View File

@@ -17,7 +17,7 @@
</script>
<script src="{{ url_for('static', filename='theme.js') }}"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#c08000" vlink="#c08000" alink="#c08000" onload="document.add.newquote.focus();">
<body bgcolor="#ffffff" text="#000000" link="#c08000" vlink="#c08000" alink="#c08000" onload="document.add.quote.focus();">
<center>
<!-- Header -->
<table cellpadding="2" cellspacing="0" width="80%" border="0">
@@ -54,8 +54,20 @@
<form action="/submit" name="add" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<table cellpadding="2" cellspacing="0" width="60%">
{% if preview_text %}
<!-- Preview Section -->
<tr>
<td><textarea cols="100%" rows="10" name="quote" class="text"></textarea></td>
<td>
<h3>Quote Preview:</h3>
<div style="border: 1px solid #ccc; padding: 10px; margin: 10px 0; background-color: #f9f9f9;">
<pre style="white-space: pre-wrap; font-family: monospace;">{{ preview_text }}</pre>
</div>
<p><strong>If this looks correct, click "Submit Quote" below. Otherwise, edit your quote and preview again.</strong></p>
</td>
</tr>
{% endif %}
<tr>
<td><textarea cols="100%" rows="10" name="quote" class="text">{{ original_text or '' }}</textarea></td>
</tr>
<tr>
<td><input type="checkbox" name="strip" checked> Automatically attempt to fix timestamps and common mistakes.</td>
@@ -71,7 +83,7 @@
<td>
<br><br>
You may submit quotes from any chat medium, so long as they have reasonable
formatting (IRC, AIM, ICQ, Yahoo, NOT MSN or MS Chat).<br><br>
formatting (IRC, etc.).<br><br>
Tips for approval: no timestamps, keep it short (trim useless parts), remove trailing laughs, and avoid inside jokes.
</td>
</tr>
@@ -91,7 +103,7 @@
</table>
<font size="-1">
&#169; ircquotes 2024, All Rights Reserved.
@ ircquotes 2024-2025
</font>
</center>
</body>