Snapshot: full project state
This commit is contained in:
23
fix_shim_var.py
Normal file
23
fix_shim_var.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fix SatsSpin shim: second fetch wrapper must use its own captured ref."""
|
||||
import io
|
||||
|
||||
P = "/opt/casino/dist/shim.js"
|
||||
src = io.open(P, encoding="utf-8").read()
|
||||
|
||||
old1 = " // Store token when create/login response hits\n _fetch = window.fetch;"
|
||||
new1 = " // Store token when create/login response hits\n var _fetch2 = window.fetch;"
|
||||
assert old1 in src, "second wrapper assignment not found"
|
||||
src = src.replace(old1, new1, 1)
|
||||
|
||||
old2 = "return _fetch.call(this, url, opts)"
|
||||
assert src.count(old2) == 1, f"expected 1 _fetch.call, found {src.count(old2)}"
|
||||
src = src.replace(old2, "return _fetch2.call(this, url, opts)", 1)
|
||||
|
||||
io.open(P, "w", encoding="utf-8").write(src)
|
||||
|
||||
A = "/opt/casino/dist/app.html"
|
||||
app = io.open(A, encoding="utf-8").read()
|
||||
app = app.replace('shim.js?v=2', 'shim.js?v=3')
|
||||
io.open(A, "w", encoding="utf-8").write(app)
|
||||
print("SECOND WRAPPER FIXED + v=3")
|
||||
Reference in New Issue
Block a user