mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-12 22:42:13 +02:00
refactor(web): treat NEXT_PUBLIC env-config as packaged-client fallback
This commit is contained in:
parent
5613908d0d
commit
2da4a29a4d
2 changed files with 22 additions and 38 deletions
|
|
@ -75,18 +75,21 @@ export const FILE_TYPE_CONFIG: Record<string, Record<string, string[]>> = {
|
|||
},
|
||||
};
|
||||
|
||||
export function getAcceptedFileTypes(): Record<string, string[]> {
|
||||
const etlService = process.env.NEXT_PUBLIC_ETL_SERVICE;
|
||||
export function getAcceptedFileTypes(etlService?: string): Record<string, string[]> {
|
||||
return FILE_TYPE_CONFIG[etlService || "default"] || FILE_TYPE_CONFIG.default;
|
||||
}
|
||||
|
||||
export function getSupportedExtensions(acceptedFileTypes?: Record<string, string[]>): string[] {
|
||||
const types = acceptedFileTypes ?? getAcceptedFileTypes();
|
||||
export function getSupportedExtensions(
|
||||
acceptedFileTypes?: Record<string, string[]>,
|
||||
etlService?: string
|
||||
): string[] {
|
||||
const types = acceptedFileTypes ?? getAcceptedFileTypes(etlService);
|
||||
return Array.from(new Set(Object.values(types).flat())).sort();
|
||||
}
|
||||
|
||||
export function getSupportedExtensionsSet(
|
||||
acceptedFileTypes?: Record<string, string[]>
|
||||
acceptedFileTypes?: Record<string, string[]>,
|
||||
etlService?: string
|
||||
): Set<string> {
|
||||
return new Set(getSupportedExtensions(acceptedFileTypes).map((ext) => ext.toLowerCase()));
|
||||
return new Set(getSupportedExtensions(acceptedFileTypes, etlService).map((ext) => ext.toLowerCase()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue