This commit is contained in:
Samy Pessé
2025-04-08 01:09:48 +02:00
parent 6f888387b4
commit db880d647f
3 changed files with 2 additions and 17 deletions
@@ -81,7 +81,6 @@ export function createImageResizer({
searchParams.set('sign', cachedSignature.signature);
searchParams.set('sv', cachedSignature.version);
searchParams.set('sid', imagesContextId);
return `${url}?${searchParams.toString()}`;
};
@@ -72,9 +72,6 @@ const generateSignatureV2: SignFn = async (input) => {
.join(':');
const signature = fnv1a(all, { utf8Buffer: fnv1aUtf8Buffer }).toString(16);
console.log(`generateSignatureV2: "${all}" -> "${signature}"`);
return signature;
};
+2 -13
View File
@@ -10,7 +10,6 @@ import { filterOutNullable } from '@/lib/typescript';
import { getCacheTag } from '@gitbook/cache-tags';
import type { GitBookSiteContext } from '@v2/lib/context';
import { getCloudflareContext } from '@v2/lib/data/cloudflare';
import { GITBOOK_RUNTIME } from '@v2/lib/env';
import { getResizedImageURL } from '@v2/lib/images';
const googleFontsMap: { [fontName in CustomizationDefaultFont]: string } = {
@@ -116,18 +115,8 @@ export async function serveOGImage(baseContext: GitBookSiteContext, params: Page
body: baseColors[useLightTheme ? 'dark' : 'light'], // Invert text on background
};
// For Cloudflare, we use absolute URLs from the root of the site instead
// to avoid issues with worker to worker requests in the same zone.
const gridWhitePath = 'images/ogimage-grid-white.png';
const gridDarkPath = 'images/ogimage-grid-black.png';
const gridWhite =
GITBOOK_RUNTIME === 'cloudflare'
? linker.toAbsoluteURL(`/~gitbook/static/${gridWhitePath}`)
: getAssetURL(gridWhitePath);
const gridBlack =
GITBOOK_RUNTIME === 'cloudflare'
? linker.toAbsoluteURL(`/~gitbook/static/${gridDarkPath}`)
: getAssetURL(gridDarkPath);
const gridWhite = getAssetURL('images/ogimage-grid-white.png');
const gridBlack = getAssetURL('images/ogimage-grid-black.png');
let gridAsset = useLightTheme ? gridBlack : gridWhite;