-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Mastodon's custom profile fields
- Loading branch information
Showing
10 changed files
with
143 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/smithereen/activitypub/objects/PropertyValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package smithereen.activitypub.objects; | ||
|
||
import org.json.JSONObject; | ||
|
||
import smithereen.Utils; | ||
import smithereen.activitypub.ContextCollector; | ||
import smithereen.activitypub.ParserContext; | ||
import smithereen.jsonld.JLD; | ||
|
||
public class PropertyValue extends ActivityPubObject{ | ||
|
||
public String value; | ||
|
||
public PropertyValue(){} | ||
|
||
public PropertyValue(String name, String value){ | ||
this.name=name; | ||
this.value=value; | ||
} | ||
|
||
@Override | ||
public String getType(){ | ||
return "PropertyValue"; | ||
} | ||
|
||
@Override | ||
protected ActivityPubObject parseActivityPubObject(JSONObject obj, ParserContext parserContext) throws Exception{ | ||
super.parseActivityPubObject(obj, parserContext); | ||
value=Utils.sanitizeHTML(obj.getString("value")); | ||
return this; | ||
} | ||
|
||
@Override | ||
public JSONObject asActivityPubObject(JSONObject obj, ContextCollector contextCollector){ | ||
obj=super.asActivityPubObject(obj, contextCollector); | ||
obj.put("value", value); | ||
contextCollector.addAlias("value", JLD.SCHEMA_ORG+"value"); | ||
contextCollector.addAlias("PropertyValue", JLD.SCHEMA_ORG+"PropertyValue"); | ||
return obj; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters