Improve ActivityStream objects
- Add optional fields - Parse json correctly - Add print helper
This commit is contained in:
@@ -12,9 +12,12 @@ import db.db;
|
||||
import net.request_pool;
|
||||
import webfinger;
|
||||
import ap.actor;
|
||||
import ap.util;
|
||||
|
||||
// import ap.util;
|
||||
import std.math.remainder;
|
||||
import util;
|
||||
import ap.activity_stream;
|
||||
import ap.util;
|
||||
|
||||
void commonInit() {
|
||||
auto provider = new DefaultProvider(true, Levels.DEBUG);
|
||||
@@ -42,6 +45,8 @@ void initDatabase(Config cfg) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
import std.stdio;
|
||||
|
||||
commonInit();
|
||||
|
||||
scope (exit) {
|
||||
@@ -49,23 +54,24 @@ void main() {
|
||||
Rp.stop();
|
||||
}
|
||||
|
||||
generateRSA();
|
||||
return;
|
||||
ASObject actor = apResolveRemoteUsername("@marisa@ak.gensokyo.shop");
|
||||
// writeln(actor.raw.toJSON(true));
|
||||
writeln(actor.stringRep);
|
||||
|
||||
Actor marisa = apResolveRemoteUsername("@admin@localhost:8080");
|
||||
infoF!"Actor type: %s"(marisa.type);
|
||||
infoF!"Actor preferredUsername: %s"(marisa.preferredUsername);
|
||||
infoF!"Actor sharedInbox: %s"(marisa.endpoints.sharedInbox);
|
||||
// Actor marisa = apResolveRemoteUsername("@admin@localhost:8080");
|
||||
// infoF!"Actor type: %s"(marisa.type);
|
||||
// infoF!"Actor preferredUsername: %s"(marisa.preferredUsername);
|
||||
// infoF!"Actor sharedInbox: %s"(marisa.endpoints.sharedInbox);
|
||||
|
||||
PRequest followers = PRequest();
|
||||
// PRequest followers = PRequest();
|
||||
|
||||
with (followers) {
|
||||
url = marisa.followers;
|
||||
headers["Accept"] = "application/activity+json";
|
||||
}
|
||||
// with (followers) {
|
||||
// url = marisa.followers;
|
||||
// headers["Accept"] = "application/activity+json";
|
||||
// }
|
||||
|
||||
Response rs = Rp.request(followers, true);
|
||||
infoF!"followers: %s"(rs.responseBody);
|
||||
// Response rs = Rp.request(followers, true);
|
||||
// infoF!"followers: %s"(rs.responseBody);
|
||||
}
|
||||
|
||||
//int main() {
|
||||
|
||||
Reference in New Issue
Block a user