mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 12:10:17 +09:00
20 lines
416 B
TypeScript
20 lines
416 B
TypeScript
import { getClientConfig } from "../config/client";
|
|
import { DEFAULT_API_HOST } from "../constant";
|
|
|
|
export function corsPath(path: string) {
|
|
const baseUrl = getClientConfig()?.isApp ? `${DEFAULT_API_HOST}` : "";
|
|
|
|
if (baseUrl === "" && path === "") {
|
|
return "";
|
|
}
|
|
if (!path.startsWith("/")) {
|
|
path = "/" + path;
|
|
}
|
|
|
|
if (!path.endsWith("/")) {
|
|
path += "/";
|
|
}
|
|
|
|
return `${baseUrl}${path}`;
|
|
}
|