This commit is contained in:
syuilo 2018-04-09 05:14:47 +09:00
parent 931dc4b1bd
commit d45e2661aa
2 changed files with 9 additions and 1 deletions

View File

@ -3,13 +3,20 @@ import * as debug from 'debug';
import uploadFromUrl from '../../../services/drive/upload-from-url';
import { IRemoteUser } from '../../../models/user';
import { IDriveFile } from '../../../models/drive-file';
import Resolver from '../resolver';
const log = debug('misskey:activitypub');
/**
* Imageを作成します
*/
export async function createImage(actor: IRemoteUser, image): Promise<IDriveFile> {
export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile> {
const image = await new Resolver().resolve(value);
if (image.url == null) {
throw new Error('invalid image: url not privided');
}
log(`Creating the Image: ${image.url}`);
return await uploadFromUrl(image.url, actor);

View File

@ -14,6 +14,7 @@ export interface IObject {
content: string;
icon?: any;
image?: any;
url?: string;
}
export interface IActivity extends IObject {