mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
11a3007916
* Use a special fake hostname for the API access when the page is opened via the `file:` protocol * Move js/app/src/lite/url.ts -> js/wasm/svelte/host.ts * Add a comment * Move js/wasm/svelte/host.ts -> js/wasm/network/host.ts * add changeset * Add a comment * add changeset * Update js/wasm/package.json adding a ESM subpath * Fix `is_self_host()` --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
9 lines
418 B
TypeScript
9 lines
418 B
TypeScript
export function is_self_host(url: URL): boolean {
|
|
return (
|
|
url.host === window.location.host ||
|
|
url.host === "localhost:7860" ||
|
|
url.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194
|
|
url.host === "lite.local" // A special hostname set when the endpoint is a local file (`file:/*`). See `determine_protocol()` in `client/js/src/utils.ts`
|
|
);
|
|
}
|