summaryrefslogtreecommitdiff
path: root/src/remote/activitypub
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-05 18:08:51 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-05 18:08:51 +0900
commit06347cd71e46ce2b991bc8b872cd0725c8862954 (patch)
treed69635b44008bdfb3062a17cddf863281ca72cba /src/remote/activitypub
parentwip (diff)
downloadmisskey-06347cd71e46ce2b991bc8b872cd0725c8862954.tar.gz
misskey-06347cd71e46ce2b991bc8b872cd0725c8862954.tar.bz2
misskey-06347cd71e46ce2b991bc8b872cd0725c8862954.zip
wip
Diffstat (limited to 'src/remote/activitypub')
-rw-r--r--src/remote/activitypub/resolve-person.ts10
-rw-r--r--src/remote/activitypub/resolver.ts8
2 files changed, 11 insertions, 7 deletions
diff --git a/src/remote/activitypub/resolve-person.ts b/src/remote/activitypub/resolve-person.ts
index 28162497f3..c288a2f009 100644
--- a/src/remote/activitypub/resolve-person.ts
+++ b/src/remote/activitypub/resolve-person.ts
@@ -31,7 +31,7 @@ export default async (value, verifier?: string) => {
const user = await User.insert({
avatarId: null,
bannerId: null,
- createdAt: Date.parse(object.published),
+ createdAt: Date.parse(object.published) || null,
description: summaryDOM.textContent,
followersCount: 0,
followingCount: 0,
@@ -55,14 +55,14 @@ export default async (value, verifier?: string) => {
const [avatarId, bannerId] = await Promise.all([
object.icon,
object.image
- ].map(async url => {
- if (url === undefined) {
+ ].map(async img => {
+ if (img === undefined) {
return null;
}
- const img = await uploadFromUrl(url, user);
+ const file = await uploadFromUrl(img.url, user);
- return img._id;
+ return file._id;
}));
User.update({ _id: user._id }, { $set: { avatarId, bannerId } });
diff --git a/src/remote/activitypub/resolver.ts b/src/remote/activitypub/resolver.ts
index de0bba2687..09a6e70056 100644
--- a/src/remote/activitypub/resolver.ts
+++ b/src/remote/activitypub/resolver.ts
@@ -1,6 +1,8 @@
-import { IObject } from "./type";
+import * as request from 'request-promise-native';
+import * as debug from 'debug';
+import { IObject } from './type';
-const request = require('request-promise-native');
+const log = debug('misskey:activitypub:resolver');
export default class Resolver {
private history: Set<string>;
@@ -57,6 +59,8 @@ export default class Resolver {
throw new Error('invalid response');
}
+ log(`resolved: ${JSON.stringify(object)}`);
+
return object;
}
}