diff --git a/back/src/org/kar/karusic/WebLauncher.java b/back/src/org/kar/karusic/WebLauncher.java
index 4df824e..f90e54e 100755
--- a/back/src/org/kar/karusic/WebLauncher.java
+++ b/back/src/org/kar/karusic/WebLauncher.java
@@ -36,6 +36,7 @@ public class WebLauncher {
}
public static void main(String[] args) {
+ ConfigBaseVariable.bdDatabase = "karusic";
//
// if (false) {
diff --git a/back/src/org/kar/karusic/WebLauncherLocal.java b/back/src/org/kar/karusic/WebLauncherLocal.java
new file mode 100755
index 0000000..65df43f
--- /dev/null
+++ b/back/src/org/kar/karusic/WebLauncherLocal.java
@@ -0,0 +1,17 @@
+package org.kar.karusic;
+
+import org.kar.archidata.util.ConfigBaseVariable;
+
+public class WebLauncherLocal {
+ private WebLauncherLocal() {}
+
+ public static void main(String[] args) throws InterruptedException {
+ if (true) {
+ // for local test:
+ ConfigBaseVariable.apiAdress = "http://0.0.0.0:19080/karusic/api/";
+ ConfigBaseVariable.dbPort = "3306";
+ ConfigBaseVariable.ssoAdress = "http://localhost:15080/karauth/api/";
+ }
+ WebLauncher.main(args);
+ }
+}
diff --git a/back/src/org/kar/karusic/api/AlbumResource.java b/back/src/org/kar/karusic/api/AlbumResource.java
index 44f048a..523c3fb 100644
--- a/back/src/org/kar/karusic/api/AlbumResource.java
+++ b/back/src/org/kar/karusic/api/AlbumResource.java
@@ -7,7 +7,7 @@ import org.kar.archidata.util.DataTools;
import org.kar.karusic.model.Album;
import org.kar.karusic.model.Track;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/back/src/org/kar/karusic/api/ArtistResource.java b/back/src/org/kar/karusic/api/ArtistResource.java
index c7ec8dd..43bd325 100644
--- a/back/src/org/kar/karusic/api/ArtistResource.java
+++ b/back/src/org/kar/karusic/api/ArtistResource.java
@@ -6,7 +6,7 @@ import org.kar.karusic.model.Artist;
import org.kar.archidata.SqlWrapper;
import org.kar.archidata.util.DataTools;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/back/src/org/kar/karusic/api/DataResource.java b/back/src/org/kar/karusic/api/DataResource.java
index 60d6b0d..6a65eb6 100644
--- a/back/src/org/kar/karusic/api/DataResource.java
+++ b/back/src/org/kar/karusic/api/DataResource.java
@@ -3,15 +3,15 @@ package org.kar.karusic.api;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.kar.archidata.GlobalConfiguration;
-import org.kar.archidata.annotation.PermitTokenInURI;
+import org.kar.archidata.annotation.security.PermitTokenInURI;
import org.kar.archidata.filter.GenericContext;
import org.kar.archidata.util.ConfigBaseVariable;
import org.kar.archidata.util.DataTools;
import org.kar.archidata.db.DBEntry;
import org.kar.karusic.model.DataSmall;
-import javax.annotation.security.PermitAll;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.PermitAll;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.imageio.ImageIO;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
@@ -23,6 +23,7 @@ import javax.ws.rs.core.StreamingOutput;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
+import java.nio.file.Files;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -90,8 +91,8 @@ public class DataResource {
DataSmall value = getSmall(id);
if (value == null) {
Response.status(404).
- entity("media NOT FOUND: " + id).
- type("text/plain").
+ entity("{\"error\":\"media NOT FOUND: " + id + "\"}").
+ type("application/json").
build();
}
return buildStream(ConfigBaseVariable.getMediaDataFolder() + File.separator + id + File.separator + "data", range, value.mimeType);
@@ -108,20 +109,27 @@ public class DataResource {
System.out.println("===================================================");
System.out.println("== DATA retriveDataThumbnailId ? " + (gc==null?"null":gc.user));
System.out.println("===================================================");
+ System.out.println("==id = " + id);
DataSmall value = getSmall(id);
if (value == null) {
return Response.status(404).
- entity("media NOT FOUND: " + id).
- type("text/plain").
+ entity("{\"error\":\"media NOT FOUND: " + id + "\"}").
+ type("application/json").
build();
}
String filePathName = ConfigBaseVariable.getMediaDataFolder() + File.separator + id + File.separator + "data";
+ File inputFile = new File(filePathName);
+ if (!inputFile.exists()) {
+ return Response.status(404).
+ entity("{\"error\":\"media Does not exist: " + id + "\"}").
+ type("application/json").
+ build();
+ }
if ( value.mimeType.contentEquals("image/jpeg")
|| value.mimeType.contentEquals("image/png")
// || value.mimeType.contentEquals("image/webp")
) {
// reads input image
- File inputFile = new File(filePathName);
BufferedImage inputImage = ImageIO.read(inputFile);
int scaledWidth = 250;
int scaledHeight = (int)((float)inputImage.getHeight() / (float)inputImage.getWidth() * (float) scaledWidth);
diff --git a/back/src/org/kar/karusic/api/Front.java b/back/src/org/kar/karusic/api/Front.java
index 2a6229a..3c10f9c 100644
--- a/back/src/org/kar/karusic/api/Front.java
+++ b/back/src/org/kar/karusic/api/Front.java
@@ -3,7 +3,7 @@ package org.kar.karusic.api;
import java.io.File;
import java.util.List;
-import javax.annotation.security.PermitAll;
+import org.kar.archidata.annotation.security.PermitAll;
import javax.ws.rs.*;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.PathSegment;
diff --git a/back/src/org/kar/karusic/api/GenderResource.java b/back/src/org/kar/karusic/api/GenderResource.java
index 23b3ebd..343d300 100644
--- a/back/src/org/kar/karusic/api/GenderResource.java
+++ b/back/src/org/kar/karusic/api/GenderResource.java
@@ -7,7 +7,7 @@ import org.kar.karusic.model.Gender;
import org.kar.archidata.SqlWrapper;
import org.kar.archidata.util.DataTools;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/back/src/org/kar/karusic/api/HealthCheck.java b/back/src/org/kar/karusic/api/HealthCheck.java
index d0c732a..7e3ea9e 100644
--- a/back/src/org/kar/karusic/api/HealthCheck.java
+++ b/back/src/org/kar/karusic/api/HealthCheck.java
@@ -1,6 +1,6 @@
package org.kar.karusic.api;
-import javax.annotation.security.PermitAll;
+import org.kar.archidata.annotation.security.PermitAll;
import javax.ws.rs.core.Response;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
diff --git a/back/src/org/kar/karusic/api/PlaylistResource.java b/back/src/org/kar/karusic/api/PlaylistResource.java
index 2e29744..55520f8 100644
--- a/back/src/org/kar/karusic/api/PlaylistResource.java
+++ b/back/src/org/kar/karusic/api/PlaylistResource.java
@@ -6,7 +6,7 @@ import org.kar.karusic.model.Playlist;
import org.kar.archidata.SqlWrapper;
import org.kar.archidata.util.DataTools;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/back/src/org/kar/karusic/api/TrackResource.java b/back/src/org/kar/karusic/api/TrackResource.java
index 447c403..876841e 100644
--- a/back/src/org/kar/karusic/api/TrackResource.java
+++ b/back/src/org/kar/karusic/api/TrackResource.java
@@ -10,7 +10,7 @@ import org.kar.karusic.model.Track;
import org.kar.archidata.SqlWrapper;
import org.kar.archidata.util.DataTools;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/back/src/org/kar/karusic/api/UserResource.java b/back/src/org/kar/karusic/api/UserResource.java
index 08dc746..5aa5752 100755
--- a/back/src/org/kar/karusic/api/UserResource.java
+++ b/back/src/org/kar/karusic/api/UserResource.java
@@ -2,14 +2,13 @@ package org.kar.karusic.api;
import org.kar.archidata.GlobalConfiguration;
import org.kar.archidata.SqlWrapper;
-import org.kar.karusic.WebLauncher;
import org.kar.archidata.db.DBEntry;
import org.kar.archidata.filter.GenericContext;
import org.kar.archidata.model.User;
import org.kar.karusic.model.UserKarusic;
-import javax.annotation.security.PermitAll;
-import javax.annotation.security.RolesAllowed;
+import org.kar.archidata.annotation.security.PermitAll;
+import org.kar.archidata.annotation.security.RolesAllowed;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
diff --git a/front/readme.md b/front/readme.md
index 821c2d2..a3d92cc 100644
--- a/front/readme.md
+++ b/front/readme.md
@@ -39,4 +39,5 @@ docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest .
docker login gitea.atria-soft.org
-docker push gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest
\ No newline at end of file
+docker push gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest
+
diff --git a/front/src/app/app.component.html b/front/src/app/app.component.html
index 1f42444..0cef3c0 100644
--- a/front/src/app/app.component.html
+++ b/front/src/app/app.component.html
@@ -1,10 +1,5 @@
-