Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Build wemini/src/data/localCatalog.ts from redmini offline data."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
from datetime import date, timedelta
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
raw = (ROOT / "redmini" / "src" / "data.js").read_text(encoding="utf-8")
|
|
m = re.search(r"window\.NOMADRO_DATA\s*=\s*(\{.*\})\s*;?\s*$", raw, re.S)
|
|
assert m, "NOMADRO_DATA not found"
|
|
data = json.loads(m.group(1))
|
|
|
|
base = date.today() + timedelta(days=3)
|
|
for i, meetup in enumerate(data["meetups"]):
|
|
meetup["date"] = (base + timedelta(days=i * 4)).isoformat()
|
|
meetup["is_upcoming"] = True
|
|
|
|
out = ROOT / "wemini" / "src" / "data" / "localCatalog.ts"
|
|
body = f"""/** Local catalog mirrored from redmini offline data — API fallback for WeChat review. */
|
|
import type {{ Destination, Meetup, Testimonial, Visa }} from '../services/api'
|
|
|
|
export const LOCAL_MEETUPS: Meetup[] = {json.dumps(data['meetups'], ensure_ascii=False, indent=2)}
|
|
|
|
export const LOCAL_DESTINATIONS: Destination[] = {json.dumps(data['destinations'], ensure_ascii=False, indent=2)}
|
|
|
|
export const LOCAL_VISAS: Visa[] = {json.dumps(data['visas'], ensure_ascii=False, indent=2)}
|
|
|
|
export const LOCAL_TESTIMONIALS: Testimonial[] = {json.dumps(data['testimonials'], ensure_ascii=False, indent=2)}
|
|
|
|
export const LOCAL_STATS = {json.dumps(data['stats'], ensure_ascii=False, indent=2)}
|
|
"""
|
|
out.write_text(body, encoding="utf-8")
|
|
print(f"wrote {out} ({out.stat().st_size} bytes) meetups={len(data['meetups'])}")
|