# AGPL 3 or any later version # (C) J.Y.Amihud ( Blender Dumbass ) from http.server import BaseHTTPRequestHandler, HTTPServer from subprocess import * import json import os import time import random import datetime import hashlib import urllib.request import urllib.parse import subprocess import os from modules import Set from modules import Render from modules.Common import * class handler(BaseHTTPRequestHandler): def do_GET(self): self.path = self.path.replace("/..", "/") self.path = self.path.replace("%27", "'") if self.path == "/": Render.MainPage(self) elif self.path.startswith("/pictures/"): folder = Set.Folder() f = open(folder+self.path, "rb") f = f.read() Render.headers(self, 200) self.wfile.write(f) elif self.path == "/css": cssfile = open("default.css", "rb") cssfile = cssfile.read() Render.headers(self, 200) self.wfile.write(cssfile) config = Set.Load() PORT = config.get("port", 8080) serve = HTTPServer(("", PORT), handler) try: serve.serve_forever() except KeyboardInterrupt: print("\nServer Stopped!")