Skip to content

Commit 39836a1

Browse files
HyteqHyteq
authored andcommitted
feat: iframe embeds, demo completed
1 parent d38c538 commit 39836a1

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

apps/api/src/middleware/auth.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export const authMiddleware = createMiddleware(async (c, next) => {
5959
// code: 'RATE_LIMIT_EXCEEDED'
6060
// }, 429);
6161
// }
62+
63+
const websiteId = c.req.query('website_id');
64+
if (path.includes('OXmNQsViBT-FOS_wZCTHc') || websiteId === 'OXmNQsViBT-FOS_wZCTHc') {
65+
return next();
66+
}
6267

6368
// Get session
6469
const session = await auth.api.getSession({
@@ -76,7 +81,6 @@ export const authMiddleware = createMiddleware(async (c, next) => {
7681
c.set('user', session.user);
7782
c.set('session', session);
7883

79-
// Check website access for analytics routes
8084
if (path.startsWith('/analytics/') && session) {
8185
const websiteId = c.req.query('website_id');
8286
if (websiteId) {

apps/api/src/middleware/website.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export const websiteAuthHook = createMiddleware(async (c, next) => {
3636
}, 401);
3737
}
3838

39+
if (websiteId === 'OXmNQsViBT-FOS_wZCTHc') {
40+
const website = await getWebsiteById(websiteId);
41+
c.set('website', website);
42+
return next();
43+
}
44+
3945
if (!user) {
4046
return c.json({
4147
success: false,

apps/api/src/routes/v1/websites.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,33 @@ websitesRouter.get('/:id', async (c) => {
333333
const user = c.get('user');
334334
const id = c.req.param('id');
335335

336+
// Handle demo website access
337+
if (id === 'OXmNQsViBT-FOS_wZCTHc') {
338+
try {
339+
const website = await db.query.websites.findFirst({
340+
where: eq(websites.id, id)
341+
});
342+
343+
if (!website) {
344+
return c.json({
345+
success: false,
346+
error: "Website not found"
347+
}, 404);
348+
}
349+
350+
return c.json({
351+
success: true,
352+
data: website
353+
});
354+
} catch (error) {
355+
logger.error('[Website API] Error fetching demo website:', { error });
356+
return c.json({
357+
success: false,
358+
error: "Failed to fetch website"
359+
}, 500);
360+
}
361+
}
362+
336363
if (!user) {
337364
return c.json({ success: false, error: "Unauthorized" }, 401);
338365
}

apps/dashboard/next.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const nextConfig: NextConfig = {
3535
"img-src 'self' data: https: blob:",
3636
"font-src 'self' data:",
3737
"connect-src 'self' https://basket.databuddy.cc https://api.databuddy.cc https://app.databuddy.cc http://localhost:4000",
38-
"frame-ancestors 'none'",
38+
"frame-src 'self' https:",
39+
"frame-ancestors *",
3940
"base-uri 'self'",
4041
"form-action 'self'",
4142
].join('; '),

0 commit comments

Comments
 (0)