From 389e29881724b90daa466247aef1b8a164511bb9 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 21 Aug 2021 03:49:12 +0300
Subject: ActivityPub: add Application as an actor type
---
.../com/juick/www/api/activity/model/Context.java | 3 +-
.../api/activity/model/objects/Application.java | 25 +++++++++++++++
.../www/api/activity/model/objects/Person.java | 13 +-------
.../api/activity/model/objects/SecurityObject.java | 36 ++++++++++++++++++++++
4 files changed, 64 insertions(+), 13 deletions(-)
create mode 100644 src/main/java/com/juick/www/api/activity/model/objects/Application.java
create mode 100644 src/main/java/com/juick/www/api/activity/model/objects/SecurityObject.java
(limited to 'src/main/java/com/juick/www/api/activity')
diff --git a/src/main/java/com/juick/www/api/activity/model/Context.java b/src/main/java/com/juick/www/api/activity/model/Context.java
index a9d61617..fb726565 100644
--- a/src/main/java/com/juick/www/api/activity/model/Context.java
+++ b/src/main/java/com/juick/www/api/activity/model/Context.java
@@ -52,7 +52,8 @@ import java.util.Map;
@JsonSubTypes.Type(value = Note.class, name = "Note"),
@JsonSubTypes.Type(value = OrderedCollection.class, name = "OrderedCollection"),
@JsonSubTypes.Type(value = OrderedCollectionPage.class, name = "OrderedCollectionPage"),
- @JsonSubTypes.Type(value = Person.class, name = "Person")
+ @JsonSubTypes.Type(value = Person.class, name = "Person"),
+ @JsonSubTypes.Type(value = Application.class, name = "Application")
})
public abstract class Context {
diff --git a/src/main/java/com/juick/www/api/activity/model/objects/Application.java b/src/main/java/com/juick/www/api/activity/model/objects/Application.java
new file mode 100644
index 00000000..23a44e49
--- /dev/null
+++ b/src/main/java/com/juick/www/api/activity/model/objects/Application.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2008-2021, 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.activity.model.objects;
+
+public class Application extends SecurityObject {
+ @Override
+ public String getType() {
+ return "Application";
+ }
+}
diff --git a/src/main/java/com/juick/www/api/activity/model/objects/Person.java b/src/main/java/com/juick/www/api/activity/model/objects/Person.java
index af4ca27d..52626833 100644
--- a/src/main/java/com/juick/www/api/activity/model/objects/Person.java
+++ b/src/main/java/com/juick/www/api/activity/model/objects/Person.java
@@ -18,9 +18,8 @@
package com.juick.www.api.activity.model.objects;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.juick.www.api.activity.model.Context;
-public class Person extends Context {
+public class Person extends SecurityObject {
private String name;
private String preferredUsername;
@@ -29,7 +28,6 @@ public class Person extends Context {
private String outbox;
private String following;
private String followers;
- private Key publicKey;
@Override
public String getType() {
@@ -85,15 +83,6 @@ public class Person extends Context {
this.followers = followers;
}
- @JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
- public Key getPublicKey() {
- return publicKey;
- }
-
- public void setPublicKey(Key publicKey) {
- this.publicKey = publicKey;
- }
-
public String getPreferredUsername() {
return preferredUsername;
}
diff --git a/src/main/java/com/juick/www/api/activity/model/objects/SecurityObject.java b/src/main/java/com/juick/www/api/activity/model/objects/SecurityObject.java
new file mode 100644
index 00000000..8d17aa29
--- /dev/null
+++ b/src/main/java/com/juick/www/api/activity/model/objects/SecurityObject.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2008-2021, 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.activity.model.objects;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.juick.www.api.activity.model.Context;
+
+public class SecurityObject extends Context {
+
+ private Key publicKey;
+
+ @JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
+ public Key getPublicKey() {
+ return publicKey;
+ }
+
+ public void setPublicKey(Key publicKey) {
+ this.publicKey = publicKey;
+ }
+
+}
--
cgit v1.2.3