Compare commits
9 Commits
bugfix/mai
...
bugfix/tim
| Author | SHA1 | Date | |
|---|---|---|---|
| cf0cf2f5e9 | |||
| 1302165ab2 | |||
| d08138c9e1 | |||
| 4cd1ea3277 | |||
| 1059164b4a | |||
| f438bea4cc | |||
| 9394ca597c | |||
| 53fe79fbbd | |||
| d62534b3eb |
@@ -17,13 +17,14 @@ RUN gradle --no-daemon build
|
||||
|
||||
|
||||
FROM alpine
|
||||
RUN apk add bash fontconfig font-opensans graphviz openjdk21-jre weasyprint
|
||||
RUN apk add bash fontconfig font-opensans graphviz openjdk21-jre tzdata weasyprint
|
||||
RUN adduser -D umbrella
|
||||
COPY --from=java_build /Umbrella/backend/build/libs/backend.jar /home/umbrella/jar/
|
||||
RUN chown -R umbrella /home/umbrella
|
||||
ADD https://github.com/plantuml/plantuml/releases/download/v1.2025.10/plantuml-1.2025.10.jar /home/umbrella/plantuml.jar
|
||||
USER umbrella
|
||||
WORKDIR /home/umbrella
|
||||
RUN chmod a+rx plantuml.jar && ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
||||
USER umbrella
|
||||
RUN mkdir .config && ln -s /host/config.json .config/Umbrella.json
|
||||
EXPOSE 80
|
||||
CMD java -jar jar/backend.jar
|
||||
|
||||
@@ -35,11 +35,12 @@ import org.json.JSONObject;
|
||||
|
||||
public class Util {
|
||||
public static final System.Logger LOG = System.getLogger("Util");
|
||||
private static final Pattern UML_PATTERN = Pattern.compile("@start(\\w+)(.*)@end(\\1)",Pattern.DOTALL);
|
||||
private static final Pattern UML_PATTERN = Pattern.compile("@start(\\w+)(.*?)@end(\\1)",Pattern.DOTALL);
|
||||
private static File plantumlJar = null;
|
||||
private static final JParsedown MARKDOWN = new JParsedown();
|
||||
public static final String SHA1 = "SHA-1";
|
||||
private static final MessageDigest SHA1_DIGEST;
|
||||
private static final Map<Integer,String> umlCache = new HashMap<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -79,11 +80,22 @@ public class Util {
|
||||
try {
|
||||
if (plantumlJar != null && plantumlJar.exists()) {
|
||||
var matcher = UML_PATTERN.matcher(source);
|
||||
if (matcher.find()) {
|
||||
while (matcher.find()) {
|
||||
var uml = matcher.group(0).trim();
|
||||
var start = matcher.start(0);
|
||||
var end = matcher.end(0);
|
||||
|
||||
var umlHash = uml.hashCode();
|
||||
LOG.log(DEBUG,"Hash of Plantuml code: {0}",umlHash);
|
||||
var svg = umlCache.get(umlHash);
|
||||
if (svg != null){
|
||||
LOG.log(DEBUG,"Serving Plantuml generated SVG from cache…");
|
||||
source = source.substring(0, start) + svg + source.substring(end);
|
||||
matcher = UML_PATTERN.matcher(source);
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG.log(DEBUG,"Cache miss. Generating SVG from plantuml code…");
|
||||
ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", plantumlJar.getAbsolutePath(), "-tsvg", "-pipe");
|
||||
var ignored = processBuilder.redirectErrorStream();
|
||||
var process = processBuilder.start();
|
||||
@@ -94,8 +106,11 @@ public class Util {
|
||||
|
||||
try (InputStream is = process.getInputStream()) {
|
||||
byte[] out = is.readAllBytes();
|
||||
var svg = new String(out, UTF_8);
|
||||
LOG.log(DEBUG,"Generated SVG. Pushing to cache…");
|
||||
svg = new String(out, UTF_8);
|
||||
umlCache.put(umlHash,svg);
|
||||
source = source.substring(0, start) + svg + source.substring(end);
|
||||
matcher = UML_PATTERN.matcher(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package de.srsoftware.umbrella.message;
|
||||
|
||||
public class Constants {
|
||||
public static final String AUTH = "mail.smtp.auth";
|
||||
|
||||
public static final String CONFIG_DB = "umbrella.modules.message.database";
|
||||
public static final String CONFIG_SMTP_HOST = "umbrella.modules.message.smtp.host";
|
||||
@@ -10,11 +11,13 @@ public class Constants {
|
||||
public static final String CONFIG_SMTP_USER = "umbrella.modules.message.smtp.user";
|
||||
|
||||
public static final String DEBUG_ADDREESS = "umbrella.modules.message.debug_address";
|
||||
public static final String SMTP_AUTH = "mail.smtp.auth";
|
||||
public static final String SMTP_HOST = "mail.smtp.host";
|
||||
public static final String SMTP_FROM = "mail.smtp.from";
|
||||
public static final String SMTP_PORT = "mail.smtp.port";
|
||||
public static final String SMTP_SSL = "mail.smtp.ssl.enable";
|
||||
public static final String ENVELOPE_FROM = "mail.smtp.from";
|
||||
public static final String FIELD_MESSAGES = "messages";
|
||||
public static final String FIELD_HOST = "host";
|
||||
public static final String FIELD_PORT = "port";
|
||||
public static final String HOST = "mail.smtp.host";
|
||||
public static final String PORT = "mail.smtp.port";
|
||||
public static final String SSL = "mail.smtp.ssl.enable";
|
||||
public static final String SUBMISSION = "submission";
|
||||
|
||||
}
|
||||
|
||||
@@ -142,11 +142,11 @@ public class MessageSystem implements PostBox {
|
||||
private Session session() {
|
||||
if (session == null){
|
||||
Properties props = new Properties();
|
||||
props.put(SMTP_HOST, host);
|
||||
props.put(SMTP_PORT, port);
|
||||
props.put(SMTP_AUTH, true);
|
||||
props.put(SMTP_SSL, true);
|
||||
props.put(SMTP_FROM,from);
|
||||
props.put(HOST, host);
|
||||
props.put(PORT, port);
|
||||
props.put(AUTH, true);
|
||||
props.put(SSL, true);
|
||||
props.put(ENVELOPE_FROM,from);
|
||||
session = Session.getInstance(props);
|
||||
}
|
||||
return session;
|
||||
|
||||
@@ -57,8 +57,9 @@ footer {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
img {
|
||||
img, svg {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
nav {
|
||||
|
||||
@@ -57,8 +57,9 @@ footer {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
img {
|
||||
img, svg {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
nav {
|
||||
|
||||
@@ -57,17 +57,18 @@ footer {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
img {
|
||||
img, svg {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
nav {
|
||||
position: sticky;
|
||||
z-index: 100;
|
||||
top: 0;
|
||||
padding: 5px;
|
||||
margin: 0 0 10px 0;
|
||||
border-bottom: 1px solid;
|
||||
position: sticky;
|
||||
z-index: 100;
|
||||
top: 0;
|
||||
padding: 5px;
|
||||
margin: 0 0 10px 0;
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
|
||||
td, tr{
|
||||
|
||||
Reference in New Issue
Block a user