mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 15:16:24 +08:00
feat: Optimize var names
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { STORAGE_KEY, internalWhiteWebDavDomains } from "../../../constant";
|
||||
import { STORAGE_KEY, internalWhiteWebDavEndpoints } from "../../../constant";
|
||||
import { getServerSideConfig } from "@/app/config/server";
|
||||
|
||||
const config = getServerSideConfig();
|
||||
|
||||
const mergedWhiteWebDavDomains = [
|
||||
...internalWhiteWebDavDomains,
|
||||
...config.whiteWebDevDomains,
|
||||
const mergedWhiteWebDavEndpoints = [
|
||||
...internalWhiteWebDavEndpoints,
|
||||
...config.whiteWebDevEndpoints,
|
||||
].filter((domain) => Boolean(domain.trim()));
|
||||
|
||||
async function handle(
|
||||
@@ -24,7 +24,7 @@ async function handle(
|
||||
|
||||
// Validate the endpoint to prevent potential SSRF attacks
|
||||
if (
|
||||
!mergedWhiteWebDavDomains.some((domain) => endpoint?.startsWith(domain))
|
||||
!mergedWhiteWebDavEndpoints.some((white) => endpoint?.startsWith(white))
|
||||
) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
|
@@ -79,7 +79,7 @@ export const getServerSideConfig = () => {
|
||||
`[Server Config] using ${randomIndex + 1} of ${apiKeys.length} api key`,
|
||||
);
|
||||
|
||||
const whiteWebDevDomains = (process.env.WHITE_WEBDEV_DOMAINS ?? "").split(
|
||||
const whiteWebDevEndpoints = (process.env.WHITE_WEBDEV_ENDPOINTS ?? "").split(
|
||||
",",
|
||||
);
|
||||
|
||||
@@ -116,6 +116,6 @@ export const getServerSideConfig = () => {
|
||||
hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
|
||||
disableFastLink: !!process.env.DISABLE_FAST_LINK,
|
||||
customModels,
|
||||
whiteWebDevDomains,
|
||||
whiteWebDevEndpoints,
|
||||
};
|
||||
};
|
||||
|
@@ -367,4 +367,4 @@ export const DEFAULT_MODELS = [
|
||||
export const CHAT_PAGE_SIZE = 15;
|
||||
export const MAX_RENDER_MSG_COUNT = 45;
|
||||
|
||||
export const internalWhiteWebDavDomains = ["https://dav.jianguoyun.com"];
|
||||
export const internalWhiteWebDavEndpoints = ["https://dav.jianguoyun.com"];
|
||||
|
Reference in New Issue
Block a user