compression added
This commit is contained in:
@@ -27,9 +27,16 @@ PORT = CONFIG.get("port", 3232)
|
||||
CLIENTS = CONFIG.get("clients", {})
|
||||
|
||||
# Absolute, resolved base directories for each client key, computed once at
|
||||
# startup. Every request is checked against these to make sure the final
|
||||
# path can never land outside the intended client folder.
|
||||
CLIENT_BASE_DIRS = {key: os.path.realpath(folder) for key, folder in CLIENTS.items()}
|
||||
# startup. Relative folder paths in config.json are resolved relative to
|
||||
# this script's own location, not the process's current working directory,
|
||||
# so `python server.py` works the same regardless of where it's launched
|
||||
# from. Every request is checked against these to make sure the final path
|
||||
# can never land outside the intended client folder.
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
CLIENT_BASE_DIRS = {
|
||||
key: os.path.realpath(os.path.join(SCRIPT_DIR, folder))
|
||||
for key, folder in CLIENTS.items()
|
||||
}
|
||||
|
||||
# A path that is guaranteed not to exist, used to force a 404 through the
|
||||
# normal http.server flow instead of ever falling back to serving files
|
||||
|
||||
Reference in New Issue
Block a user