mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 18:43:29 +00:00
Move ~scalar/proxy route to site route group (#4083)
This commit is contained in:
@@ -53,6 +53,7 @@ export function ScalarApiButton(props: {
|
||||
<ScalarModal
|
||||
controllerRef={controllerRef}
|
||||
withProxy={withProxy}
|
||||
proxyUrl={context.proxyUrl}
|
||||
method={method}
|
||||
path={path}
|
||||
securities={securities}
|
||||
@@ -73,9 +74,11 @@ function ScalarModal(props: {
|
||||
servers: OpenAPIOperationData['servers'];
|
||||
specUrl: string;
|
||||
withProxy: boolean;
|
||||
proxyUrl?: string;
|
||||
controllerRef: React.Ref<ScalarModalControllerRef>;
|
||||
}) {
|
||||
const { method, path, securities, servers, specUrl, withProxy, controllerRef } = props;
|
||||
const { method, path, securities, servers, specUrl, withProxy, proxyUrl, controllerRef } =
|
||||
props;
|
||||
|
||||
const getPrefillInputContextData = useOpenAPIPrefillContext();
|
||||
const prefillInputContext = getPrefillInputContextData();
|
||||
@@ -90,7 +93,7 @@ function ScalarModal(props: {
|
||||
configuration={{
|
||||
url: specUrl,
|
||||
...prefillConfig,
|
||||
proxyUrl: withProxy ? '/~scalar/proxy' : undefined,
|
||||
proxyUrl: withProxy ? proxyUrl : undefined,
|
||||
}}
|
||||
initialRequest={{ method: toScalarHttpMethod(method), path }}
|
||||
>
|
||||
|
||||
@@ -34,6 +34,11 @@ export interface OpenAPIClientContext {
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* The URL for the Scalar proxy endpoint.
|
||||
*/
|
||||
proxyUrl?: string;
|
||||
|
||||
/**
|
||||
* Mark the context as a client context.
|
||||
*/
|
||||
@@ -97,6 +102,7 @@ export function getOpenAPIClientContext(context: OpenAPIUniversalContext): OpenA
|
||||
defaultInteractiveOpened: context.defaultInteractiveOpened,
|
||||
blockKey: context.blockKey,
|
||||
id: context.id,
|
||||
proxyUrl: context.proxyUrl,
|
||||
$$isClientContext$$: true,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user