personalweb

archived
git clone git://git.wimdupont.com/personalweb.git
Log | Files | Refs | LICENSE

commit a6d032ad65c6f0f913ede4dac4b4d2a0943740c8
parent 765d763cd2d1c42572922df942e6b282fa802035
Author: WimDupont <WimDupont@users.noreply.gitlab.com>
Date:   Tue, 28 Dec 2021 12:18:07 +0100

Contact info + version bump


Former-commit-id: 39ac863a722484707638d991c4e7ad8e1283a4a4
Diffstat:
Mpom.xml | 6+++---
Asrc/main/java/com/wimdupont/personalweb/controller/ContactController.java | 44++++++++++++++++++++++++++++++++++++++++++++
Msrc/main/java/com/wimdupont/personalweb/util/Constants.java | 1+
Asrc/main/resources/templates/contact.html | 27+++++++++++++++++++++++++++
Msrc/main/resources/templates/navigation.html | 1+
5 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> - <version>2.5.6</version> + <version>2.6.2</version> </parent> <groupId>com.wimdupont</groupId> <artifactId>personalweb</artifactId> @@ -15,10 +15,10 @@ <properties> <java.version>11</java.version> - <flyway.maven.plugin.version>8.0.3</flyway.maven.plugin.version> + <flyway.maven.plugin.version>8.3.0</flyway.maven.plugin.version> <asciidoctorj.version>2.5.2</asciidoctorj.version> <rome.version>1.0</rome.version> - <rome.rometools.version>1.16.0</rome.rometools.version> + <rome.rometools.version>1.17.0</rome.rometools.version> </properties> <dependencies> diff --git a/src/main/java/com/wimdupont/personalweb/controller/ContactController.java b/src/main/java/com/wimdupont/personalweb/controller/ContactController.java @@ -0,0 +1,44 @@ +package com.wimdupont.personalweb.controller; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.InputStreamResource; +import org.springframework.core.io.Resource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import static com.wimdupont.personalweb.util.Constants.GPG_PUBLIC_KEY; + +@Slf4j +@Controller +@RequestMapping("/contact") +@SuppressWarnings("unused") +public class ContactController { + + @GetMapping + public String getContact(Model model) { + return "contact"; + } + + @GetMapping(path = "/pubkey.gpg") + public ResponseEntity<Resource> getPublicKey(Model model) { + try { + File file = new File(GPG_PUBLIC_KEY); + InputStreamResource resource = new InputStreamResource(new FileInputStream(file)); + return ResponseEntity.ok() + .contentLength(file.length()) + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .body(resource); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return null; + } +} diff --git a/src/main/java/com/wimdupont/personalweb/util/Constants.java b/src/main/java/com/wimdupont/personalweb/util/Constants.java @@ -7,4 +7,5 @@ import lombok.NoArgsConstructor; public class Constants { public static final String ARTICLES_DIRECTORY = System.getProperty("user.home") + "/personalweb/articles"; + public static final String GPG_PUBLIC_KEY = System.getProperty("user.home") + "/personalweb/gpg/pub.asc"; } diff --git a/src/main/resources/templates/contact.html b/src/main/resources/templates/contact.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html"> +<head> + <meta charset="UTF-8"> + <title>Contact - Wim Dupont</title> + <link href="/css/main.css" rel="stylesheet"> +</head> +<body> +<div class="container wrapper"> + <header> + <h1>Contact</h1> + <div th:insert="navigation"/> + </header> + <p>I do not use any social media websites, nor do I have accounts on any of those platforms (such as Facebook, + LinkedIn, Twitter,...). + If you have any suggestions or questions either technical or in any way related to the content on the site, + please send an email to <a href="mailto: wim@wimdupont.com">wim@wimdupont.com</a>.</p> + <p>You can use GPG to encrypt the email:</p> + <ul> + <li><a href="/contact/pubkey.gpg">Public key file</a></li> + <li>Fingerprint: 3C8D FAC7 8F06 1842 7160 EBDF E62E D9AF 2544 6DFE</li> + </ul> + You could also run following command to import the public key:<br> + <b><kbd>curl -sL https://wimdupont.com/contact/pubkey.gpg | gpg --import</kbd></b><br> +</div> +</body> +</html> diff --git a/src/main/resources/templates/navigation.html b/src/main/resources/templates/navigation.html @@ -3,6 +3,7 @@ <a href="/books">Books</a> <a href="/blog">Blog</a> <a href="/links">Links</a> + <a href="/contact">Contact</a> <div class="right"> <a class="navimg" target="_blank" href="https://gitlab.com/users/WimDupont/projects"> <img alt="Gitlab" title="Gitlab" src="/images/gitlab.png" width="20" height="20">