File tree Expand file tree Collapse file tree
src/main/java/dev/zenith/web/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,12 +26,12 @@ repositories {
2626
2727dependencies {
2828 zenithProxy(" com.zenith:ZenithProxy:$mc -SNAPSHOT" )
29- shade(" io.javalin:javalin:7.0 .0" )
29+ shade(" io.javalin:javalin:7.1 .0" )
3030
3131 // todo: remove when javalin updates to jackson 3
32- shade(" com.fasterxml.jackson.core:jackson-core:2.20.1 " )
33- shade(" com.fasterxml.jackson.core:jackson-databind:2.20.1 " )
34- shade(" com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.20.1 " )
32+ shade(" com.fasterxml.jackson.core:jackson-core:2.21.2 " )
33+ shade(" com.fasterxml.jackson.core:jackson-databind:2.21.2 " )
34+ shade(" com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.2 " )
3535}
3636
3737tasks {
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ private Javalin createServer() {
9999 config .routes .apiBuilder (() -> {
100100 beforeMatched (ctx -> {
101101 if (ctx .path ().startsWith ("/api" )) {
102+ String ip = ctx .ip ();
102103 if (PLUGIN_CONFIG .rateLimiter ) {
103- String ip = ctx .ip ();
104104 synchronized (this ) {
105105 int reqCount = rateLimitCache .get (ip , () -> 0 );
106106 rateLimitCache .put (ip , reqCount + 1 );
@@ -117,7 +117,7 @@ private Javalin createServer() {
117117 if (authHeaderValue != null ) {
118118 var expectedHeaderValue = PLUGIN_CONFIG .authToken ;
119119 if (authHeaderValue .equals (expectedHeaderValue )) {
120- rateLimitCache .invalidate (ctx . ip () );
120+ rateLimitCache .invalidate (ip );
121121 // ok
122122 return ;
123123 }
@@ -128,7 +128,7 @@ private Javalin createServer() {
128128 ctx .json (new AuthErrorResponse (reason ));
129129 ctx .status (401 );
130130 ctx .skipRemainingHandlers ();
131- LOG .warn ("Denied request from {}: {}" , ctx . ip () , reason );
131+ LOG .warn ("Denied request from {}: {}" , ip , reason );
132132 } else if (!PLUGIN_CONFIG .webUI ) {
133133 ctx .status (404 );
134134 ctx .skipRemainingHandlers ();
You can’t perform that action at this time.
0 commit comments