This commit is contained in:
2025-10-03 02:36:18 +02:00
parent 492e35179d
commit a88eb69be5
4 changed files with 110 additions and 89 deletions

View File

@@ -1,57 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-23">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-23">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

26
pom.xml
View File

@@ -46,12 +46,19 @@
<version>4.5.13</version>
</dependency>
<!-- Vert.X Mail Clien -->
<!-- Vert.X Mail Client -->
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-mail-client</artifactId>
<version>4.5.16</version>
</dependency>
<!-- Vert.X Redis Client -->
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-redis-client</artifactId>
<version>4.5.16</version>
</dependency>
<!-- Gson -->
<dependency>
@@ -60,14 +67,14 @@
<version>2.12.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mindrot/jbcrypt -->
<!-- BCrypt -->
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<!-- JWT -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
@@ -87,24 +94,25 @@
<version>1.5.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.18.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.mail/jakarta.mail -->
<!-- Jakarta Mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.github.eduardomcb</groupId>
<artifactId>discord-webhook</artifactId>
<version>1.0.0</version>
<!-- Discord Webhook -->
<dependency>
<groupId>com.github.eduardomcb</groupId>
<artifactId>discord-webhook</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>

View File

@@ -58,38 +58,47 @@ public class ConfigManager {
}
public String getHomeDir() {
return getOS() == OSType.WINDOWS ?
if (isDocker()) {
return "/data/";
}
return getOS() == OSType.WINDOWS ?
"C:/Users/" + System.getProperty("user.name") + "/" :
System.getProperty("user.home").contains("root") ? "/root/" :
"/home/" + System.getProperty("user.name") + "/";
}
public String getBaseDir() {
return getHomeDir() +
(getOS() == OSType.WINDOWS ? ".miarmacoreapi/" :
getOS() == OSType.LINUX ? ".config/miarmacoreapi/" :
".contaminus/");
}
if (isDocker()) {
return getHomeDir() + ".config/";
}
return getHomeDir() + (getOS() == OSType.WINDOWS ? ".miarmacoreapi/" :
getOS() == OSType.LINUX ? ".config/miarmacoreapi/" :
".contaminus/");
}
public String getFilesDir(String context) {
return config.getProperty("files.dir") != null ?
config.getProperty("files.dir") :
(getOS() == OSType.WINDOWS ?
System.getProperty("user.home") + "\\" + "Documents\\" + context + "\\" :
getOS() == OSType.LINUX ?
"/var/www/files/" + context + "/" :
null);
if (config.getProperty("files.dir") != null) {
return config.getProperty("files.dir");
}
if (isDocker()) {
return "/files/" + context + "/";
}
return getOS() == OSType.WINDOWS ?
System.getProperty("user.home") + "\\" + "Documents\\" + context + "\\" :
"/var/www/files/" + context + "/";
}
public String getModsDir() {
return getFilesDir("miarmacraft") + "mods/";
return getFilesDir("miarmacraft") + "mods/";
}
public String getWebRoot() {
return config.getProperty("web.root") != null ?
config.getProperty("web.root") :
getBaseDir() + "webroot/";
}
if (config.getProperty("web.root") != null) {
return config.getProperty("web.root");
}
return getBaseDir() + "webroot/";
}
public static OSType getOS() {
String os = System.getProperty("os.name").toLowerCase();
@@ -102,6 +111,10 @@ public class ConfigManager {
}
}
public static boolean isDocker() {
return Boolean.parseBoolean(System.getenv("RUNNING_IN_DOCKER"));
}
public String getStringProperty(String key) {
return config.getProperty(key);
}

View File

@@ -26,7 +26,7 @@ public class ScreenshotHandler {
}
String encodedUrl = URLEncoder.encode(url, StandardCharsets.UTF_8);
String microserviceUrl = "http://localhost:7000/screenshot?url=" + encodedUrl;
String microserviceUrl = "http://screenshoter:7000/screenshot?url=" + encodedUrl;
webClient.getAbs(microserviceUrl)
.send(ar -> {