bad nea
This commit is contained in:
parent
be6cc9c317
commit
a87a545659
1 changed files with 3 additions and 0 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
package dev.exhq;
|
package dev.exhq;
|
||||||
|
|
||||||
import io.javalin.Javalin;
|
import io.javalin.Javalin;
|
||||||
|
import io.javalin.http.util.NaiveRateLimit;
|
||||||
import io.javalin.websocket.WsContext;
|
import io.javalin.websocket.WsContext;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
@ -18,6 +20,7 @@ public class Main {
|
||||||
AtomicReference<WsContext> client = new AtomicReference<>();
|
AtomicReference<WsContext> client = new AtomicReference<>();
|
||||||
Javalin app = Javalin.create();
|
Javalin app = Javalin.create();
|
||||||
app.post("/send", ctx -> {
|
app.post("/send", ctx -> {
|
||||||
|
NaiveRateLimit.requestPerTimeUnit(ctx, 3, TimeUnit.MINUTES);
|
||||||
if (client.get() == null) {
|
if (client.get() == null) {
|
||||||
ctx.status(400).result("echo was not found");
|
ctx.status(400).result("echo was not found");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue