File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 11MIT License
22
3- Copyright (c) 2023 Zhang Yifei
3+ Copyright (c) 2023-2024 Zhang Yifei
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ const mergedAllowedWebDavEndpoints = [
99 ...config . allowedWebDevEndpoints ,
1010] . filter ( ( domain ) => Boolean ( domain . trim ( ) ) ) ;
1111
12+ const normalizeUrl = ( url : string ) => {
13+ try {
14+ return new URL ( url ) ;
15+ } catch ( err ) {
16+ return null ;
17+ }
18+ } ;
19+
1220async function handle (
1321 req : NextRequest ,
1422 { params } : { params : { path : string [ ] } } ,
@@ -24,9 +32,15 @@ async function handle(
2432
2533 // Validate the endpoint to prevent potential SSRF attacks
2634 if (
27- ! mergedAllowedWebDavEndpoints . some ( ( allowedEndpoint ) =>
28- endpoint ?. startsWith ( allowedEndpoint ) ,
29- )
35+ ! endpoint ||
36+ ! mergedAllowedWebDavEndpoints . some ( ( allowedEndpoint ) => {
37+ const normalizedAllowedEndpoint = normalizeUrl ( allowedEndpoint ) ;
38+ const normalizedEndpoint = normalizeUrl ( endpoint as string ) ;
39+
40+ return normalizedEndpoint &&
41+ normalizedEndpoint . hostname === normalizedAllowedEndpoint ?. hostname &&
42+ normalizedEndpoint . pathname . startsWith ( normalizedAllowedEndpoint . pathname ) ;
43+ } )
3044 ) {
3145 return NextResponse . json (
3246 {
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ const anthropicModels = [
188188 "claude-3-sonnet-20240229" ,
189189 "claude-3-opus-20240229" ,
190190 "claude-3-haiku-20240307" ,
191+ "claude-3-5-sonnet-20240620" ,
191192] ;
192193
193194export const DEFAULT_MODELS = [
Original file line number Diff line number Diff line change 99 },
1010 "package" : {
1111 "productName" : " NextChat" ,
12- "version" : " 2.12.3 "
12+ "version" : " 2.12.4 "
1313 },
1414 "tauri" : {
1515 "allowlist" : {
112112 }
113113 ]
114114 }
115- }
115+ }
You can’t perform that action at this time.
0 commit comments