wip
This commit is contained in:
parent
f5c55d46b7
commit
06347cd71e
4 changed files with 22 additions and 8 deletions
|
|
@ -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 } });
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue