# Generated by ChatGPT-5 on October, 8, 2025.
import os
from wsgiref.util import FileWrapper
from urllib.parse import unquote
def application(environ, start_response):
"""Serve static HTML/CSS/JS files directly via uWSGI."""
root = os.path.dirname(__file__)
path = unquote(environ.get('PATH_INFO', '/'))
if path == '/' or path == '':
path = '/index.html'
full_path = os.path.join(root, path.lstrip('/'))
if not os.path.isfile(full_path):
start_response('404 Not Found', [('Content-Type', 'text/plain')])
return [b'404 Not Found']
if full_path.endswith('.html'):
content_type = 'text/html; charset=utf-8'
elif full_path.endswith('.css'):
content_type = 'text/css; charset=utf-8'
elif full_path.endswith('.js'):
content_type = 'application/javascript; charset=utf-8'
elif full_path.endswith('.svg'):
content_type = 'image/svg+xml'
else:
content_type = 'application/octet-stream'
start_response('200 OK', [('Content-Type', content_type)])
return FileWrapper(open(full_path, 'rb'))