25
25
26
26
package me .lucko .bytebin .http ;
27
27
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
-
39
28
import io .jooby .AssetHandler ;
40
29
import io .jooby .AssetSource ;
41
30
import io .jooby .Context ;
48
37
import io .jooby .StatusCode ;
49
38
import io .jooby .exception .StatusCodeException ;
50
39
import 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 ;
51
50
52
51
import java .time .Duration ;
53
52
import java .util .Map ;
53
+ import java .util .Set ;
54
54
import java .util .concurrent .CompletionException ;
55
55
56
56
public class BytebinServer extends Jooby {
@@ -64,7 +64,7 @@ public class BytebinServer extends Jooby {
64
64
.labelNames ("method" , "useragent" )
65
65
.register ();
66
66
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 ) {
68
68
ServerOptions serverOpts = new ServerOptions ();
69
69
serverOpts .setHost (host );
70
70
serverOpts .setPort (port );
@@ -136,6 +136,10 @@ public BytebinServer(ContentStorageHandler storageHandler, ContentLoader content
136
136
get ("/{id:[a-zA-Z0-9]+}" , new GetHandler (this , readRateLimiter , rateLimitHandler , contentLoader ));
137
137
put ("/{id:[a-zA-Z0-9]+}" , new PutHandler (this , putRateLimiter , rateLimitHandler , storageHandler , contentLoader , maxContentLength , expiryHandler ));
138
138
});
139
+
140
+ routes (() -> {
141
+ post ("/admin/bulkdelete" , new BulkDeleteHandler (this , storageHandler , adminApiKeys ));
142
+ });
139
143
}
140
144
141
145
public static String getMetricsLabel (Context ctx ) {
0 commit comments