Skip to content

Sites images#186

Merged
brianorwhatever merged 6 commits into
mainfrom
sites-images
May 23, 2026
Merged

Sites images#186
brianorwhatever merged 6 commits into
mainfrom
sites-images

Conversation

@brianorwhatever
Copy link
Copy Markdown
Contributor

No description provided.

brianorwhatever and others added 6 commits May 14, 2026 22:04
Renames the `siteImages` table to `siteAssets` so a site can carry sub-pages,
stylesheets, scripts, and fonts alongside images. Public URL stays at
`/_assets/<filename>` on each site host. Allowed content types now include
text/html, text/css, application/javascript, application/json, text/plain,
application/wasm, woff/woff2 — plus the existing image types.

- schema: `siteImages` → `siteAssets`, drops unused `kind` field
- convex: siteImages.ts → siteAssets.ts; functions renamed accordingly
- http route: /api/sites/resolve-image → /resolve-asset
- server.ts: resolveSiteImageUrl → resolveSiteAssetUrl; path unchanged
- UI: SiteImages → SiteAssets with type-aware icons; copy says "Files"
- inspectSiteImages dev helper dropped along with the table

Greenfield rename — no data migration needed since the only existing rows
were test uploads on this branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	convex/_generated/api.d.ts
#	convex/dev.ts
#	convex/http.ts
#	convex/schema.ts
#	convex/sitesHttp.ts
#	server.ts
#	src/pages/SiteDetail.tsx
Browser uploads via presigned PUT need CORS on the Railway Bucket
(allowed any origin, PUT/GET/HEAD). Adds a one-shot script to apply
the CORSConfiguration and corrects the .env.example endpoint hint to
match Railway's actual hostname pattern (t3.storageapi.dev).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Server-side capture for the bucket-served traffic on Railway. Two events:

- site_view — fired on every successful HTML serve at /
- site_asset_view — fired on every successful /_assets/<filename> resolve

Properties include site_id, site_hostname, site_did, site_scid, content_type,
referrer, IP and user-agent. Distinct id is hash(ip + ua + utc-day) so the
same visitor is stable across one day with no cross-day linkage.

Convex's resolveSiteAsset now returns siteId alongside the presigned URL so
the server can include it in the event. No app-side tracking changes — the
existing posthog-js stays in charge of user-attributed events.

Reads POSTHOG_KEY / POSTHOG_HOST with VITE_POSTHOG_* fallback. No-ops when
unconfigured. Errors are swallowed; events never block the response.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@brianorwhatever brianorwhatever merged commit d0bf17d into main May 23, 2026
0 of 2 checks passed
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