aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/controllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-22 05:43:40 +0300
committerGravatar Vitaly Takmazov2022-12-22 05:43:40 +0300
commitf8406131fdbe835c52fd46ad68ddc7b0df54cffe (patch)
tree9ded6a40956ce2f45705c1975b9109aa1fa63159 /src/main/java/com/juick/www/controllers
parentd4df81c28908c593c2b59f2596e4e380492b32d0 (diff)
`@username@example.com` urls are now redirects to ActivityPub profile
Diffstat (limited to 'src/main/java/com/juick/www/controllers')
-rw-r--r--src/main/java/com/juick/www/controllers/Compat.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/controllers/Compat.java b/src/main/java/com/juick/www/controllers/Compat.java
index ebf584dc..936a8e5c 100644
--- a/src/main/java/com/juick/www/controllers/Compat.java
+++ b/src/main/java/com/juick/www/controllers/Compat.java
@@ -17,17 +17,31 @@
package com.juick.www.controllers;
+import com.juick.SignatureManager;
+import com.juick.util.HttpNotFoundException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.view.RedirectView;
+import javax.inject.Inject;
+
@Controller
public class Compat {
+ @Inject
+ private SignatureManager signatureManager;
@GetMapping("/share")
public RedirectView share(@RequestParam String text, RedirectAttributes attributes) {
attributes.addAttribute("body", text);
return new RedirectView("/post");
}
+ @GetMapping("/mention")
+ public RedirectView mention(@RequestParam String username) {
+ var profile = signatureManager.discoverPerson(username);
+ if (profile.isPresent()) {
+ return new RedirectView(profile.get().getUrl());
+ }
+ throw new HttpNotFoundException();
+ }
}