aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/webfinger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api/webfinger')
-rw-r--r--src/main/java/com/juick/www/api/webfinger/Resource.java14
-rw-r--r--src/main/java/com/juick/www/api/webfinger/model/Account.java22
-rw-r--r--src/main/java/com/juick/www/api/webfinger/model/Link.java31
3 files changed, 8 insertions, 59 deletions
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 d3980511..570ceed3 100644
--- a/src/main/java/com/juick/www/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/www/api/webfinger/Resource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2022, 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
@@ -30,7 +30,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import rocks.xmpp.addr.Jid;
import javax.inject.Inject;
-import java.util.Collections;
+import java.util.List;
import static com.juick.www.api.activity.model.Context.ACTIVITY_MEDIA_TYPE;
@@ -52,14 +52,8 @@ public class Resource {
if (!user.isAnonymous()) {
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri);
builder.path(String.format("/u/%s", user.getName()));
- Link blog = new Link();
- blog.setRel("self");
- blog.setType(ACTIVITY_MEDIA_TYPE);
- blog.setHref(builder.toUriString());
- Account result = new Account();
- result.setSubject(resource);
- result.setLinks(Collections.singletonList(blog));
- return result;
+ Link blog = new Link("self", ACTIVITY_MEDIA_TYPE, builder.toUriString());
+ return new Account(resource, List.of(blog));
}
}
}
diff --git a/src/main/java/com/juick/www/api/webfinger/model/Account.java b/src/main/java/com/juick/www/api/webfinger/model/Account.java
index e0ca5fe9..6dafa7a4 100644
--- a/src/main/java/com/juick/www/api/webfinger/model/Account.java
+++ b/src/main/java/com/juick/www/api/webfinger/model/Account.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2022, 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
@@ -19,23 +19,5 @@ package com.juick.www.api.webfinger.model;
import java.util.List;
-public class Account {
- private String subject;
- private List<Link> links;
-
- public String getSubject() {
- return subject;
- }
-
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- public List<Link> getLinks() {
- return links;
- }
-
- public void setLinks(List<Link> links) {
- this.links = links;
- }
+public record Account (String subject, List<Link> links) {
}
diff --git a/src/main/java/com/juick/www/api/webfinger/model/Link.java b/src/main/java/com/juick/www/api/webfinger/model/Link.java
index 1036d43c..696ccd6d 100644
--- a/src/main/java/com/juick/www/api/webfinger/model/Link.java
+++ b/src/main/java/com/juick/www/api/webfinger/model/Link.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2022, 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
@@ -17,32 +17,5 @@
package com.juick.www.api.webfinger.model;
-public class Link {
- private String rel;
- private String type;
- private String href;
-
- public String getRel() {
- return rel;
- }
-
- public void setRel(String rel) {
- this.rel = rel;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
+public record Link(String rel, String type, String href) {
}