Skip to content

feat(variants): wire energy.worldmonitor.app subdomain (gaps #9-11)#3394

Merged
koala73 merged 1 commit into
mainfrom
feat/energy-subdomain
Apr 25, 2026
Merged

feat(variants): wire energy.worldmonitor.app subdomain (gaps #9-11)#3394
koala73 merged 1 commit into
mainfrom
feat/energy-subdomain

Conversation

@koala73

@koala73 koala73 commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Summary

DNS (Cloudflare) and Vercel domain are already provisioned by the operator. This lands the matching code-side wiring so `energy.worldmonitor.app` actually resolves and renders the Energy Atlas variant correctly.

Changes

What's NOT touched

  • `src/services/runtime.ts:212-220` (APP_HOSTS) — line 226 already admits any `*.worldmonitor.app` via `endsWith`, so no edit needed.
  • `src/config/variant-meta.ts:130-152` — `energy` entry already shipped previously.
  • `src/app/panel-layout.ts:471` — variant switcher link already shipped previously.

Closes

Gaps §L #9, #10, #11 from `docs/internal/energy-atlas-registry-expansion.md`.

Test plan

DNS (Cloudflare) and the Vercel domain are already provisioned by the
operator; this lands the matching code-side wiring so the variant
actually resolves and renders correctly.

Changes:

middleware.ts
- Add `'energy.worldmonitor.app': 'energy'` to VARIANT_HOST_MAP. This
  also auto-includes the host in ALLOWED_HOSTS via the spread on
  line 87.
- Add `energy` entry to VARIANT_OG with the Energy-Atlas-specific
  title + description from `src/config/variant-meta.ts:130-152`. OG
  image points at `https://energy.worldmonitor.app/favico/energy/og-image.png`,
  matching the per-variant convention used by tech / finance /
  commodity / happy.

vercel.json
- Add `https://energy.worldmonitor.app` to BOTH `frame-src` and
  `frame-ancestors` in the global Content-Security-Policy header.
  Without this, the variant subdomain would render but be blocked
  from being framed back into worldmonitor.app for any embedded
  flow (Slack/LinkedIn previews, future iframe widgets, etc.).
  This supersedes the CSP-only portion of PR #3359 (which mixed
  CSP with unrelated relay/military changes).

convex/payments/checkout.ts:108-117
- Add `https://energy.worldmonitor.app` to the checkout returnUrl
  allowlist. Without this, a PRO upgrade flow initiated from the
  energy subdomain would fail with "Invalid returnUrl" on Convex.

src-tauri/tauri.conf.json:32
- Add `https://energy.worldmonitor.app` to the Tauri desktop CSP
  frame-src so the desktop app can embed the variant the same way
  it embeds the other 4.

public/favico/energy/* (NEW, 7 files)
- Stub the per-variant favicon directory by copying the root-level
  WorldMonitor brand assets (android-chrome 192/512, apple-touch,
  favicon 16/32/ico, og-image). This keeps the launch unblocked
  on design assets — every referenced URL resolves with valid
  bytes from day one. Replace with energy-themed designs in a
  follow-up PR; the file paths are stable.

Other variant subdomains already on main (tech / finance / commodity /
happy) are unchanged. APP_HOSTS in src/services/runtime.ts already
admits any `*.worldmonitor.app` via `host.endsWith('.worldmonitor.app')`
on line 226, so no edit needed there.

Closes gaps §L #9, #10, #11 in
docs/internal/energy-atlas-registry-expansion.md.
@vercel

vercel Bot commented Apr 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
worldmonitor Ignored Ignored Apr 25, 2026 10:14am

Request Review

@greptile-apps

greptile-apps Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR wires energy.worldmonitor.app into all the code-side allowlists and CSP configurations needed to make the already-provisioned DNS/Vercel domain functional. The changes are a mechanical, consistent extension of the existing variant pattern across middleware.ts, vercel.json, convex/payments/checkout.ts, src-tauri/tauri.conf.json, and a set of stub favicon assets.

Confidence Score: 4/5

Safe to merge; the only finding is a minor documentation gap in AGENTS.md.

All code changes follow the established variant-wiring pattern exactly, with no logic changes. The single P2 finding (AGENTS.md missing the energy variant) doesn't affect runtime behaviour. P2-only → 4/5.

AGENTS.md — Variant System list should include energy to stay accurate for contributors and agents.

Important Files Changed

Filename Overview
middleware.ts Adds energy.worldmonitor.app to VARIANT_HOST_MAP and VARIANT_OG; ALLOWED_HOSTS auto-includes it via the existing spread — clean and consistent with existing variants.
convex/payments/checkout.ts Adds energy.worldmonitor.app to the returnUrl allowlist; follows the same pattern as all other variant subdomains.
vercel.json Adds energy subdomain to CSP frame-src and frame-ancestors; consistent with all other variant subdomains.
src-tauri/tauri.conf.json Adds energy subdomain to Tauri desktop CSP frame-src for embedding parity; correctly placed alongside other variant subdomains.
public/favico/energy/og-image.png Stub favicon assets copied from existing brand; paths are stable and all OG/favicon URLs referenced in middleware now resolve.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Request to energy.worldmonitor.app] --> B{middleware.ts\nVARIANT_HOST_MAP}
    B -- energy variant --> C{Social bot UA?}
    C -- yes --> D[Return OG HTML\nfrom VARIANT_OG]
    C -- no --> E{/api/* or /favico/*?}
    E -- no --> F[Pass through\nto Next.js / Vercel]
    E -- yes --> G{Bot UA check}
    G -- blocked --> H[403 Forbidden]
    G -- allowed --> F
    F --> I[energy.worldmonitor.app\nUI Rendered]
    I --> J{PRO upgrade flow}
    J --> K[convex/payments/checkout.ts\nallowedOrigins includes energy]
    K --> L[Dodo Payments checkout\nreturn_url validated]
Loading

Comments Outside Diff (1)

  1. AGENTS.md, line 104-112 (link)

    P2 Variant System section missing energy

    The Variant System block in AGENTS.md lists full, tech, finance, commodity, happy but omits energy. Since AGENTS.md is the declared entry-point for agent/contributor onboarding, any developer (or AI agent) relying on that section to enumerate variants will miss the new subdomain. The variant config at src/config/variants/energy.ts and the middleware wiring land in this PR, so this doc is now visibly stale.

    Context Used: AGENTS.md (source)

Reviews (1): Last reviewed commit: "feat(variants): wire energy.worldmonitor..." | Re-trigger Greptile

@koala73
koala73 merged commit 0500733 into main Apr 25, 2026
11 checks passed
@koala73
koala73 deleted the feat/energy-subdomain branch April 25, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant