mirror of
				https://github.com/Yidadaa/ChatGPT-Next-Web.git
				synced 2025-11-04 16:57:27 +08:00 
			
		
		
		
	Merge branch 'main' of https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web
This commit is contained in:
		
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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,15 @@ 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(
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 = [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "package": {
 | 
					  "package": {
 | 
				
			||||||
    "productName": "NextChat",
 | 
					    "productName": "NextChat",
 | 
				
			||||||
    "version": "2.12.3"
 | 
					    "version": "2.12.4"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "tauri": {
 | 
					  "tauri": {
 | 
				
			||||||
    "allowlist": {
 | 
					    "allowlist": {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user