diff --git a/app/http/endpoints/api/export/import.go b/app/http/endpoints/api/export/import.go
index 7e99ebd..84255f3 100644
--- a/app/http/endpoints/api/export/import.go
+++ b/app/http/endpoints/api/export/import.go
@@ -11,6 +11,7 @@ import (
"net/http"
"net/url"
"os"
+ "strconv"
"time"
database2 "github.com/TicketsBot-cloud/database"
@@ -38,6 +39,19 @@ import (
func PresignTranscriptURL(ctx *gin.Context) {
guildId, userId := ctx.Keys["guildid"].(uint64), ctx.Keys["userid"].(uint64)
+ // Get "file_size" query parameter
+ fileSize, err := strconv.ParseInt(ctx.Query("file_size"), 10, 64)
+ if err != nil {
+ ctx.JSON(400, utils.ErrorJson(err))
+ return
+ }
+
+ // Check if file is over 1GB
+ if fileSize > 1024*1024*1024 {
+ ctx.JSON(400, utils.ErrorStr("File size too large"))
+ return
+ }
+
botCtx, err := botcontext.ContextForGuild(guildId)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
diff --git a/frontend/src/includes/Navbar.svelte b/frontend/src/includes/Navbar.svelte
index 00b5b08..f95379e 100644
--- a/frontend/src/includes/Navbar.svelte
+++ b/frontend/src/includes/Navbar.svelte
@@ -20,6 +20,7 @@
Forms
Staff Teams
Integrations
+ Import
{/if}
Tickets
diff --git a/frontend/src/views/Import.svelte b/frontend/src/views/Import.svelte
index 13856c2..f8fd1b6 100644
--- a/frontend/src/views/Import.svelte
+++ b/frontend/src/views/Import.svelte
@@ -164,13 +164,13 @@
if (queryLoading) {
notify(
"Importing...",
- "Your data is taking longer than expected to import, you can safely navigate away from this page and check back later.",
+ "Your data is taking longer than expected to import, if you uploaded transcripts, please wait until you get an import successful message before navigating away from this page.",
);
}
}, 60 * 1000);
if (transcriptFileInput.files.length > 0) {
- const presignRes = await axios.get(`${API_URL}/api/${guildId}/import/presign`);
+ const presignRes = await axios.get(`${API_URL}/api/${guildId}/import/presign?file_size=${transcriptFileInput.files[0].size}`);
if (presignRes.status !== 200) {
notifyError(`Failed to upload transcripts: ${presignRes.data.error}`);
queryLoading = false;
@@ -189,6 +189,8 @@
queryLoading = false;
return;
}
+
+ notifySuccess("Transcripts uploaded successfully");
});
}