Skip to content

Commit f3ac04c

Browse files
committed
wip
1 parent 0d1e830 commit f3ac04c

54 files changed

Lines changed: 3118 additions & 278 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"window.title": "MC Frontend${separator}${separator}${rootName}${separator}${profileName}",
23
"files.watcherExclude": {
34
"**/target": true
45
},
@@ -69,5 +70,14 @@
6970
"apps/nettango": true
7071
},
7172

72-
"cSpell.words": ["autogen", "iconify", "netlogo", "Nuxt", "Pathnames", "reka", "vueuse"]
73+
"cSpell.words": [
74+
"autogen",
75+
"cooldown",
76+
"iconify",
77+
"netlogo",
78+
"Nuxt",
79+
"Pathnames",
80+
"reka",
81+
"vueuse"
82+
]
7383
}

apps/modeling-commons-backend/doc/model-statistics-plan.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ model ModelInteraction {
4242
ipHash String? // sha256(ip + daily salt) — NOT raw IP (PII)
4343
userAgent String? // truncated
4444
referer String?
45+
geo Json? // e.g. { country: 'US', region: 'CA', city: 'San Francisco' }
46+
cookie String? // single-browser, cross-session, cross-user, cross-IP dedupe key
47+
4548
createdAt DateTime @default(now()) @db.Timestamptz(3)
4649
4750
model Model @relation(fields: [modelId], references: [id], onDelete: Cascade)
@@ -92,7 +95,8 @@ One migration: the enum, both tables, new back-relations on `User` and `Model`.
9295
- `POST /v1/models/:id/runs`
9396
- `POST /v1/models/:id/downloads`
9497
- `POST /v1/models/:id/shares`
95-
98+
- `GET /v1/models/:id/interactions` -> `{ likes, views, runs, downloads, shares, likedByMe }`
99+
96100
Optional body `{ versionNumber?: number }`. Auth optional — do not require.
97101

98102
## Read path
@@ -106,7 +110,6 @@ WHERE "modelId" = $1 GROUP BY kind;
106110

107111
Plus like count and `likedByMe`. Acceptable for now.
108112

109-
For list endpoints (`GET /v1/models`), use subqueries per card. When slow, denormalize counters onto `Model` (maintained by service). Pre-beta / solo-authored — no premature denormalization.
110113

111114
## Shared infrastructure
112115

@@ -123,19 +126,28 @@ export function getClientIp(req: FastifyRequest): string {
123126
);
124127
}
125128

