APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
95641a8ac8
commit
1f8f295950
9 files changed
+2445
-292
No files matched your search
@@ -9868,6 +9868,30 @@ class Handler(BaseHTTPRequestHandler):
|
||||
except OSError: pass
|
||||
self.send_error(404, 'Fichier de thème introuvable')
|
||||
return
|
||||
if self.path.startswith('/jeux/'):
|
||||
clean_name = os.path.basename(urllib.parse.urlparse(self.path).path)
|
||||
game_path = os.path.join(os.path.dirname(__file__), 'jeux', clean_name)
|
||||
ext = os.path.splitext(clean_name)[1].lower()
|
||||
mime_map = {
|
||||
'.html': 'text/html; charset=utf-8',
|
||||
'.js': 'application/javascript; charset=utf-8',
|
||||
'.css': 'text/css; charset=utf-8',
|
||||
'.png': 'image/png',
|
||||
'.svg': 'image/svg+xml',
|
||||
'.ico': 'image/x-icon'
|
||||
}
|
||||
if os.path.isfile(game_path) and ext in mime_map:
|
||||
try:
|
||||
body = open(game_path, 'rb').read()
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', mime_map[ext])
|
||||
self.send_header('Content-Length', str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
return
|
||||
except OSError: pass
|
||||
self.send_error(404, 'Jeu introuvable')
|
||||
return
|
||||
if self.path == '/favicon.png' or self.path.startswith('/images/'):
|
||||
clean_name = 'favicon.png' if self.path == '/favicon.png' else os.path.basename(urllib.parse.urlparse(self.path).path)
|
||||
img_path = os.path.join(os.path.dirname(__file__), 'images', clean_name)
|
||||
|
||||
Reference in new issue
Block a user