2525
2626package me .lucko .bytebin .http ;
2727
28- import me .lucko .bytebin .Bytebin ;
29- import me .lucko .bytebin .content .ContentLoader ;
30- import me .lucko .bytebin .content .ContentStorageHandler ;
31- import me .lucko .bytebin .util .ExpiryHandler ;
32- import me .lucko .bytebin .util .RateLimitHandler ;
33- import me .lucko .bytebin .util .RateLimiter ;
34- import me .lucko .bytebin .util .TokenGenerator ;
35-
36- import org .apache .logging .log4j .LogManager ;
37- import org .apache .logging .log4j .Logger ;
38-
3928import io .jooby .AssetHandler ;
4029import io .jooby .AssetSource ;
4130import io .jooby .Context ;
4837import io .jooby .StatusCode ;
4938import io .jooby .exception .StatusCodeException ;
5039import io .prometheus .client .Counter ;
40+ import me .lucko .bytebin .Bytebin ;
41+ import me .lucko .bytebin .content .ContentLoader ;
42+ import me .lucko .bytebin .content .ContentStorageHandler ;
43+ import me .lucko .bytebin .http .admin .BulkDeleteHandler ;
44+ import me .lucko .bytebin .util .ExpiryHandler ;
45+ import me .lucko .bytebin .util .RateLimitHandler ;
46+ import me .lucko .bytebin .util .RateLimiter ;
47+ import me .lucko .bytebin .util .TokenGenerator ;
48+ import org .apache .logging .log4j .LogManager ;
49+ import org .apache .logging .log4j .Logger ;
5150
5251import java .time .Duration ;
5352import java .util .Map ;
53+ import java .util .Set ;
5454import java .util .concurrent .CompletionException ;
5555
5656public class BytebinServer extends Jooby {
@@ -64,7 +64,7 @@ public class BytebinServer extends Jooby {
6464 .labelNames ("method" , "useragent" )
6565 .register ();
6666
67- public BytebinServer (ContentStorageHandler storageHandler , ContentLoader contentLoader , String host , int port , boolean metrics , RateLimitHandler rateLimitHandler , RateLimiter postRateLimiter , RateLimiter putRateLimiter , RateLimiter readRateLimiter , TokenGenerator contentTokenGenerator , long maxContentLength , ExpiryHandler expiryHandler , Map <String , String > hostAliases ) {
67+ public BytebinServer (ContentStorageHandler storageHandler , ContentLoader contentLoader , String host , int port , boolean metrics , RateLimitHandler rateLimitHandler , RateLimiter postRateLimiter , RateLimiter putRateLimiter , RateLimiter readRateLimiter , TokenGenerator contentTokenGenerator , long maxContentLength , ExpiryHandler expiryHandler , Map <String , String > hostAliases , Set < String > adminApiKeys ) {
6868 ServerOptions serverOpts = new ServerOptions ();
6969 serverOpts .setHost (host );
7070 serverOpts .setPort (port );
@@ -136,6 +136,10 @@ public BytebinServer(ContentStorageHandler storageHandler, ContentLoader content
136136 get ("/{id:[a-zA-Z0-9]+}" , new GetHandler (this , readRateLimiter , rateLimitHandler , contentLoader ));
137137 put ("/{id:[a-zA-Z0-9]+}" , new PutHandler (this , putRateLimiter , rateLimitHandler , storageHandler , contentLoader , maxContentLength , expiryHandler ));
138138 });
139+
140+ routes (() -> {
141+ post ("/admin/bulkdelete" , new BulkDeleteHandler (this , storageHandler , adminApiKeys ));
142+ });
139143 }
140144
141145 public static String getMetricsLabel (Context ctx ) {
0 commit comments