-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 04-13-fix_support_add…
…ing_an_non-existent_email_as_the_owner_of_the_organization
- Loading branch information
Showing
54 changed files
with
1,843 additions
and
980 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Cron - changeTimeZone | ||
|
||
on: | ||
# "Scheduled workflows run on the latest commit on the default or base branch." | ||
# — https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#schedule | ||
schedule: | ||
# Runs "At every full hour." (see https://crontab.guru) | ||
- cron: "0 * * * *" | ||
|
||
jobs: | ||
cron-scheduleEmailReminders: | ||
env: | ||
APP_URL: ${{ secrets.APP_URL }} | ||
CRON_API_KEY: ${{ secrets.CRON_API_KEY }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: cURL request | ||
if: ${{ env.APP_URL && env.CRON_API_KEY }} | ||
run: | | ||
curl ${{ secrets.APP_URL }}/api/cron/changeTimeZone \ | ||
-X POST \ | ||
-H 'content-type: application/json' \ | ||
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \ | ||
-sSf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { get } from "@vercel/edge-config"; | ||
import { NextResponse } from "next/server"; | ||
|
||
const safeGet = async <T = unknown>(key: string): Promise<T | undefined> => { | ||
try { | ||
return get<T>(key); | ||
} catch (error) { | ||
// Don't crash if EDGE_CONFIG env var is missing | ||
} | ||
}; | ||
|
||
export const config = { matcher: "/:path*" }; | ||
|
||
export async function middleware() { | ||
const isInMaintenanceMode = await safeGet<boolean>("isInMaintenanceMode"); | ||
if (!isInMaintenanceMode) return NextResponse.next(); | ||
// If is in maintenance mode, return a 503 status code | ||
return NextResponse.json( | ||
{ message: "API is currently under maintenance. Please try again at a later time." }, | ||
{ status: 503 } | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Injectable, NestMiddleware } from "@nestjs/common"; | ||
import { Request, Response } from "express"; | ||
|
||
@Injectable() | ||
export class RewriterMiddleware implements NestMiddleware { | ||
use(req: Request, res: Response, next: () => void) { | ||
if (req.url.startsWith("/api/v2")) { | ||
req.url = req.url.replace("/api/v2", "/v2"); | ||
} | ||
next(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.