Openstatus www.openstatus.dev
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update content (#523)

* ๐Ÿ“ update content

* ๐Ÿ“ update content

authored by

Thibault Le Ouay and committed by
GitHub
f7826908 775eb8f9

+80 -11
+7 -1
apps/web/src/app/status-page/[domain]/_components/actions.ts
··· 2 2 3 3 import { z } from "zod"; 4 4 5 + import { trackAnalytics } from "@openstatus/analytics"; 5 6 import { and, eq } from "@openstatus/db"; 6 7 import { db } from "@openstatus/db/src/db"; 7 8 import { page, pageSubscriber } from "@openstatus/db/src/schema"; ··· 64 65 }), 65 66 from: "OpenStatus <notification@openstatus.dev>", 66 67 to: [validatedFields.data.email], 67 - subject: "Verify your subscription", 68 + subject: "Verify your subscription to " + pageData.title, 68 69 }); 69 70 70 71 await db ··· 76 77 expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7), 77 78 }) 78 79 .execute(); 80 + 81 + await trackAnalytics({ 82 + event: "Subscribe to Status Page", 83 + slug: pageData.slug, 84 + }); 79 85 }
+62
apps/web/src/app/status-page/[domain]/subscribe/route.ts
··· 1 + import { z } from "zod"; 2 + 3 + import { and, eq } from "@openstatus/db"; 4 + import { db } from "@openstatus/db/src/db"; 5 + import { page, pageSubscriber } from "@openstatus/db/src/schema"; 6 + import { sendEmail, SubscribeEmail } from "@openstatus/emails"; 7 + 8 + export async function POST( 9 + req: Request, 10 + { params }: { params: { domain: string } }, 11 + ) { 12 + // 13 + const data = await req.json(); 14 + const result = z.object({ email: z.string().email() }).parse(data); 15 + 16 + const pageData = await db 17 + .select() 18 + .from(page) 19 + .where(eq(page.slug, params.domain)) 20 + .get(); 21 + if (!pageData) { 22 + return new Response("Not found", { status: 401 }); 23 + } 24 + 25 + const alreadySubscribed = await db 26 + .select() 27 + .from(pageSubscriber) 28 + .where( 29 + and( 30 + eq(pageSubscriber.email, data.email), 31 + eq(pageSubscriber.pageId, pageData?.id), 32 + ), 33 + ) 34 + .get(); 35 + 36 + if (alreadySubscribed) { 37 + return new Response("Not found", { status: 401 }); 38 + } 39 + 40 + const token = (Math.random() + 1).toString(36).substring(10); 41 + 42 + await sendEmail({ 43 + react: SubscribeEmail({ 44 + domain: params.domain, 45 + token: token, 46 + page: pageData.title, 47 + }), 48 + from: "OpenStatus <notification@openstatus.dev>", 49 + to: [result.email], 50 + subject: "Verify your subscription to " + pageData.title, 51 + }); 52 + await db 53 + .insert(pageSubscriber) 54 + .values({ 55 + pageId: pageData.id, 56 + email: result.email, 57 + token, 58 + expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7), 59 + }) 60 + .execute(); 61 + return Response.json({ message: "Hello world" }); 62 + }
+1 -1
apps/web/src/components/marketing/faqs.tsx
··· 13 13 }, 14 14 { 15 15 q: "Who are we?", 16 - a: "We are <a href='https://twitter.com/thibaultleouay' target='_blank'>Thibault</a> and <a href='https://twitter.com/mxkaske' target='_blank'>Max</a>. We both have a 9-to-5 job and we are doing that project for the purpose of open source and the community. Of course, it would be nice to make that project self sustainable. It's not a sprint, it's a marathon.", 16 + a: "We are <a href='https://twitter.com/thibaultleouay' target='_blank'>Thibault</a> and <a href='https://twitter.com/mxkaske' target='_blank'>Max</a>.", 17 17 }, 18 18 { 19 19 q: "How does it work?",
+6 -5
apps/web/src/components/marketing/hero.tsx
··· 12 12 return ( 13 13 <Shell className="text-center"> 14 14 <Link 15 - href="https://twitter.com/mxkaske/status/1685666982786404352?s=20" 15 + href="https://github.com/openstatusHQ/openstatus/stargazers" 16 16 target="_blank" 17 17 rel="noreferrer" 18 18 > 19 19 <Badge variant="outline"> 20 - Announcement Post <ChevronRight className="ml-1 h-3 w-3" /> 20 + Proudly Open Source - Support us on GitHub 21 + <ChevronRight className="ml-1 h-3 w-3" /> 21 22 </Badge> 22 23 </Link> 23 24 <h1 className="text-foreground font-cal mb-6 mt-2 text-3xl"> 24 - Open-source monitoring service 25 + A better way to monitor your services. 25 26 </h1> 26 27 <p className="text-muted-foreground mx-auto mb-6 max-w-lg text-lg"> 27 - OpenStatus is an open-source monitoring service with incident 28 - management. 28 + Reduce alert fatigue by triggering only relevant alerts when your 29 + services experience downtime. 29 30 </p> 30 31 {/* much better than using flex without text alignment, text stays center even thought not same length */} 31 32 <div className="my-4 grid gap-2 sm:grid-cols-2">
+2 -1
packages/analytics/src/type.ts
··· 16 16 | { event: "User Upgraded"; email: string } 17 17 | { event: "User Signed In" } 18 18 | { event: "User Vercel Beta" } 19 - | { event: "Notification Created"; provider: string }; 19 + | { event: "Notification Created"; provider: string } 20 + | { event: "Subscribe to Status Page"; slug: string };
+2 -3
packages/emails/emails/subscribe.tsx
··· 15 15 <title>Confirm your subscription to {page} Status Page</title> 16 16 <Preview>Confirm your subscription to {page} Status Page</Preview> 17 17 <Body> 18 - <h1>Confirm your subscription to {page} Status Page</h1> 18 + <p>Confirm your subscription to {page} Status Page</p> 19 19 <p> 20 20 You are receiving this email because you subscribed to receive 21 21 updates from {page} Status Page. ··· 30 30 </a> 31 31 </p> 32 32 <br /> 33 - <br /> 34 - ๐Ÿš€ Powered by 33 + ๐Ÿš€ Powered by{" "} 35 34 <Link href="https://www.openstatus.dev">OpenStatus.dev</Link> 36 35 </Body> 37 36 </Head>