🪻 distributed transcription service thistle.dunkirk.sh

chore: use origin in templates

dunkirk.sh 34ceb85a bbd5c004

verified
Changed files
+14 -5
src
+10
CRUSH.md
···
**IMPORTANT**: Do NOT commit changes until the user explicitly asks you to commit. Always wait for user verification that changes are working correctly before making commits.
+
## Environment Variables
+
+
**CRITICAL**: Always use `process.env.ORIGIN` for generating URLs in emails and links, NOT hardcoded domains.
+
+
- `ORIGIN` - The public URL of the application (e.g., `https://thistle.app` or `http://localhost:3000`)
+
- Used for: Email verification links, password reset links, any user-facing URLs
+
- Default: `http://localhost:3000` (development only)
+
+
**Never hardcode domain names** like `https://thistle.app` in code - always use `process.env.ORIGIN`.
+
## Project Info
- Name: Thistle
+2 -3
src/index.ts
···
// Always return success to prevent email enumeration
const user = getUserByEmail(email);
if (user) {
-
const origin =
-
req.headers.get("origin") || "http://localhost:3000";
+
const origin = process.env.ORIGIN || "http://localhost:3000";
const resetToken = createPasswordResetToken(user.id);
const resetLink = `${origin}/reset-password?token=${resetToken}`;
···
// Create password reset token
-
const origin = req.headers.get("origin") || "http://localhost:3000";
+
const origin = process.env.ORIGIN || "http://localhost:3000";
const resetToken = createPasswordResetToken(user.id);
const resetLink = `${origin}/reset-password?token=${resetToken}`;
+2 -2
src/lib/email-templates.ts
···
export function verifyEmailTemplate(options: VerifyEmailOptions): string {
const greeting = options.name ? `Hi ${options.name}` : "Hi there";
-
const domain = process.env.DOMAIN || "https://thistle.app";
-
const verifyLink = `${domain}/api/auth/verify-email?token=${options.token}`;
+
const origin = process.env.ORIGIN || "http://localhost:3000";
+
const verifyLink = `${origin}/api/auth/verify-email?token=${options.token}`;
return `
<!DOCTYPE html>