diff --git a/client2/src/App.svelte b/client2/src/App.svelte index 7453cda..1432b57 100644 --- a/client2/src/App.svelte +++ b/client2/src/App.svelte @@ -12,10 +12,15 @@ let name: string = "" let tweedContent: string = "" let tweeds: Tweed[] = [] + let isAtBottom: boolean = false let finished: boolean = false let skip: number = 0 let limit: number = 5 + + let isRateLimited: boolean = false + let rateLimitError: string = "Stop sending so much fucking tweeds!" + let URL: string = window.location.hostname == "localhost" ? "http://localhost:8080/api/v1/tweeds" : "https://twidderapi.fly.dev/api/v1/tweeds" $: if(isAtBottom && !finished){ (async () => { @@ -52,6 +57,7 @@ tweeds = [tweed, ...tweeds] isLoading = false } catch (error) { + error.message console.log("err:", error) } @@ -99,6 +105,12 @@ + {#if isRateLimited} +
+ {rateLimitError} +
+ {/if} + {#if isLoading}
diff --git a/client2/src/tweed.scss b/client2/src/tweed.scss index 0d15cb0..db074fb 100644 --- a/client2/src/tweed.scss +++ b/client2/src/tweed.scss @@ -128,4 +128,15 @@ form{ color: var(--twidder-blue); font-size: 20px; text-align: center; +} + +.rate-limit-error{ + background-color: rgb(170, 50, 40); + color: white; + + border-radius: 5px; + padding: 20px; + width: 70%; + margin: auto; + margin-top: 20px; } \ No newline at end of file diff --git a/main.go b/main.go index c63d785..4bf5671 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,7 @@ func main(){ app.Use(cors.New()) app.Use(logger.New()) app.Use(limiter.New(limiter.Config{ - Max: 2000, + Max: 30, Expiration: 24 * time.Hour, LimitReached: func(c *fiber.Ctx) error { return c.Status(http.StatusBadRequest).JSON(fiber.Map{ diff --git a/tmp/runner-build.exe b/tmp/runner-build.exe index e02673c..6a49cdd 100644 Binary files a/tmp/runner-build.exe and b/tmp/runner-build.exe differ diff --git a/tmp/runner-build.exe~ b/tmp/runner-build.exe~ index 2b4b3c0..e02673c 100644 Binary files a/tmp/runner-build.exe~ and b/tmp/runner-build.exe~ differ