This commit is contained in:
ayman-makki 2024-07-02 18:42:44 +01:00
commit 3c8b9ed16e
6 changed files with 32 additions and 12 deletions

View File

@ -43,7 +43,7 @@ COPY --from=builder /app/.next/server ./.next/server
EXPOSE 3000 EXPOSE 3000
CMD if [ -n "$PROXY_URL" ]; then \ CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \ export HOSTNAME="0.0.0.0"; \
protocol=$(echo $PROXY_URL | cut -d: -f1); \ protocol=$(echo $PROXY_URL | cut -d: -f1); \
host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
port=$(echo $PROXY_URL | cut -d: -f3); \ port=$(echo $PROXY_URL | cut -d: -f3); \
@ -58,7 +58,7 @@ CMD if [ -n "$PROXY_URL" ]; then \
echo "[ProxyList]" >> $conf; \ echo "[ProxyList]" >> $conf; \
echo "$protocol $host $port" >> $conf; \ echo "$protocol $host $port" >> $conf; \
cat /etc/proxychains.conf; \ cat /etc/proxychains.conf; \
proxychains -f $conf node server.js --host 0.0.0.0; \ proxychains -f $conf node server.js; \
else \ else \
node server.js; \ node server.js; \
fi fi

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023 Zhang Yifei Copyright (c) 2023-2024 Zhang Yifei
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -18,7 +18,7 @@ One-Click to get a well-designed cross-platform ChatGPT web UI, with GPT3, GPT4
[网页版](https://app.nextchat.dev/) / [客户端](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) [网页版](https://app.nextchat.dev/) / [客户端](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues)
[web-url]: https://chatgpt.nextweb.fun [web-url]: https://app.nextchat.dev/
[download-url]: https://github.com/Yidadaa/ChatGPT-Next-Web/releases [download-url]: https://github.com/Yidadaa/ChatGPT-Next-Web/releases
[Web-image]: https://img.shields.io/badge/Web-PWA-orange?logo=microsoftedge [Web-image]: https://img.shields.io/badge/Web-PWA-orange?logo=microsoftedge
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows [Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows

View File

@ -9,6 +9,14 @@ const mergedAllowedWebDavEndpoints = [
...config.allowedWebDevEndpoints, ...config.allowedWebDevEndpoints,
].filter((domain) => Boolean(domain.trim())); ].filter((domain) => Boolean(domain.trim()));
const normalizeUrl = (url: string) => {
try {
return new URL(url);
} catch (err) {
return null;
}
};
async function handle( async function handle(
req: NextRequest, req: NextRequest,
{ params }: { params: { path: string[] } }, { params }: { params: { path: string[] } },
@ -24,9 +32,19 @@ async function handle(
// Validate the endpoint to prevent potential SSRF attacks // Validate the endpoint to prevent potential SSRF attacks
if ( if (
!mergedAllowedWebDavEndpoints.some( !endpoint ||
(allowedEndpoint) => endpoint?.startsWith(allowedEndpoint), !mergedAllowedWebDavEndpoints.some((allowedEndpoint) => {
) const normalizedAllowedEndpoint = normalizeUrl(allowedEndpoint);
const normalizedEndpoint = normalizeUrl(endpoint as string);
return (
normalizedEndpoint &&
normalizedEndpoint.hostname === normalizedAllowedEndpoint?.hostname &&
normalizedEndpoint.pathname.startsWith(
normalizedAllowedEndpoint.pathname,
)
);
})
) { ) {
return NextResponse.json( return NextResponse.json(
{ {

View File

@ -147,9 +147,9 @@ const openaiModels = [
"gpt-4-turbo", "gpt-4-turbo",
// "gpt-4-turbo-preview", // "gpt-4-turbo-preview",
"gpt-4o", "gpt-4o",
// "gpt-4o-2024-05-13", "gpt-4o-2024-05-13",
// "gpt-4-vision-preview", "gpt-4-vision-preview",
// "gpt-4-turbo-2024-04-09" "gpt-4-turbo-2024-04-09",
]; ];
const googleModels = [ const googleModels = [
@ -166,6 +166,7 @@ const anthropicModels = [
"claude-3-sonnet-20240229", "claude-3-sonnet-20240229",
"claude-3-opus-20240229", "claude-3-opus-20240229",
"claude-3-haiku-20240307", "claude-3-haiku-20240307",
"claude-3-5-sonnet-20240620",
]; ];
export const DEFAULT_MODELS = [ export const DEFAULT_MODELS = [
@ -207,6 +208,7 @@ export const internalAllowedWebDavEndpoints = [
"https://dav.dropdav.com/", "https://dav.dropdav.com/",
"https://dav.box.com/dav", "https://dav.box.com/dav",
"https://nanao.teracloud.jp/dav/", "https://nanao.teracloud.jp/dav/",
"https://bora.teracloud.jp/dav/",
"https://webdav.4shared.com/", "https://webdav.4shared.com/",
"https://dav.idrivesync.com", "https://dav.idrivesync.com",
"https://webdav.yandex.com", "https://webdav.yandex.com",

View File

@ -9,7 +9,7 @@
}, },
"package": { "package": {
"productName": "NextChat", "productName": "NextChat",
"version": "2.12.3" "version": "2.12.4"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {