fix cf deployment

This commit is contained in:
Hieu Nguyen (Jack) committed 2026-08-27 15:46:41 +07:00
1 parent 2d919420d5
commit 47157fd5e7
2 files changed
+9 -2

No files matched your search

+5 -2
View File
@@ -2,9 +2,12 @@ import { eq } from "drizzle-orm";
import { getDb } from "@/db";
import { appSettings } from "@/db/schema";
import { APP_SETTINGS_ID } from "@/lib/branding/service";
import { getEnv } from "@/lib/cloudflare";
import { getEnvAsync } from "@/lib/cloudflare";
import { getLicenseEntitlements } from "@/lib/licenses/service";
export const dynamic = "force-dynamic";
export const revalidate = 0;
async function getDefaultIcon(env: CloudflareEnv): Promise<Response> {
const asset = await env.ASSETS.fetch("https://mailflare.local/icon-96.png");
return new Response(await asset.arrayBuffer(), {
@@ -15,7 +18,7 @@ async function getDefaultIcon(env: CloudflareEnv): Promise<Response> {
}
export async function GET(request: Request) {
const env = getEnv();
const env = await getEnvAsync();
if (!(await getLicenseEntitlements(env)).canCustomizeBranding) return getDefaultIcon(env);
try {
const [settings] = await getDb(env)
+4
View File
@@ -3,3 +3,7 @@ import { getCloudflareContext } from "@opennextjs/cloudflare";
export function getEnv(): CloudflareEnv {
return getCloudflareContext().env as CloudflareEnv;
}
export async function getEnvAsync(): Promise<CloudflareEnv> {
return (await getCloudflareContext({ async: true })).env as CloudflareEnv;
}