diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 10d5b42e3..9273f6a73 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -513,8 +513,8 @@ "postman_environment": "Postman Environment", "postman_environment_description": "Import Postman Environment from a JSON file", "title": "Import", - "file_size_limit_exceeded_warning_multiple_files": "Chosen files exceed the recommended limit of 10MB. Only the first {files} selected will be imported", - "file_size_limit_exceeded_warning_single_file": "The currently chosen file exceeds the recommended limit of 10MB. Please select another file.", + "file_size_limit_exceeded_warning_multiple_files": "Chosen files exceed the recommended limit of {sizeLimit}MB. Only the first {files} selected will be imported", + "file_size_limit_exceeded_warning_single_file": "The currently chosen file exceeds the recommended limit of {sizeLimit}MB. Please select another file.", "success": "Successfully imported" }, "inspections": { diff --git a/packages/hoppscotch-common/src/components/importExport/ImportExportSteps/FileImport.vue b/packages/hoppscotch-common/src/components/importExport/ImportExportSteps/FileImport.vue index ce83fa8b9..2f2f30a5d 100644 --- a/packages/hoppscotch-common/src/components/importExport/ImportExportSteps/FileImport.vue +++ b/packages/hoppscotch-common/src/components/importExport/ImportExportSteps/FileImport.vue @@ -33,6 +33,7 @@

@@ -59,6 +64,7 @@ import { useI18n } from "@composables/i18n" import { useToast } from "@composables/toast" import { computed, ref } from "vue" +import { platform } from "~/platform" const props = withDefaults( defineProps<{ @@ -74,7 +80,7 @@ const props = withDefaults( const t = useI18n() const toast = useToast() -const ALLOWED_FILE_SIZE_LIMIT = 10 // 10 MB +const ALLOWED_FILE_SIZE_LIMIT = platform.limits?.collectionImportSizeLimit ?? 10 // Default to 10 MB const importFilesCount = ref(0) diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.ts index fb144c262..2550a5a59 100644 --- a/packages/hoppscotch-common/src/platform/index.ts +++ b/packages/hoppscotch-common/src/platform/index.ts @@ -1,19 +1,20 @@ -import { AuthPlatformDef } from "./auth" -import { UIPlatformDef } from "./ui" -import { EnvironmentsPlatformDef } from "./environments" -import { CollectionsPlatformDef } from "./collections" -import { SettingsPlatformDef } from "./settings" -import { HistoryPlatformDef } from "./history" -import { AnalyticsPlatformDef } from "./analytics" -import { InterceptorsPlatformDef } from "./interceptors" -import { HoppModule } from "~/modules" -import { InspectorsPlatformDef } from "./inspectors" import { ServiceClassInstance } from "dioc" -import { IOPlatformDef } from "./io" -import { SpotlightPlatformDef } from "./spotlight" -import { InfraPlatformDef } from "./infra" -import { ExperimentsPlatformDef } from "./experiments" import { Ref } from "vue" +import { HoppModule } from "~/modules" +import { AnalyticsPlatformDef } from "./analytics" +import { AuthPlatformDef } from "./auth" +import { CollectionsPlatformDef } from "./collections" +import { EnvironmentsPlatformDef } from "./environments" +import { ExperimentsPlatformDef } from "./experiments" +import { HistoryPlatformDef } from "./history" +import { InfraPlatformDef } from "./infra" +import { InspectorsPlatformDef } from "./inspectors" +import { InterceptorsPlatformDef } from "./interceptors" +import { IOPlatformDef } from "./io" +import { LimitsPlatformDef } from "./limits" +import { SettingsPlatformDef } from "./settings" +import { SpotlightPlatformDef } from "./spotlight" +import { UIPlatformDef } from "./ui" export type PlatformDef = { ui?: UIPlatformDef @@ -54,6 +55,7 @@ export type PlatformDef = { */ workspaceSwitcherLogin?: Ref } + limits?: LimitsPlatformDef infra?: InfraPlatformDef experiments?: ExperimentsPlatformDef } diff --git a/packages/hoppscotch-common/src/platform/limits.ts b/packages/hoppscotch-common/src/platform/limits.ts new file mode 100644 index 000000000..0e185d585 --- /dev/null +++ b/packages/hoppscotch-common/src/platform/limits.ts @@ -0,0 +1,7 @@ +// Define various limits for the platform +export type LimitsPlatformDef = { + /** + * Assign an import size limit when importing collections + */ + collectionImportSizeLimit?: number +} diff --git a/packages/hoppscotch-selfhost-web/src/main.ts b/packages/hoppscotch-selfhost-web/src/main.ts index 6729c0423..3d5839d4e 100644 --- a/packages/hoppscotch-selfhost-web/src/main.ts +++ b/packages/hoppscotch-selfhost-web/src/main.ts @@ -43,5 +43,8 @@ createHoppApp("#app", { exportAsGIST: false, hasTelemetry: false, }, + limits: { + collectionImportSizeLimit: 50, + }, infra: InfraPlatform, })