Fix bug
This commit is contained in:
parent
49ad86498e
commit
d8a87379ca
2 changed files with 9 additions and 1 deletions
|
@ -3,13 +3,20 @@ import * as debug from 'debug';
|
||||||
import uploadFromUrl from '../../../services/drive/upload-from-url';
|
import uploadFromUrl from '../../../services/drive/upload-from-url';
|
||||||
import { IRemoteUser } from '../../../models/user';
|
import { IRemoteUser } from '../../../models/user';
|
||||||
import { IDriveFile } from '../../../models/drive-file';
|
import { IDriveFile } from '../../../models/drive-file';
|
||||||
|
import Resolver from '../resolver';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imageを作成します。
|
* 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}`);
|
log(`Creating the Image: ${image.url}`);
|
||||||
|
|
||||||
return await uploadFromUrl(image.url, actor);
|
return await uploadFromUrl(image.url, actor);
|
||||||
|
|
|
@ -14,6 +14,7 @@ export interface IObject {
|
||||||
content: string;
|
content: string;
|
||||||
icon?: any;
|
icon?: any;
|
||||||
image?: any;
|
image?: any;
|
||||||
|
url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IActivity extends IObject {
|
export interface IActivity extends IObject {
|
||||||
|
|
Loading…
Reference in a new issue