glitchcraft/server.py
Ole-Morten Duesund 44a2ac4cbd Initial commit: Text Corruptor PWA
Features:
- Zalgo text generator with adjustable intensity (1-10)
- Real-time text corruption as you type
- Click-to-copy functionality with visual feedback
- Progressive Web App with offline support
- Responsive design for mobile and desktop
- Dark theme with glitch-inspired aesthetics

Technical implementation:
- Pure JavaScript implementation (no frameworks)
- Service Worker for offline functionality
- PWA manifest for installability
- Python development server
- Comprehensive linting setup (ESLint, Prettier, Black, Pylint)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 20:00:58 +02:00

39 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Simple HTTP server for testing the Text Corruptor PWA
Run with: python3 server.py
Then open http://localhost:8000/ in your browser
"""
import http.server
import socketserver
import os
PORT = 8000
# Serve from the app directory
DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__)), "app")
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
"""Custom HTTP request handler for serving the Text Corruptor PWA."""
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
def end_headers(self):
# Add headers for PWA and CORS
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
self.send_header("Service-Worker-Allowed", "/")
self.send_header("X-Content-Type-Options", "nosniff")
super().end_headers()
if __name__ == "__main__":
with socketserver.TCPServer(("", PORT), MyHTTPRequestHandler) as httpd:
print(f"Server running at http://localhost:{PORT}/")
print(f"Serving files from: {DIRECTORY}")
print("Press Ctrl+C to stop the server")
try:
httpd.serve_forever()
except KeyboardInterrupt:
print("\nServer stopped.")