Update to Quarkus 2.5.1 and resteasy reactive
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -12,10 +12,10 @@
|
|||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<quarkus-plugin.version>1.13.4.Final</quarkus-plugin.version>
|
<quarkus-plugin.version>2.5.1.Final</quarkus-plugin.version>
|
||||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
|
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
|
||||||
<quarkus.platform.version>1.13.4.Final</quarkus.platform.version>
|
<quarkus.platform.version>2.5.1.Final</quarkus.platform.version>
|
||||||
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -32,19 +32,19 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-resteasy</artifactId>
|
<artifactId>quarkus-resteasy-reactive</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-resteasy-qute</artifactId>
|
<artifactId>quarkus-resteasy-reactive-qute</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-resteasy-jackson</artifactId>
|
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
<artifactId>quarkus-resteasy-multipart</artifactId>
|
<artifactId>quarkus-resteasy-reactive-jaxb</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.PathSegment;
|
import javax.ws.rs.core.PathSegment;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
|
||||||
import io.quarkus.security.Authenticated;
|
import io.quarkus.security.Authenticated;
|
||||||
import io.quarkus.security.identity.SecurityIdentity;
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
import io.vertx.core.http.HttpServerRequest;
|
import io.vertx.core.http.HttpServerRequest;
|
||||||
@@ -48,7 +47,7 @@ public class FilePrivateAPI {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/{names: .+}")
|
@Path("/{names: .+}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getFileInfo(@PathParam List<PathSegment> names) {
|
public Response getFileInfo(List<PathSegment> names) {
|
||||||
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
||||||
|| !adventAccessService.checkEventAccess(names)) {
|
|| !adventAccessService.checkEventAccess(names)) {
|
||||||
return Response.status(Response.Status.FORBIDDEN).build();
|
return Response.status(Response.Status.FORBIDDEN).build();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import javax.ws.rs.core.PathSegment;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import io.vertx.core.http.HttpServerRequest;
|
import io.vertx.core.http.HttpServerRequest;
|
||||||
import sh.rhiobet.lalafin.api.model.FileInfo;
|
import sh.rhiobet.lalafin.api.model.FileInfo;
|
||||||
import sh.rhiobet.lalafin.api.model.FileInfoBase;
|
import sh.rhiobet.lalafin.api.model.FileInfoBase;
|
||||||
@@ -24,6 +24,7 @@ import sh.rhiobet.lalafin.api.configuration.FolderApiConfiguration;
|
|||||||
import sh.rhiobet.lalafin.api.configuration.FolderApiConfiguration.Token;
|
import sh.rhiobet.lalafin.api.configuration.FolderApiConfiguration.Token;
|
||||||
import sh.rhiobet.lalafin.api.internal.RSAKey;
|
import sh.rhiobet.lalafin.api.internal.RSAKey;
|
||||||
|
|
||||||
|
@RegisterForReflection
|
||||||
@Path("/api/public/file")
|
@Path("/api/public/file")
|
||||||
public class FilePublicAPI {
|
public class FilePublicAPI {
|
||||||
@Context
|
@Context
|
||||||
@@ -40,7 +41,7 @@ public class FilePublicAPI {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/token/{fileToken}{fileName: (/.*)?}")
|
@Path("/token/{fileToken}{fileName: (/.*)?}")
|
||||||
public Response getFileFromToken(@PathParam String fileToken,
|
public Response getFileFromToken(String fileToken,
|
||||||
@HeaderParam("Range") String range) throws JsonProcessingException {
|
@HeaderParam("Range") String range) throws JsonProcessingException {
|
||||||
String decryptedToken = RSAKey.decrypt(fileToken);
|
String decryptedToken = RSAKey.decrypt(fileToken);
|
||||||
ObjectMapper obj = new ObjectMapper();
|
ObjectMapper obj = new ObjectMapper();
|
||||||
@@ -61,7 +62,7 @@ public class FilePublicAPI {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/folder/{folderToken}/{names: .+}")
|
@Path("/folder/{folderToken}/{names: .+}")
|
||||||
public Response getFolderFile(@PathParam String folderToken, @PathParam List<PathSegment> names,
|
public Response getFolderFile(String folderToken, List<PathSegment> names,
|
||||||
@HeaderParam("Range") String range) {
|
@HeaderParam("Range") String range) {
|
||||||
for (Token token : folderApiConfiguration.tokens()) {
|
for (Token token : folderApiConfiguration.tokens()) {
|
||||||
if (token.value().equals(folderToken)) {
|
if (token.value().equals(folderToken)) {
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import javax.ws.rs.Path;
|
|||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
import org.jboss.resteasy.reactive.MultipartForm;
|
||||||
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
|
|
||||||
import io.quarkus.security.Authenticated;
|
import io.quarkus.security.Authenticated;
|
||||||
import io.quarkus.security.identity.SecurityIdentity;
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
import sh.rhiobet.lalafin.api.model.UploadForm;
|
import sh.rhiobet.lalafin.api.model.UploadForm;
|
||||||
@@ -41,7 +40,7 @@ public class UploadPrivateAPI {
|
|||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{iv}")
|
@Path("/{iv}")
|
||||||
public Response getFile(@PathParam String iv) {
|
public Response getFile(String iv) {
|
||||||
return uploadService.delete(securityIdentity.getPrincipal().getName(), iv);
|
return uploadService.delete(securityIdentity.getPrincipal().getName(), iv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import javax.ws.rs.GET;
|
|||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
import sh.rhiobet.lalafin.upload.UploadService;
|
import sh.rhiobet.lalafin.upload.UploadService;
|
||||||
|
|
||||||
|
@RegisterForReflection
|
||||||
@Path("/api/public/upload")
|
@Path("/api/public/upload")
|
||||||
public class UploadPublicAPI {
|
public class UploadPublicAPI {
|
||||||
@Inject
|
@Inject
|
||||||
@@ -15,7 +16,7 @@ public class UploadPublicAPI {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{user}/{iv}")
|
@Path("/{user}/{iv}")
|
||||||
public Response getFile(@PathParam String user, @PathParam String iv,
|
public Response getFile(String user, String iv,
|
||||||
@QueryParam("password") String password) {
|
@QueryParam("password") String password) {
|
||||||
if (password == null) {
|
if (password == null) {
|
||||||
password = "";
|
password = "";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package sh.rhiobet.lalafin.api.model;
|
package sh.rhiobet.lalafin.api.model;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import javax.ws.rs.FormParam;
|
import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import org.jboss.resteasy.annotations.providers.multipart.PartType;
|
import org.jboss.resteasy.reactive.PartType;
|
||||||
|
import org.jboss.resteasy.reactive.multipart.FileUpload;
|
||||||
|
|
||||||
public class UploadForm {
|
public class UploadForm {
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class UploadForm {
|
|||||||
|
|
||||||
@FormParam("file")
|
@FormParam("file")
|
||||||
@PartType(MediaType.APPLICATION_OCTET_STREAM)
|
@PartType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
public InputStream file;
|
public FileUpload file;
|
||||||
|
|
||||||
@FormParam("password")
|
@FormParam("password")
|
||||||
@PartType(MediaType.TEXT_PLAIN)
|
@PartType(MediaType.TEXT_PLAIN)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.PathSegment;
|
import javax.ws.rs.core.PathSegment;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
|
||||||
import io.quarkus.security.Authenticated;
|
import io.quarkus.security.Authenticated;
|
||||||
import io.quarkus.security.identity.SecurityIdentity;
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
import io.vertx.core.http.HttpServerRequest;
|
import io.vertx.core.http.HttpServerRequest;
|
||||||
@@ -55,7 +54,7 @@ public class FileResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{names: .+}")
|
@Path("/{names: .+}")
|
||||||
public Response serve(@PathParam List<PathSegment> names, @HeaderParam("Range") String range) {
|
public Response serve(List<PathSegment> names, @HeaderParam("Range") String range) {
|
||||||
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
||||||
|| !adventAccessService.checkEventAccess(names)) {
|
|| !adventAccessService.checkEventAccess(names)) {
|
||||||
return Response.status(Response.Status.FORBIDDEN).build();
|
return Response.status(Response.Status.FORBIDDEN).build();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.PathSegment;
|
import javax.ws.rs.core.PathSegment;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
|
||||||
import io.quarkus.security.Authenticated;
|
import io.quarkus.security.Authenticated;
|
||||||
import io.quarkus.security.identity.SecurityIdentity;
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
import io.vertx.core.http.HttpServerRequest;
|
import io.vertx.core.http.HttpServerRequest;
|
||||||
@@ -41,7 +40,7 @@ public class ViewerResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{names: .+}/{page}")
|
@Path("/{names: .+}/{page}")
|
||||||
public Response view(@PathParam List<PathSegment> names, @PathParam int page) {
|
public Response view(List<PathSegment> names, int page) {
|
||||||
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
if (!roleAccessService.checkRouteAccess(securityIdentity.getRoles(), names)
|
||||||
|| !adventAccessService.checkEventAccess(names)) {
|
|| !adventAccessService.checkEventAccess(names)) {
|
||||||
return Response.status(Response.Status.FORBIDDEN).build();
|
return Response.status(Response.Status.FORBIDDEN).build();
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import javax.ws.rs.GET;
|
|||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.jaxrs.PathParam;
|
|
||||||
|
|
||||||
@RolesAllowed("japan7")
|
@RolesAllowed("japan7")
|
||||||
@Path("/nzb")
|
@Path("/nzb")
|
||||||
public class NzbResource {
|
public class NzbResource {
|
||||||
@@ -17,7 +15,7 @@ public class NzbResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/id/{id}")
|
@Path("/id/{id}")
|
||||||
public Response getResult(@PathParam String id) {
|
public Response getResult(String id) {
|
||||||
return resultService.getResult(id);
|
return resultService.getResult(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import javax.inject.Inject;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
import org.jboss.resteasy.reactive.multipart.FileUpload;
|
||||||
import io.quarkus.qute.Location;
|
import io.quarkus.qute.Location;
|
||||||
import io.quarkus.qute.Template;
|
import io.quarkus.qute.Template;
|
||||||
import io.quarkus.qute.TemplateInstance;
|
import io.quarkus.qute.TemplateInstance;
|
||||||
@@ -46,7 +47,7 @@ public class UploadService {
|
|||||||
Template uploadTemplate;
|
Template uploadTemplate;
|
||||||
|
|
||||||
public Response upload(String user, String filename, String passphrase,
|
public Response upload(String user, String filename, String passphrase,
|
||||||
InputStream inputStream) {
|
FileUpload file) {
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
byte ivBytes[] = new byte[16];
|
byte ivBytes[] = new byte[16];
|
||||||
random.nextBytes(ivBytes);
|
random.nextBytes(ivBytes);
|
||||||
@@ -62,7 +63,8 @@ public class UploadService {
|
|||||||
IvParameterSpec iv = new IvParameterSpec(ivBytes);
|
IvParameterSpec iv = new IvParameterSpec(ivBytes);
|
||||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, aesKey, iv);
|
cipher.init(Cipher.ENCRYPT_MODE, aesKey, iv);
|
||||||
CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher);
|
CipherInputStream cipherInputStream = new CipherInputStream(Files.newInputStream(
|
||||||
|
file.uploadedFile()), cipher);
|
||||||
filePath.getParent().toFile().mkdirs();
|
filePath.getParent().toFile().mkdirs();
|
||||||
Files.copy(cipherInputStream, filePath);
|
Files.copy(cipherInputStream, filePath);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<table style="table-layout: fixed; text-align: center">
|
<table style="table-layout: fixed; text-align: center">
|
||||||
{#each info.content}
|
{#each info.content}
|
||||||
{#if count.mod(3) == 1}
|
{#if it_count.mod(3) == 1}
|
||||||
<tr>
|
<tr>
|
||||||
{/if}
|
{/if}
|
||||||
<td>
|
<td>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<a href="{it.directUrl}">
|
<a href="{it.directUrl}">
|
||||||
{/if}{it.filename}</a>
|
{/if}{it.filename}</a>
|
||||||
</td>
|
</td>
|
||||||
{#if count.mod(3) == 0}
|
{#if it_count.mod(3) == 0}
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user