mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-20 04:30:17 +09:00
feat: Optimize var names
This commit is contained in:
parent
4cb0655192
commit
b175132854
@ -60,4 +60,4 @@ ANTHROPIC_API_VERSION=
|
|||||||
ANTHROPIC_URL=
|
ANTHROPIC_URL=
|
||||||
|
|
||||||
### (optional)
|
### (optional)
|
||||||
WHITE_WEBDEV_DOMAINS=
|
WHITE_WEBDEV_ENDPOINTS=
|
@ -245,7 +245,7 @@ To control custom models, use `+` to add a custom model, use `-` to hide a model
|
|||||||
|
|
||||||
User `-all` to disable all default models, `+all` to enable all default models.
|
User `-all` to disable all default models, `+all` to enable all default models.
|
||||||
|
|
||||||
### `WHITE_WEBDEV_DOMAINS` (可选)
|
### `WHITE_WEBDEV_ENDPOINTS` (可选)
|
||||||
|
|
||||||
You can use this option if you want to increase the number of webdav service addresses you are allowed to access, as required by the format:
|
You can use this option if you want to increase the number of webdav service addresses you are allowed to access, as required by the format:
|
||||||
- Each address must be a complete origin
|
- Each address must be a complete origin
|
||||||
|
@ -142,11 +142,11 @@ anthropic claude Api Url.
|
|||||||
|
|
||||||
如果你想禁用从链接解析预制设置,将此环境变量设置为 1 即可。
|
如果你想禁用从链接解析预制设置,将此环境变量设置为 1 即可。
|
||||||
|
|
||||||
### `WHITE_WEBDEV_DOMAINS` (可选)
|
### `WHITE_WEBDEV_ENDPOINTS` (可选)
|
||||||
|
|
||||||
如果你想增加允许访问的webdav服务地址,可以使用该选项,格式要求:
|
如果你想增加允许访问的webdav服务地址,可以使用该选项,格式要求:
|
||||||
- 每一个地址必须是一个完整的 origin
|
- 每一个地址必须是一个完整的 endpoint
|
||||||
> `https://xxxx`
|
> `https://xxxx/xxx`
|
||||||
- 多个地址以`,`相连
|
- 多个地址以`,`相连
|
||||||
|
|
||||||
### `CUSTOM_MODELS` (可选)
|
### `CUSTOM_MODELS` (可选)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { STORAGE_KEY, internalWhiteWebDavDomains } from "../../../constant";
|
import { STORAGE_KEY, internalWhiteWebDavEndpoints } from "../../../constant";
|
||||||
import { getServerSideConfig } from "@/app/config/server";
|
import { getServerSideConfig } from "@/app/config/server";
|
||||||
|
|
||||||
const config = getServerSideConfig();
|
const config = getServerSideConfig();
|
||||||
|
|
||||||
const mergedWhiteWebDavDomains = [
|
const mergedWhiteWebDavEndpoints = [
|
||||||
...internalWhiteWebDavDomains,
|
...internalWhiteWebDavEndpoints,
|
||||||
...config.whiteWebDevDomains,
|
...config.whiteWebDevEndpoints,
|
||||||
].filter((domain) => Boolean(domain.trim()));
|
].filter((domain) => Boolean(domain.trim()));
|
||||||
|
|
||||||
async function handle(
|
async function handle(
|
||||||
@ -24,7 +24,7 @@ async function handle(
|
|||||||
|
|
||||||
// Validate the endpoint to prevent potential SSRF attacks
|
// Validate the endpoint to prevent potential SSRF attacks
|
||||||
if (
|
if (
|
||||||
!mergedWhiteWebDavDomains.some((domain) => endpoint?.startsWith(domain))
|
!mergedWhiteWebDavEndpoints.some((white) => endpoint?.startsWith(white))
|
||||||
) {
|
) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ export const getServerSideConfig = () => {
|
|||||||
`[Server Config] using ${randomIndex + 1} of ${apiKeys.length} api key`,
|
`[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,
|
hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
|
||||||
disableFastLink: !!process.env.DISABLE_FAST_LINK,
|
disableFastLink: !!process.env.DISABLE_FAST_LINK,
|
||||||
customModels,
|
customModels,
|
||||||
whiteWebDevDomains,
|
whiteWebDevEndpoints,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -367,4 +367,4 @@ export const DEFAULT_MODELS = [
|
|||||||
export const CHAT_PAGE_SIZE = 15;
|
export const CHAT_PAGE_SIZE = 15;
|
||||||
export const MAX_RENDER_MSG_COUNT = 45;
|
export const MAX_RENDER_MSG_COUNT = 45;
|
||||||
|
|
||||||
export const internalWhiteWebDavDomains = ["https://dav.jianguoyun.com"];
|
export const internalWhiteWebDavEndpoints = ["https://dav.jianguoyun.com"];
|
||||||
|
Loading…
Reference in New Issue
Block a user