bep40 commited on
Commit
c250c97
·
verified ·
1 Parent(s): 98a5a21

Wrapper to inject extra CSS/JS fixes after main patch"

Browse files
Files changed (1) hide show
  1. app_entry.py +17 -0
app_entry.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Wrapper: load main patch then inject extra fixes for tiktok-right position, kill duplicate slides, progress toast."""
2
+ from ai_runtime_patch_fast import *
3
+ from ai_runtime_patch_fast import app, f5, f6, rt, PATCH_INJECT
4
+ from patch_extra import EXTRA_FIX
5
+ from fastapi.responses import HTMLResponse
6
+
7
+ # Remove old root and re-register with EXTRA_FIX appended.
8
+ app.router.routes=[r for r in app.router.routes if not (getattr(r,'path',None)=='/' and 'GET' in getattr(r,'methods',set()))]
9
+
10
+ @app.get('/')
11
+ async def _index_final():
12
+ html=f5.f4.f3.f2.f1._load_index_html()
13
+ body=getattr(rt.old,'PATCH_INJECT','')+f5.f4.f3.f2.f1.FINAL_INJECT+f5.f4.f3.FINAL3_INJECT+f5.f4.FINAL4_INJECT+f5.FINAL5_INJECT
14
+ body+=getattr(f6,'FINAL6_INJECT','');body+=getattr(f6,'FINAL6_FAST_HOME_INJECT','');body+=getattr(f6,'FINAL6E_INJECT','')
15
+ body+=PATCH_INJECT
16
+ body+=EXTRA_FIX
17
+ return HTMLResponse(html.replace('</body>',body+'\n</body>') if '</body>' in html else html+body)