brand: rename product to "Read the Markets" (read.markets)
The product is now "Read the Markets" served at https://read.markets, with the app at https://app.read.markets. "Cassandra" survives only as the in-product AI persona (system prompt + "Ask Cassandra" chat label). Centralised the brand in app/branding.py: BRAND_NAME, BRAND_SHORT, DOMAIN, SITE_URL, APP_URL, EMAIL_FROM_DEFAULT. Jinja templates pull {{ BRAND_NAME }} via globals registered in templates_env.py; Python code reads branding.BRAND_NAME directly. The future-rename surface is now a one-liner. Updated: FastAPI app title, every page title (dashboard, news, log, settings, upload, login, verify), header brand div, auth-card brands, OTP email subject + HTML + plain-text bodies (incl. uppercase header tag), OpenRouter X-Title + HTTP-Referer attribution headers, README. Email tests now assert against branding.BRAND_NAME rather than the literal string. Internal identifiers deliberately kept on the legacy "cassandra" name to avoid invalidating live sessions / advisory locks / configs: cookies (cassandra_session, cassandra_pending) + itsdangerous salts, MariaDB GET_LOCK keys, CASSANDRA_TOKEN env var, cassandra.css filename, pyproject package name, localStorage prefs, outbound User-Agent strings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9759080134
commit
824d849c63
15 changed files with 82 additions and 39 deletions
|
|
@ -44,7 +44,7 @@ async def send_email(
|
|||
"""Send a (potentially multipart) email. `text_body` is required —
|
||||
it's the fallback for clients that can't or won't render HTML."""
|
||||
s = get_settings()
|
||||
sender = s.SMTP_FROM or s.SMTP_USER or "noreply@cassandra.local"
|
||||
sender = s.SMTP_FROM or s.SMTP_USER or branding.EMAIL_FROM_DEFAULT
|
||||
|
||||
msg = EmailMessage()
|
||||
msg["From"] = sender
|
||||
|
|
@ -91,7 +91,7 @@ _OTP_HTML_TEMPLATE = """\
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<meta name="supported-color-schemes" content="light dark">
|
||||
<title>Your Cassandra sign-in code</title>
|
||||
<title>Your {brand} sign-in code</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {{
|
||||
body {{ background:{D_bg} !important; }}
|
||||
|
|
@ -111,12 +111,12 @@ _OTP_HTML_TEMPLATE = """\
|
|||
</head>
|
||||
<body style="margin:0; padding:24px 12px; background:{L_bg}; font-family:{FONT_MONO}; color:{L_text}; -webkit-font-smoothing:antialiased;">
|
||||
<div style="display:none; max-height:0; overflow:hidden; mso-hide:all; font-size:1px; line-height:1px; color:{L_bg};">
|
||||
Your Cassandra sign-in code — {code} — expires in {ttl_minutes} minutes.
|
||||
Your {brand} sign-in code — {code} — expires in {ttl_minutes} minutes.
|
||||
</div>
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="max-width:520px; margin:0 auto; border-collapse:separate;">
|
||||
<tr><td class="card" style="background:{L_surface}; border:1px solid {L_border}; padding:32px 28px;">
|
||||
<div class="muted" style="font-size:11px; letter-spacing:0.32em; color:{L_muted}; text-transform:uppercase;">
|
||||
▰ CASSANDRA
|
||||
▰ {brand_upper}
|
||||
</div>
|
||||
<div style="height:22px; line-height:22px; font-size:0;"> </div>
|
||||
<div class="h1" style="font-size:17px; font-weight:normal; color:{L_text}; letter-spacing:0.02em;">
|
||||
|
|
@ -136,7 +136,7 @@ _OTP_HTML_TEMPLATE = """\
|
|||
<div class="divider" style="border-top:1px solid {L_border};"></div>
|
||||
<div style="height:14px; line-height:14px; font-size:0;"> </div>
|
||||
<div class="muted" style="font-size:10.5px; color:{L_dim}; letter-spacing:0.06em;">
|
||||
Sent automatically by Cassandra · do not reply
|
||||
Sent automatically by {brand} · do not reply
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
|
@ -150,6 +150,8 @@ def _html_template_filled(code: str, ttl_minutes: int) -> str:
|
|||
return _OTP_HTML_TEMPLATE.format(
|
||||
code=code,
|
||||
ttl_minutes=ttl_minutes,
|
||||
brand=branding.BRAND_NAME,
|
||||
brand_upper=branding.BRAND_NAME.upper(),
|
||||
FONT_MONO=branding.FONT_MONO,
|
||||
**{f"L_{k.replace('-', '_')}": v for k, v in branding.LIGHT.items()},
|
||||
**{f"D_{k.replace('-', '_')}": v for k, v in branding.DARK.items()},
|
||||
|
|
@ -157,7 +159,7 @@ def _html_template_filled(code: str, ttl_minutes: int) -> str:
|
|||
|
||||
|
||||
_OTP_TEXT_TEMPLATE = """\
|
||||
CASSANDRA — sign in
|
||||
{brand_upper} — sign in
|
||||
|
||||
Your verification code:
|
||||
|
||||
|
|
@ -168,7 +170,7 @@ If you didn't request it, you can safely ignore this email — no changes
|
|||
will be made to any account.
|
||||
|
||||
—
|
||||
Sent automatically by Cassandra · do not reply
|
||||
Sent automatically by {brand} · do not reply
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -180,8 +182,13 @@ def render_otp_email(code: str, ttl_minutes: int) -> tuple[str, str, str]:
|
|||
(Notion, Substack). The lock-screen exposure tradeoff is minimal:
|
||||
anyone with phone access who could see the notification could also
|
||||
open the email."""
|
||||
subject = f"Cassandra sign-in: {code}"
|
||||
text = _OTP_TEXT_TEMPLATE.format(code=code, ttl_minutes=ttl_minutes)
|
||||
subject = f"{branding.BRAND_NAME} sign-in: {code}"
|
||||
text = _OTP_TEXT_TEMPLATE.format(
|
||||
code=code,
|
||||
ttl_minutes=ttl_minutes,
|
||||
brand=branding.BRAND_NAME,
|
||||
brand_upper=branding.BRAND_NAME.upper(),
|
||||
)
|
||||
html = _html_template_filled(code=code, ttl_minutes=ttl_minutes)
|
||||
return subject, text, html
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from datetime import datetime, timedelta, timezone
|
|||
import httpx
|
||||
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_exponential
|
||||
|
||||
from app import branding
|
||||
from app.config import get_settings
|
||||
|
||||
|
||||
|
|
@ -521,9 +522,10 @@ def _endpoint_for(provider: str) -> tuple[str, str, str, dict[str, str]]:
|
|||
s.OPENROUTER_API_KEY,
|
||||
s.OPENROUTER_MODEL,
|
||||
{
|
||||
# OpenRouter-specific attribution headers.
|
||||
"HTTP-Referer": "https://github.com/local/cassandra",
|
||||
"X-Title": "Cassandra",
|
||||
# OpenRouter-specific attribution headers. Visible on the
|
||||
# OpenRouter dashboard — keep aligned with the live brand.
|
||||
"HTTP-Referer": branding.SITE_URL,
|
||||
"X-Title": branding.BRAND_NAME,
|
||||
},
|
||||
)
|
||||
raise RuntimeError(f"Unknown LLM provider: {provider!r}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue