mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix(website): edge-config fallback
This commit is contained in:
@@ -5,24 +5,26 @@ import type { ServerRuntime } from 'next/types';
|
|||||||
export const runtime: ServerRuntime = 'edge';
|
export const runtime: ServerRuntime = 'edge';
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const url = await get<string>('DISCORD_WEBHOOK_URL');
|
try {
|
||||||
const imageUrl = await get<string>('IT_IS_WEDNESDAY_MY_DUDES');
|
const url = await get<string>('DISCORD_WEBHOOK_URL');
|
||||||
if (url && imageUrl) {
|
const imageUrl = await get<string>('IT_IS_WEDNESDAY_MY_DUDES');
|
||||||
await fetch(url, {
|
if (url && imageUrl) {
|
||||||
method: 'POST',
|
await fetch(url, {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
headers: { 'Content-Type': 'application/json' },
|
||||||
username: 'It is wednesday, my dudes',
|
body: JSON.stringify({
|
||||||
embeds: [
|
username: 'It is wednesday, my dudes',
|
||||||
{
|
embeds: [
|
||||||
image: {
|
{
|
||||||
url: imageUrl,
|
image: {
|
||||||
|
url: imageUrl,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
}),
|
||||||
}),
|
});
|
||||||
});
|
}
|
||||||
}
|
} catch {}
|
||||||
|
|
||||||
return NextResponse.json({ message: 'It is wednesday, my dudes' });
|
return NextResponse.json({ message: 'It is wednesday, my dudes' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ async function fetchLatestVersion(packageName: string) {
|
|||||||
|
|
||||||
export default async function middleware(request: NextRequest) {
|
export default async function middleware(request: NextRequest) {
|
||||||
if (request.nextUrl.pathname === '/docs') {
|
if (request.nextUrl.pathname === '/docs') {
|
||||||
const skip = await get<boolean>('SKIP_PACKAGE_VERSION_SELECTION');
|
try {
|
||||||
if (skip) {
|
const skip = await get<boolean>('SKIP_PACKAGE_VERSION_SELECTION');
|
||||||
const latestVersion = await fetchLatestVersion('builders');
|
if (skip) {
|
||||||
return NextResponse.redirect(new URL(`/docs/packages/builders/${latestVersion}`, request.url));
|
const latestVersion = await fetchLatestVersion('builders');
|
||||||
}
|
return NextResponse.redirect(new URL(`/docs/packages/builders/${latestVersion}`, request.url));
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.nextUrl.pathname.includes('discord.js')) {
|
if (request.nextUrl.pathname.includes('discord.js')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user