Move all functions to nodejs runtime

This commit is contained in:
Sam Becker 2024-04-16 16:59:37 -05:00
parent 09073b5c3e
commit 9d1838e87b
11 changed files with 21 additions and 24 deletions

View File

@ -1,2 +1 @@
export { GET, POST } from '@/auth';
export const runtime = 'edge';

View File

@ -6,8 +6,6 @@ import {
SITE_TITLE,
} from '@/site/config';
export const runtime = 'edge';
export async function GET() {
if (PUBLIC_API_ENABLED) {
const photos = await getPhotosCached({ limit: API_PHOTO_REQUEST_LIMIT });

View File

@ -10,8 +10,6 @@ import {
import { CURRENT_STORAGE } from '@/site/config';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
export const runtime = 'edge';
export async function GET(
_: Request,
{ params: { key } }: { params: { key: string } },

View File

@ -10,8 +10,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET(
_: Request,
context: { params: { simulation: FilmSimulation } },

View File

@ -8,8 +8,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET() {
const [
photos,

View File

@ -5,8 +5,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET(
_: Request,
context: { params: { photoId: string } },

View File

@ -9,8 +9,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET(
_: Request,
context: CameraProps,

View File

@ -8,8 +8,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET(
_: Request,
context: { params: { tag: string } },

View File

@ -9,8 +9,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET() {
const [
photos,

View File

@ -9,8 +9,6 @@ import { getIBMPlexMonoMedium } from '@/site/font';
import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
export const runtime = 'edge';
export async function GET() {
const [
photos,

View File

@ -1,10 +1,26 @@
import fs from 'fs';
import path from 'path';
import { cwd } from 'process';
const FONT_FAMILY_IBM_PLEX_MONO = 'IBMPlexMono';
export const getIBMPlexMonoMedium = () => fetch(new URL(
'/public/fonts/IBMPlexMono-Medium.ttf',
import.meta.url
))
.then(res => res.arrayBuffer())
const getFontData = async () => {
let data: ArrayBuffer;
if (typeof fs !== 'undefined') {
data = fs.readFileSync(path.join(
cwd(),
'/public/fonts/IBMPlexMono-Medium.ttf',
));
} else {
data = await fetch(new URL(
'/public/fonts/IBMPlexMono-Medium.ttf',
import.meta.url
)).then(res => res.arrayBuffer());
}
return data;
};
export const getIBMPlexMonoMedium = () => getFontData()
.then(data => ({
fontFamily: FONT_FAMILY_IBM_PLEX_MONO,
fonts: [{