Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ MISTRAL_API_KEY=your-mistral-api-key
# Optional: MISTRAL_OCR_MODEL=mistral-ocr-latest
# Zero Sync
NEXT_PUBLIC_ZERO_SERVER=http://localhost:4848
ZERO_AUTH_SECRET=your-shared-secret-for-jwt-signing
ZERO_COOKIE_DOMAIN=.thinkex.app

@cubic-dev-ai cubic-dev-ai Bot Apr 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Do not hard-code the production cookie domain in .env.example; use a placeholder so self-hosted deployments don't inherit an invalid cookie domain and break auth cookies.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .env.example, line 51:

<comment>Do not hard-code the production cookie domain in `.env.example`; use a placeholder so self-hosted deployments don't inherit an invalid cookie domain and break auth cookies.</comment>

<file context>
@@ -48,4 +48,4 @@ MISTRAL_API_KEY=your-mistral-api-key
 # Zero Sync
 NEXT_PUBLIC_ZERO_SERVER=http://localhost:4848
-ZERO_AUTH_SECRET=your-shared-secret-for-jwt-signing
+ZERO_COOKIE_DOMAIN=.thinkex.app
</file context>
Suggested change
ZERO_COOKIE_DOMAIN=.thinkex.app
ZERO_COOKIE_DOMAIN=.your-domain.com
Fix with Cubic

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"drizzle-orm": "^0.45.2",
"gsap": "^3.14.2",
"heic2any": "^0.0.4",
"jose": "^6.2.2",
"jsonrepair": "^3.13.2",
"katex": "^0.16.45",
"lodash.throttle": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/share/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import { db, workspaces } from "@/lib/db/client";
import { eq } from "drizzle-orm";
import { loadWorkspaceState } from "@/lib/workspace/state-loader";
import { loadWorkspaceState } from "@/lib/workspace/workspace-state-read";

/**
* GET /api/share/[id]
Expand Down
12 changes: 11 additions & 1 deletion src/app/api/workspaces/[id]/collaborators/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import {
import { Resend } from "resend";
import { InviteEmailTemplate } from "@/components/email/invite-email";

const resend = new Resend(process.env.RESEND_API_KEY);
function getResend() {
return process.env.RESEND_API_KEY ? new Resend(process.env.RESEND_API_KEY) : null;
}

// GET /api/workspaces/[id]/collaborators
async function handleGET(
Expand Down Expand Up @@ -195,6 +197,10 @@ async function handlePOST(
try {
const identifier = ws.slug || workspaceId;
const workspaceUrl = `https://thinkex.app/workspace/${identifier}`;
const resend = getResend();
if (!resend) {
throw new Error("RESEND_API_KEY is not configured");
}
const { data, error } = await resend.emails.send(
{
from: 'ThinkEx <hello@thinkex.app>',
Expand Down Expand Up @@ -283,6 +289,10 @@ async function handlePOST(
try {
const identifier = ws.slug || workspaceId;
const workspaceUrl = `https://thinkex.app/workspace/${identifier}?invite=${token}`;
const resend = getResend();
if (!resend) {
throw new Error("RESEND_API_KEY is not configured");
}
const { error } = await resend.emails.send(
{
from: 'ThinkEx <hello@thinkex.app>',
Expand Down
271 changes: 0 additions & 271 deletions src/app/api/workspaces/[id]/events/route.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/api/workspaces/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import { db, workspaces } from "@/lib/db/client";
import { eq, and, ne } from "drizzle-orm";
import { loadWorkspaceState } from "@/lib/workspace/state-loader";
import { loadWorkspaceState } from "@/lib/workspace/workspace-state-read";
import {
requireAuth,
verifyWorkspaceOwnership,
Expand Down
28 changes: 0 additions & 28 deletions src/app/api/workspaces/[id]/state/route.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/app/api/workspaces/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
requireAuthWithUserInfo,
withErrorHandling,
} from "@/lib/api/workspace-helpers";
import { workspaceItemProjectionState } from "@/lib/db/schema";
import { insertWorkspaceItem } from "@/lib/workspace/workspace-item-write";

/**
Expand Down Expand Up @@ -246,16 +245,6 @@ async function handlePOST(request: NextRequest) {

try {
await db.transaction(async (tx) => {
await tx
.insert(workspaceItemProjectionState)
.values({
workspaceId: workspace.id,
lastAppliedVersion: 0,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
})
.onConflictDoNothing();

for (const item of initialItems) {
await insertWorkspaceItem(tx, {
workspaceId: workspace.id,
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/workspaces/slug/[slug]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
import { db, workspaces } from "@/lib/db/client";
import { workspaceCollaborators } from "@/lib/db/schema";
import { eq, and, or, inArray } from "drizzle-orm";
import { loadWorkspaceState } from "@/lib/workspace/state-loader";
import { loadWorkspaceState } from "@/lib/workspace/workspace-state-read";
import { requireAuth, withErrorHandling } from "@/lib/api/workspace-helpers";

/**
Expand Down
Loading