25 lines
871 B
Python
25 lines
871 B
Python
#!/usr/bin/env python3
|
|
"""Add /play route to SatsSpin server (serves the real casino app shell)."""
|
|
import io
|
|
|
|
P = "/opt/casino/server-prod-new.cjs"
|
|
src = io.open(P, encoding="utf-8").read()
|
|
|
|
old = 'app.get("/{*splat}", (req, res) => res.sendFile(path.join(DIST, "index.html")));'
|
|
new = ('app.get("/play", (req, res) => res.sendFile(path.join(DIST, "app.html")));\n'
|
|
+ old)
|
|
assert old in src, "catch-all route not found"
|
|
if 'app.get("/play"' not in src:
|
|
src = src.replace(old, new, 1)
|
|
io.open(P, "w", encoding="utf-8").write(src)
|
|
print("PATCHED")
|
|
else:
|
|
print("ALREADY PATCHED")
|
|
|
|
# also fix the app shell title
|
|
A = "/opt/casino/dist/app.html"
|
|
app = io.open(A, encoding="utf-8").read()
|
|
app = app.replace("<title>My Google AI Studio App</title>", "<title>SatsSpin — Casino</title>")
|
|
io.open(A, "w", encoding="utf-8").write(app)
|
|
print("TITLE FIXED")
|