fix(URGENT): SPA fallback serves sport2.html + 9 routers __future__ position
BUGS FIXED:
1. _serve_spa_fallback() returned index.html instead of sport2.html
→ User clicked /analitika /sufinanciranje etc and got wrong UI (DABI title)
→ Should serve sport2.html (PGZ SPORT - Platforma) with Analiza/Mreza/Link tabs
2. 9 router files had "from __future__" NOT at top of file
→ SyntaxError on import → routers SKIPPED → intermittent API failures
→ Affected: ocr.py, ocr_router.py, putni_nalozi.py, obrasci_router.py,
clan_panel_router.py, audit_seal_router.py, erp_full_router.py,
notif_router.py, seal.py
ROOT CAUSE:
Prior dehardcode batch (Master Zakon #1 sweep) inserted env-loading
imports BEFORE "from __future__ import annotations" — Python parser
requires __future__ FIRST.
FIX:
- _serve_spa_fallback() candidates list: sport2.html first
- Moved __future__ to top (preserving shebang + encoding + comments) in all 9
VERIFIED:
- 0 failed routers (was 7+)
- Analiza API: 10/10 success ~60-87ms
- Summary API: 5/5 success ~40ms
- sport.rinet.one/ → PGZ SPORT - Platforma (Analiza+Mreza tabs)
- All 9 SPA fallback routes serve sport2.html
Damir uploaded screenshot showing Analiza tab working (2,049 igraca,
82 klubova) but described as intermittent — root cause was router fails
causing some API endpoints to be missing/unreliable. Fixed.
This commit is contained in:
+8
-2
@@ -3169,8 +3169,14 @@ _MISSING_TABS = ["sufinanciranje", "trezor", "dashboard", "analitika", "pravila"
|
||||
def _serve_spa_fallback():
|
||||
import os
|
||||
from fastapi.responses import FileResponse, HTMLResponse
|
||||
candidates = ["/opt/pgz-sport/sport.html", "/opt/pgz-sport/static/index.html",
|
||||
"/opt/pgz-sport/index.html"]
|
||||
# sport.rinet.one main UI is sport2.html (has Analiza, Mreza, Link Analiza tabs)
|
||||
candidates = [
|
||||
"/opt/pgz-sport/static/sport2.html",
|
||||
"/opt/pgz-sport/sport2.html",
|
||||
"/opt/pgz-sport/sport.html",
|
||||
"/opt/pgz-sport/static/index.html",
|
||||
"/opt/pgz-sport/index.html",
|
||||
]
|
||||
for c in candidates:
|
||||
if os.path.exists(c):
|
||||
return FileResponse(c)
|
||||
|
||||
Reference in New Issue
Block a user