From d3955228340a35dfa26b5e0daf6622208c3cf5eb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 22 Oct 2024 09:02:24 +0300 Subject: Unused code cleanup --- src/main/java/com/juick/EmailManager.java | 3 -- .../java/com/juick/config/HttpClientConfig.java | 1 - .../com/juick/service/MessagesServiceImpl.java | 2 - .../java/com/juick/service/TagServiceImpl.java | 3 -- .../java/com/juick/util/xmpp/JidConverter.java | 3 +- .../java/com/juick/www/api/hostmeta/HostMeta.java | 43 ---------------------- .../java/com/juick/www/api/xnodeinfo2/Info.java | 25 ------------- 7 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 src/main/java/com/juick/www/api/hostmeta/HostMeta.java (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/EmailManager.java b/src/main/java/com/juick/EmailManager.java index df02fe1c..37c8e3c5 100644 --- a/src/main/java/com/juick/EmailManager.java +++ b/src/main/java/com/juick/EmailManager.java @@ -33,7 +33,6 @@ import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMultipart; import com.juick.util.HttpBadRequestException; -import com.juick.www.WebApp; import com.juick.service.EmailService; import com.juick.service.MessagesService; import com.juick.service.UserService; @@ -67,8 +66,6 @@ public class EmailManager implements NotificationListener { private UserService userService; @Inject private ObjectMapper jsonMapper; - @Inject - private WebApp webApp; @Value("${web_domain:localhost}") private String webDomain; @Value("${service_email:}") diff --git a/src/main/java/com/juick/config/HttpClientConfig.java b/src/main/java/com/juick/config/HttpClientConfig.java index 9f5182e8..fd94ae4f 100644 --- a/src/main/java/com/juick/config/HttpClientConfig.java +++ b/src/main/java/com/juick/config/HttpClientConfig.java @@ -18,7 +18,6 @@ package com.juick.config; import com.juick.util.ActivityPubRequestInterceptor; -import okhttp3.Dispatcher; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import org.slf4j.Logger; diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index bad080a0..de342977 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -38,8 +38,6 @@ import org.springframework.jdbc.core.ConnectionCallback; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; -import org.springframework.jdbc.core.simple.SimpleJdbcInsert; -import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.lang.NonNull; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/juick/service/TagServiceImpl.java b/src/main/java/com/juick/service/TagServiceImpl.java index 9f5c9356..1eea6812 100644 --- a/src/main/java/com/juick/service/TagServiceImpl.java +++ b/src/main/java/com/juick/service/TagServiceImpl.java @@ -27,15 +27,12 @@ import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.PreparedStatementCallback; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.support.GeneratedKeyHolder; -import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Statement; import java.time.Instant; import java.time.ZoneOffset; import java.time.temporal.ChronoUnit; diff --git a/src/main/java/com/juick/util/xmpp/JidConverter.java b/src/main/java/com/juick/util/xmpp/JidConverter.java index 4f457164..5c40d470 100644 --- a/src/main/java/com/juick/util/xmpp/JidConverter.java +++ b/src/main/java/com/juick/util/xmpp/JidConverter.java @@ -18,13 +18,14 @@ package com.juick.util.xmpp; import org.springframework.core.convert.converter.Converter; +import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; import rocks.xmpp.addr.Jid; public class JidConverter implements Converter { @Nullable @Override - public Jid convert(String jidStr) { + public Jid convert(@NonNull String jidStr) { return Jid.of(jidStr); } } 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 . - */ - -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/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() { -- cgit v1.2.3