aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/WebApp.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/WebApp.java b/src/main/java/com/juick/www/WebApp.java
index a7c5eb8b..74e0d822 100644
--- a/src/main/java/com/juick/www/WebApp.java
+++ b/src/main/java/com/juick/www/WebApp.java
@@ -42,6 +42,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.resource.ResourceUrlProvider;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
/**
@@ -58,6 +60,8 @@ public class WebApp {
private PebbleEngine pebbleEngine;
@Value("${img_url:http://localhost:8080/i/}")
private String baseImagesUri;
+ @Value("${web_domain:localhost}")
+ private String webDomain;
UriComponentsBuilder avatarBuilder;
@PostConstruct
@@ -106,6 +110,11 @@ public class WebApp {
return avatarBuilder.build().toUriString();
}
+ public String getBaseUrl() {
+ UriComponents builder = ServletUriComponentsBuilder.fromCurrentRequest().replacePath("/").replaceQuery("").build();
+ return builder.toUriString();
+ }
+
public Optional<String> renderPlaintext(String body, String messageUrl) {
PebbleTemplate noteTemplate = pebbleEngine.getTemplate("email/plaintext");
Map<String, Object> context = new HashMap<>();