web-in-python-lol 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/Engine/core.py +14 -2
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/Engine/setup.py +4 -1
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/PKG-INFO +1 -1
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/pyproject.toml +1 -1
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/PKG-INFO +1 -1
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/Engine/__init__.py +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/LICENSE +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/README.md +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/setup.cfg +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/SOURCES.txt +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/dependency_links.txt +0 -0
- {web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/top_level.txt +0 -0
|
@@ -48,13 +48,25 @@ class ShadowEngine(BaseHTTPRequestHandler):
|
|
|
48
48
|
self.send_response(303); self.send_header('Location', self.headers.get('Referer', '/')); self.end_headers()
|
|
49
49
|
|
|
50
50
|
def handle_request(self):
|
|
51
|
+
# Get the Host (e.g., 'blog.lmcworld.com:8080' or 'localhost:8080')
|
|
52
|
+
host = self.headers.get('Host', '')
|
|
53
|
+
subdomain = host.split('.')[0] if '.' in host else 'www'
|
|
54
|
+
|
|
55
|
+
# Optional: If you are running locally (localhost), the split might catch 'localhost'
|
|
56
|
+
if 'localhost' in subdomain or '127.0.0.1' in subdomain:
|
|
57
|
+
subdomain = 'www'
|
|
58
|
+
|
|
51
59
|
func, args = self.find_route(urlparse(self.path).path)
|
|
52
60
|
params = {k: v[0] for k, v in parse_qs(urlparse(self.path).query).items()}
|
|
61
|
+
|
|
53
62
|
self.send_response(200); self.send_header("Content-type", "text/html"); self.end_headers()
|
|
63
|
+
|
|
54
64
|
try:
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
# Pass the detected subdomain into your page function
|
|
66
|
+
content = func(self.server.app_instance, params, subdomain, *args) if func else "<h1>404</h1>"
|
|
67
|
+
except Exception:
|
|
57
68
|
content = f"<pre style='color:red;'>{traceback.format_exc()}</pre>"
|
|
69
|
+
|
|
58
70
|
self.wfile.write(self.server.app_instance._wrap(content).encode())
|
|
59
71
|
|
|
60
72
|
def find_route(self, path):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{web_in_python_lol-0.2.0 → web_in_python_lol-0.2.1}/web_in_python_lol.egg-info/top_level.txt
RENAMED
|
File without changes
|