|
|
|
@ -28,8 +28,7 @@ public class MarkdownApi extends BaseHandler implements MarkdownService { |
|
|
|
public boolean doPost(Path path, HttpExchange ex) throws IOException { |
|
|
|
public boolean doPost(Path path, HttpExchange ex) throws IOException { |
|
|
|
try { |
|
|
|
try { |
|
|
|
addCors(ex); |
|
|
|
addCors(ex); |
|
|
|
Optional<Token> token = SessionToken.from(ex).map(Token::of); |
|
|
|
var user = userService().refreshSession(ex); |
|
|
|
var user = userService().loadUser(token); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (user.isEmpty()) throw UmbrellaException.forbidden("You must be logged in to use the markdown renderer!"); |
|
|
|
if (user.isEmpty()) throw UmbrellaException.forbidden("You must be logged in to use the markdown renderer!"); |
|
|
|
var rendered = Util.markdown(body(ex)); |
|
|
|
var rendered = Util.markdown(body(ex)); |
|
|
|
|