129+
export function generateUniqueId(): string {
130+
return crypto.randomBytes(16).toString('hex');
131+
}
132+
126133
export function getClientContext(req: FastifyRequest): ClientContext {
127134
return {
128135
userId: req.user?.id ?? null,
129136
sessionId: req.session?.id ?? null,
130137
ipHash: hashIp(getClientIp(req)),
131138
userAgent: (req.headers['user-agent'] ?? '').slice(0, 512),
132139
referer: (req.headers['referer'] ?? '').slice(0, 512),
140+
cookie: (req.cookies['_mc_uid'] ?? '').slice(0, 64),
133141
};
134142
}
143+
135144
```
136145

137146
Refactor `src/server/plugins/rate-limit.ts` to call `getClientIp`.
138147

148+
Add global middleware to send `_mc_uid` cookie if not present (generate random value, 1-year expiry).
149+
Enables cross-session dedup without login.
150+
139151
### IP hashing
140152

141153
`hashIp = sha256(ip + DAILY_SALT).slice(0, 32)` — daily salt rotation prevents cross-day correlation and reversal. Raw IPs are PII under GDPR/CCPA. Same-day uniqueness still computable. Matches Plausible / Fathom / anonymized Matomo.

apps/modeling-commons-backend/generated/prisma/edge.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/modeling-commons-backend/generated/prisma/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20429,7 +20429,7 @@ export namespace Prisma {
2042920429
}
2043020430

2043120431
export type PasskeyCreateInput = {
20432-
id: string
20432+
id?: string
2043320433
name?: string | null
2043420434
publicKey: string
2043520435
credentialID: string
@@ -20443,7 +20443,7 @@ export namespace Prisma {
2044320443
}
2044420444

2044520445
export type PasskeyUncheckedCreateInput = {
20446-
id: string
20446+
id?: string
2044720447
name?: string | null
2044820448
publicKey: string
2044920449
userId: string
@@ -20485,7 +20485,7 @@ export namespace Prisma {
2048520485
}
2048620486

2048720487
export type PasskeyCreateManyInput = {
20488-
id: string
20488+
id?: string
2048920489
name?: string | null
2049020490
publicKey: string
2049120491
userId: string
@@ -23725,7 +23725,7 @@ export namespace Prisma {
2372523725
}
2372623726

2372723727
export type PasskeyCreateWithoutUserInput = {
23728-
id: string
23728+
id?: string
2372923729
name?: string | null
2373023730
publicKey: string
2373123731
credentialID: string
@@ -23738,7 +23738,7 @@ export namespace Prisma {
2373823738
}
2373923739

2374023740
export type PasskeyUncheckedCreateWithoutUserInput = {
23741-
id: string
23741+
id?: string
2374223742
name?: string | null
2374323743
publicKey: string
2374423744
credentialID: string
@@ -26245,7 +26245,7 @@ export namespace Prisma {
2624526245
}
2624626246

2624726247
export type PasskeyCreateManyUserInput = {
26248-
id: string
26248+
id?: string
2624926249
name?: string | null
2625026250
publicKey: string
2625126251
credentialID: string

apps/modeling-commons-backend/generated/prisma/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/modeling-commons-backend/generated/prisma/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "prisma-client-645edd08e1ac9c4ec391ebfe9fe4bb8e5e28ca6ecda7d67ffe1ca5ecf45dc0db",
2+
"name": "prisma-client-ffb4175b3d989f143b4c17294faf56e5aa5960c8e06161db4869db1179d74e18",
33
"main": "index.js",
44
"types": "index.d.ts",
55
"browser": "default.js",

apps/modeling-commons-backend/generated/prisma/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ model Verification {
129129
}
130130

131131
model Passkey {
132-
id String @id
132+
id String @id @default(uuid())
133133
name String?
134134
publicKey String
135135
userId String

apps/modeling-commons-backend/prisma/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ model Verification {
129129
}
130130

131131
model Passkey {
132-
id String @id
132+
id String @id @default(uuid())
133133
name String?
134134
publicKey String
135135
userId String
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Decisions
2+
3+
- 2026-04-21: Use `/verify-email` as the guest-facing verification-needed page and send verification callbacks to `/login?verified=1`, preserving a safe `next` path when present.
4+
- 2026-04-21: Use a single `/reset-password` page for both reset-link requests and token-based password updates so Better Auth's redirect callback lands on one stable frontend route.
5+
- 2026-04-21: Route successful email/password sign-ins through `/passkey?next=...` so users can add a platform passkey before continuing to the destination page.
6+
- 2026-04-21: Scaffold profile settings at `/profile/settings`, but only persist fields the backend currently patches (`userKind` and `isProfilePublic`); keep name, email, and avatar as read-only account metadata for now.
7+
- 2026-04-21: Keep auth/settings pages thin by routing auth and passkey mutations through composables, and prefer Nuxt UI defaults plus scoped semantic CSS over utility-heavy page markup for new UI in this app.

apps/modeling-commons-frontend/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ NUXT_PUBLIC_APP_URL="http://localhost:3005"
1414
NUXT_STORAGE_BASE_URL="http://localhost:51090"
1515
ADMIN_DASHBOARD_URL="http://localhost:3005/admin"
1616

17+
NUXT_PUBLIC_GA_TRACKING_ID=
18+
1719
# Enable for Development
1820
# NUXT_DEV_TOOLS=true

0 commit comments

Comments
 (0)