feat(learn): add standalone /learn pages backed by Page Data
Serve lightweight child/parent learning assistant pages at /learn without MindSpace injection, with a rebuild script and Portal static route. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
from pathlib import Path
|
||||
|
||||
p = Path("/Users/john/Project/Memind/server.mjs")
|
||||
text = p.read_text()
|
||||
if '"/learn"' in text and "public/learn" in text:
|
||||
print("ALREADY_PATCHED")
|
||||
raise SystemExit(0)
|
||||
|
||||
needle = """ app2.use(
|
||||
"/assets",
|
||||
staticMiddleware(
|
||||
pathApi.join(h5Root, "public/assets"),
|
||||
{ maxAge: "1d" }
|
||||
)
|
||||
);
|
||||
app2.get(
|
||||
"/dev/wechat-share-preview","""
|
||||
|
||||
insert = """ app2.use(
|
||||
"/assets",
|
||||
staticMiddleware(
|
||||
pathApi.join(h5Root, "public/assets"),
|
||||
{ maxAge: "1d" }
|
||||
)
|
||||
);
|
||||
app2.use(
|
||||
"/learn",
|
||||
staticMiddleware(
|
||||
pathApi.join(h5Root, "public/learn"),
|
||||
{ maxAge: "5m", index: "index.html" }
|
||||
)
|
||||
);
|
||||
app2.get(
|
||||
"/dev/wechat-share-preview","""
|
||||
|
||||
if needle not in text:
|
||||
print("NEEDLE_NOT_FOUND")
|
||||
raise SystemExit(1)
|
||||
|
||||
p.write_text(text.replace(needle, insert, 1))
|
||||
print("PATCHED_OK")
|
||||
Reference in New Issue
Block a user