Openstatus www.openstatus.dev

chore: hide url on public monitor (#1338)

authored by

Maximilian Kaske and committed by
GitHub
868ce009 504fcec0

+30 -6
+1
apps/web/.env.example
··· 70 70 SLACK_SUPPORT_WEBHOOK_URL= 71 71 72 72 WORKSPACES_LOOKBACK_30= 73 + WORKSPACES_HIDE_URL= 73 74 74 75 # https://turbo.build/repo/docs/crafting-your-repository/using-environment-variables#loose-mode 75 76 TURBO_ENV_MODE=loose
+15 -3
apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsx
··· 27 27 28 28 export const revalidate = 120; 29 29 30 + /** 31 + * Workspace slugs that should have the URL hidden 32 + */ 33 + const WORKSPACES_HIDE_URL = 34 + process.env.WORKSPACES_HIDE_URL?.split(",").map(Number) || []; 35 + 30 36 export async function generateMetadata(props: { 31 37 params: Promise<{ domain: string; id: string }>; 32 38 }): Promise<Metadata> { ··· 87 93 interval !== DEFAULT_INTERVAL || 88 94 flyRegions.length !== regions.length; 89 95 90 - console.log({ metrics: metrics.data }); 91 - 92 96 return ( 93 97 <div className="relative flex w-full flex-col gap-6"> 94 - <Header title={monitor.name} description={monitor.url} /> 98 + <Header 99 + title={monitor.name} 100 + description={ 101 + monitor.workspaceId && 102 + WORKSPACES_HIDE_URL.includes(monitor.workspaceId) 103 + ? undefined 104 + : monitor.url 105 + } 106 + /> 95 107 <div className="flex items-center justify-between gap-2"> 96 108 <DatePickerPreset defaultValue={period} values={periods} /> 97 109 {isDirty ? <ButtonReset /> : null}
+14 -3
apps/web/src/app/status-page/[domain]/monitors/page.tsx
··· 15 15 16 16 // Add loading page 17 17 18 + /** 19 + * Workspace slugs that should have the URL hidden 20 + */ 21 + const WORKSPACES_HIDE_URL = 22 + process.env.WORKSPACES_HIDE_URL?.split(",").map(Number) || []; 23 + 18 24 export const metadata: Metadata = { 19 25 title: "Monitors", 20 26 }; ··· 82 88 <div className="flex w-full min-w-0 items-center justify-between gap-3"> 83 89 <div className="w-full min-w-0"> 84 90 <p className="font-semibold text-sm">{monitor.name}</p> 85 - <p className="truncate text-muted-foreground text-sm"> 86 - {monitor.url} 87 - </p> 91 + {monitor.workspaceId && 92 + WORKSPACES_HIDE_URL.includes( 93 + monitor.workspaceId, 94 + ) ? null : ( 95 + <p className="truncate text-muted-foreground text-sm"> 96 + {monitor.url} 97 + </p> 98 + )} 88 99 </div> 89 100 <Button variant="link" size="sm" asChild> 90 101 <Link href={`./monitors/${monitor.id}`}>