mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-09 12:34:59 -05:00
Compare commits
1 Commits
cb2dd7bb27
...
ed779ebfdf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed779ebfdf |
@ -28,10 +28,6 @@ The primary stack for MHSF is Next.js, a React framework, which you can start by
|
||||
[You can also opt out of telemetry if you'd like.](https://nextjs.org/telemetry)
|
||||
|
||||
## Clerk
|
||||
> [!CAUTION]
|
||||
> Clerk is no longer optional. If Clerk is not setup, you *will* get a `Non-authenticated environments are disallowed on this origin.` error on the frontend.
|
||||
> You may be able to modify/test API endpoints as long as they do not require accounts.
|
||||
|
||||
If you want to test out accounts, [you must create an Clerk key from their website.](https://clerk.com)
|
||||
Set the following variables in the .env.local file:
|
||||
```dotenv
|
||||
|
||||
@ -30,33 +30,32 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse,
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const betterStackResult = await fetch(
|
||||
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}/status-reports`,
|
||||
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } },
|
||||
);
|
||||
const betterStackURL = await fetch(
|
||||
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}`,
|
||||
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } },
|
||||
);
|
||||
const betterStackResult = await fetch(
|
||||
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}/status-reports`,
|
||||
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } }
|
||||
);
|
||||
const betterStackURL = await fetch(
|
||||
`https://uptime.betterstack.com/api/v2/status-pages/${process.env.BS_STATUS_PAGE}`,
|
||||
{ headers: { Authorization: `Bearer ${process.env.BS_TOKEN}` } }
|
||||
);
|
||||
|
||||
const result = await betterStackResult.json();
|
||||
const url = await betterStackURL.json();
|
||||
const result = await betterStackResult.json();
|
||||
const url = await betterStackURL.json();
|
||||
|
||||
const filtered = result.data.filter(
|
||||
(c: any) =>
|
||||
c.attributes.ends_at === null &&
|
||||
c.attributes.affected_resources.filter(
|
||||
(v: any) =>
|
||||
v.status_page_resource_id === process.env.BS_STATUS_MAIN_WEBSITE &&
|
||||
v.status !== "resolved",
|
||||
).length > 0,
|
||||
);
|
||||
const filtered = result.data.filter(
|
||||
(c: any) =>
|
||||
c.attributes.ends_at === null &&
|
||||
c.attributes.affected_resources.filter(
|
||||
(v: any) =>
|
||||
v.status_page_resource_id === process.env.BS_STATUS_MAIN_WEBSITE
|
||||
).length > 0
|
||||
);
|
||||
|
||||
res.status(200).send({
|
||||
url: url.data.attributes.custom_domain,
|
||||
incidents: filtered,
|
||||
});
|
||||
res.status(200).send({
|
||||
url: url.data.attributes.custom_domain,
|
||||
incidents: filtered,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user