dmart 1.4.41.post37__py3-none-any.whl → 1.4.41.post38__py3-none-any.whl
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.
- dmart/main.py +21 -2
- {dmart-1.4.41.post37.dist-info → dmart-1.4.41.post38.dist-info}/METADATA +1 -1
- {dmart-1.4.41.post37.dist-info → dmart-1.4.41.post38.dist-info}/RECORD +6 -6
- {dmart-1.4.41.post37.dist-info → dmart-1.4.41.post38.dist-info}/WHEEL +0 -0
- {dmart-1.4.41.post37.dist-info → dmart-1.4.41.post38.dist-info}/entry_points.txt +0 -0
- {dmart-1.4.41.post37.dist-info → dmart-1.4.41.post38.dist-info}/top_level.txt +0 -0
dmart/main.py
CHANGED
|
@@ -46,16 +46,35 @@ from pathlib import Path
|
|
|
46
46
|
|
|
47
47
|
class SPAStaticFiles(StaticFiles):
|
|
48
48
|
async def get_response(self, path: str, scope) -> Response:
|
|
49
|
+
if path == "" or path == "index.html":
|
|
50
|
+
return await self.serve_index()
|
|
51
|
+
|
|
49
52
|
try:
|
|
50
53
|
return await super().get_response(path, scope)
|
|
51
54
|
except StarletteHTTPException as ex:
|
|
52
55
|
if ex.status_code == 404 and path != "index.html" and not os.path.splitext(path)[1]:
|
|
53
56
|
try:
|
|
54
|
-
return await
|
|
55
|
-
except
|
|
57
|
+
return await self.serve_index()
|
|
58
|
+
except Exception:
|
|
56
59
|
pass
|
|
57
60
|
raise ex
|
|
58
61
|
|
|
62
|
+
async def serve_index(self):
|
|
63
|
+
index_path = os.path.join(self.directory, "index.html")
|
|
64
|
+
if not os.path.exists(index_path):
|
|
65
|
+
raise StarletteHTTPException(status_code=404)
|
|
66
|
+
|
|
67
|
+
with open(index_path, "r") as f:
|
|
68
|
+
content = f.read()
|
|
69
|
+
|
|
70
|
+
target_url = settings.cxb_url
|
|
71
|
+
if not target_url.endswith("/"):
|
|
72
|
+
target_url += "/"
|
|
73
|
+
|
|
74
|
+
content = content.replace("/cxb/", target_url)
|
|
75
|
+
|
|
76
|
+
return Response(content, media_type="text/html")
|
|
77
|
+
|
|
59
78
|
|
|
60
79
|
@asynccontextmanager
|
|
61
80
|
async def lifespan(app: FastAPI):
|
|
@@ -14,7 +14,7 @@ dmart/hypercorn_config.toml,sha256=-eryppEG8HBOM_KbFc4dTQePnpyfoW9ZG5aUATU_6yM,5
|
|
|
14
14
|
dmart/info.json,sha256=1VYb3TIoWeUp8-9IPkNkfqHIb3znxlrd8qa7oBl3_No,123
|
|
15
15
|
dmart/login_creds.sh,sha256=Aht1LwL11uzR13sa8p3BdeUCprIa9tq0vzOoplJjH5U,235
|
|
16
16
|
dmart/login_creds.sh.sample,sha256=Sb43HNNn1g11rrJrtDsPgAxcXu3_wJvdNn--8S62dTE,227
|
|
17
|
-
dmart/main.py,sha256=
|
|
17
|
+
dmart/main.py,sha256=JyU2UEEoo4H_ag81m1zMJi1elAlzNZLLKDEvtmPcPHc,20719
|
|
18
18
|
dmart/manifest.sh,sha256=K3mY5MsUlrTyHa5cARslkShegvXh-UeqJcE2UZobdrE,544
|
|
19
19
|
dmart/migrate.py,sha256=hn1MZoVby_Jjqhc7y3CrLcGD619QmVZv3PONNvO7VKQ,665
|
|
20
20
|
dmart/password_gen.py,sha256=xjx8wi105ZYvhLBBQj7_rugACpxifGXHse6f7YlGXWQ,196
|
|
@@ -483,8 +483,8 @@ dmart/utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGV
|
|
|
483
483
|
dmart/utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
|
|
484
484
|
dmart/utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
|
|
485
485
|
dmart/utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
|
|
486
|
-
dmart-1.4.41.
|
|
487
|
-
dmart-1.4.41.
|
|
488
|
-
dmart-1.4.41.
|
|
489
|
-
dmart-1.4.41.
|
|
490
|
-
dmart-1.4.41.
|
|
486
|
+
dmart-1.4.41.post38.dist-info/METADATA,sha256=yeMaKBEPAL2egk8-U7R4GgIxQLl4sTt7KQh6MgtWbNA,839
|
|
487
|
+
dmart-1.4.41.post38.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
488
|
+
dmart-1.4.41.post38.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
|
|
489
|
+
dmart-1.4.41.post38.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
|
|
490
|
+
dmart-1.4.41.post38.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|