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/api/Mastodon.java2
-rw-r--r--src/main/java/com/juick/www/api/hostmeta/HostMeta.java43
-rw-r--r--src/main/java/com/juick/www/api/webfinger/Resource.java47
-rw-r--r--src/main/java/com/juick/www/api/xnodeinfo2/Info.java25
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java2
5 files changed, 2 insertions, 117 deletions
diff --git a/src/main/java/com/juick/www/api/Mastodon.java b/src/main/java/com/juick/www/api/Mastodon.java
index 220963c1..ca3687e7 100644
--- a/src/main/java/com/juick/www/api/Mastodon.java
+++ b/src/main/java/com/juick/www/api/Mastodon.java
@@ -164,7 +164,7 @@ public class Mastodon {
) {
}
- @GetMapping({"/api/v1/instance", "/api/v2/instance"})
+ @GetMapping("/api/v1/instance")
public Instance getInstance() {
return new Instance(domain, "Microblogging service", "Juick", "2.x","support@juick.com");
}
diff --git a/src/main/java/com/juick/www/api/hostmeta/HostMeta.java b/src/main/java/com/juick/www/api/hostmeta/HostMeta.java
deleted file mode 100644
index c6f1dce6..00000000
--- a/src/main/java/com/juick/www/api/hostmeta/HostMeta.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2008-2020, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.juick.www.api.hostmeta;
-
-import com.cliqset.xrd.Link;
-import com.cliqset.xrd.XRD;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Collections;
-
-import static com.cliqset.xrd.XRDConstants.XRD_MEDIA_TYPE;
-
-@RestController
-public class HostMeta {
- @Value("${ap_base_uri:http://localhost:8080/}")
- private String baseUri;
- @GetMapping(value = "/.well-known/host-meta", produces = { XRD_MEDIA_TYPE, MediaType.APPLICATION_XML_VALUE })
- public XRD hostMetaResponse() {
- Link webfinger = new Link();
- webfinger.setTemplate(String.format("%swebfinger?resource={uri}", baseUri));
- XRD xrd = new XRD();
- xrd.setLinks(Collections.singletonList(webfinger));
- return xrd;
- }
-}
diff --git a/src/main/java/com/juick/www/api/webfinger/Resource.java b/src/main/java/com/juick/www/api/webfinger/Resource.java
index 1de205df..3f04097c 100644
--- a/src/main/java/com/juick/www/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/www/api/webfinger/Resource.java
@@ -17,53 +17,6 @@
package com.juick.www.api.webfinger;
-import com.juick.model.User;
-import com.juick.www.api.webfinger.model.Account;
-import com.juick.www.api.webfinger.model.Link;
-import com.juick.util.HttpNotFoundException;
-import com.juick.service.UserService;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriComponentsBuilder;
-import rocks.xmpp.addr.Jid;
-
-import jakarta.inject.Inject;
-import java.util.List;
-
-import static com.juick.www.api.activity.model.Context.ACTIVITY_MEDIA_TYPE;
-
-@RestController
public class Resource {
public static final String MEDIA_TYPE = "application/jrd+json";
- @Inject
- private UserService userService;
- @Value("${web_domain:localhost}")
- private String domain;
- @Value("${ap_base_uri:http://localhost:8080/}")
- private String baseUri;
-
- @GetMapping(value = "/.well-known/webfinger", produces = {
- Resource.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE })
- public Account getWebResource(@RequestParam String resource) {
- if (resource.startsWith("acct:")) {
- try {
- Jid account = Jid.of(resource.substring(5));
- if (account.getDomain().equals(domain)) {
- User user = userService.getUserByName(account.getLocal());
- if (!user.isAnonymous()) {
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri);
- builder.path(String.format("/u/%s", user.getName()));
- Link blog = new Link("self", ACTIVITY_MEDIA_TYPE, builder.toUriString());
- return new Account(resource, List.of(blog));
- }
- }
- } catch (NullPointerException | IllegalArgumentException e) {
- throw new HttpNotFoundException();
- }
- }
- throw new HttpNotFoundException();
- }
}
diff --git a/src/main/java/com/juick/www/api/xnodeinfo2/Info.java b/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
index fc27dc66..adbd5712 100644
--- a/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
+++ b/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
@@ -17,27 +17,14 @@
package com.juick.www.api.xnodeinfo2;
-import com.cliqset.xrd.Link;
-import com.cliqset.xrd.XRD;
import com.fasterxml.jackson.annotation.JsonView;
import com.juick.service.InfoService;
import com.juick.www.api.xnodeinfo2.model.*;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.MediaType;
-import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriComponentsBuilder;
-
import jakarta.inject.Inject;
-import java.net.URI;
-import java.time.ZonedDateTime;
-import java.time.temporal.ChronoUnit;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
@RestController
public class Info {
@@ -53,18 +40,6 @@ public class Info {
return infoService.getCurrentNodeInfo("1.0");
}
- @GetMapping(value = "/.well-known/nodeinfo", produces = MediaType.APPLICATION_JSON_VALUE)
- public XRD getNodeInfoLinks() {
- Link nodeinfo = new Link();
- nodeinfo.setRel(URI.create("http://nodeinfo.diaspora.software/ns/schema/2.0"));
- UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseUri);
- uriComponentsBuilder.replacePath("/api/nodeinfo/2.0");
- nodeinfo.setHref(uriComponentsBuilder.build().toUri());
- XRD xrd = new XRD();
- xrd.setLinks(Collections.singletonList(nodeinfo));
- return xrd;
- }
-
@GetMapping(value = "/api/nodeinfo/2.0", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(NodeInfo.NodeInfoView.class)
public NodeInfo showNodeInfo() {
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index 449275c3..11f31efb 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -194,7 +194,7 @@ public class Settings {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("account")));
message.setSubject("Juick authorization link");
message.setText(String.format("Follow link to attach this email to Juick account:\n" +
- "http://juick.com/settings?page=auth-email&code=%s\n\n" +
+ "https://juick.com/settings?page=auth-email&code=%s\n\n" +
"If you don't know, what this mean - just ignore this mail.\n", authCode));
Transport.send(message);
result = "<p>Authorization link has been sent to your email. Follow it to proceed.</p>" +