mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Fix error "Cannot perform I/O on behalf of a different request" (#146)
* Use reliable cloudflare context * Format * Comment
This commit is contained in:
@@ -8,11 +8,15 @@
|
||||
--light-base: 249 250 250;
|
||||
|
||||
--light-1: color-mix(in srgb, rgb(var(--primary-base-600)), rgb(var(--light-base)) 99%);
|
||||
--light-DEFAULT: color-mix(in srgb, rgb(var(--primary-base-700)), rgb(var(--light-base)) 96%);
|
||||
--light-DEFAULT: color-mix(
|
||||
in srgb,
|
||||
rgb(var(--primary-base-700)),
|
||||
rgb(var(--light-base)) 96%
|
||||
);
|
||||
--light-2: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 92%);
|
||||
--light-3: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 88%);
|
||||
--light-4: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 72%);
|
||||
|
||||
|
||||
--dark-1: color-mix(in srgb, rgb(var(--primary-base-100)), rgb(var(--dark-base)) 99%);
|
||||
--dark-DEFAULT: color-mix(in srgb, rgb(var(--primary-base-300)), rgb(var(--dark-base)) 96%);
|
||||
--dark-2: color-mix(in srgb, rgb(var(--primary-base-200)), rgb(var(--dark-base)) 92%);
|
||||
@@ -41,7 +45,11 @@
|
||||
--primary-base-800: 30 30 30;
|
||||
--primary-base-900: 19 19 19;
|
||||
|
||||
--light-DEFAULT: color-mix(in srgb, rgb(var(--primary-base-700)), rgb(var(--light-base)) 100%);
|
||||
--light-DEFAULT: color-mix(
|
||||
in srgb,
|
||||
rgb(var(--primary-base-700)),
|
||||
rgb(var(--light-base)) 100%
|
||||
);
|
||||
--light-2: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 96%);
|
||||
--light-3: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 90%);
|
||||
--light-4: color-mix(in srgb, rgb(var(--primary-base-800)), rgb(var(--light-base)) 76%);
|
||||
|
||||
Vendored
+13
-2
@@ -1,10 +1,21 @@
|
||||
import { getRequestContext } from '@cloudflare/next-on-pages';
|
||||
|
||||
const cloudflareRequestContextSymbol = Symbol.for('__cloudflare-request-context__');
|
||||
|
||||
/**
|
||||
* Get the global context object for the current request.
|
||||
* Get a global context object for the current request.
|
||||
* This object can be used as a key to store request-specific data in a WeakMap.
|
||||
*/
|
||||
export function getGlobalContext(): object {
|
||||
return getCloudflareContext()?.ctx ?? globalThis;
|
||||
// See https://github.com/cloudflare/next-on-pages/discussions/596#discussioncomment-8450986
|
||||
// we need a reliable object that will be different per request
|
||||
const cloudflareRequestContext = (
|
||||
globalThis as unknown as {
|
||||
[cloudflareRequestContextSymbol]: object;
|
||||
}
|
||||
)[cloudflareRequestContextSymbol];
|
||||
|
||||
return cloudflareRequestContext ?? globalThis;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -47,17 +47,17 @@ const config: Config = {
|
||||
|
||||
/** primary-base is an internal color that generates the same colors as primary-color. But it's shades will change into a grayscale if CustomizationBackground.Plain is selected. (globals.css) **/
|
||||
primarybase: generateShades('primary-base'),
|
||||
|
||||
|
||||
light: {
|
||||
1: `color-mix(in srgb, var(--light-1), transparent calc(100% - 100% * <alpha-value>))`, //1 99%
|
||||
DEFAULT: `color-mix(in srgb, var(--light-DEFAULT), transparent calc(100% - 100% * <alpha-value>))`, //(default) 96%
|
||||
DEFAULT: `color-mix(in srgb, var(--light-DEFAULT), transparent calc(100% - 100% * <alpha-value>))`, //(default) 96%
|
||||
2: `color-mix(in srgb, var(--light-2), transparent calc(100% - 100% * <alpha-value>))`, //2 92%
|
||||
3: `color-mix(in srgb, var(--light-3), transparent calc(100% - 100% * <alpha-value>))`, //4 82%
|
||||
4: `color-mix(in srgb, var(--light-4), transparent calc(100% - 100% * <alpha-value>))`, //5 64%
|
||||
},
|
||||
dark: {
|
||||
1: `color-mix(in srgb, var(--dark-1), transparent calc(100% - 100% * <alpha-value>))`, //1 99%
|
||||
DEFAULT: `color-mix(in srgb, var(--dark-DEFAULT), transparent calc(100% - 100% * <alpha-value>))`, //(default) 96%
|
||||
DEFAULT: `color-mix(in srgb, var(--dark-DEFAULT), transparent calc(100% - 100% * <alpha-value>))`, //(default) 96%
|
||||
2: `color-mix(in srgb, var(--dark-2), transparent calc(100% - 100% * <alpha-value>))`, //2 92%
|
||||
3: `color-mix(in srgb, var(--dark-3), transparent calc(100% - 100% * <alpha-value>))`, //4 82%
|
||||
4: `color-mix(in srgb, var(--dark-4), transparent calc(100% - 100% * <alpha-value>))`, //5 64%
|
||||
|
||||
Reference in New Issue
Block a user