diff options
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r-- | src/main/java/com/juick/www/controllers/Compat.java | 14 |
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(); + } } |