township: fix 404 after match delete behind reverse-proxy mount

The post-delete redirect used `(window.ROOT_PATH||'') + '/matches'`, but
window.ROOT_PATH was never defined, so behind the nginx /township mount it
redirected to the bare /matches — which hits the coderai front, not the township
tool → 404. The mount shim wraps fetch()/EventSource() to add the prefix but not
location.href assignments. Define window.ROOT_PATH=P in the shim so the redirect
(and any future ROOT_PATH use) resolves to /township/matches; with no prefix
(direct access) it stays unset and the bare /matches path is correct.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
parent 2fae0beb
......@@ -4738,6 +4738,7 @@ def _mount_html(html: str, prefix: str) -> str:
return html
shim = (
"<script>/*coderai-mount*/(function(){var P=" + repr(prefix) + ";if(!P)return;"
"window.ROOT_PATH=P;"
"function fix(u){return (typeof u==='string'&&u.charAt(0)==='/'"
"&&u.charAt(1)!=='/'&&u.indexOf(P+'/')!==0&&u!==P)?P+u:u;}"
"var of=window.fetch.bind(window);window.fetch=function(u,o){return of(fix(u),o);};"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment