wip
This commit is contained in:
parent
3ef82ccb62
commit
08beb45935
22 changed files with 332 additions and 241 deletions
29
src/remote/activitypub/objects/image.ts
Normal file
29
src/remote/activitypub/objects/image.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import * as debug from 'debug';
|
||||
|
||||
import uploadFromUrl from '../../../services/drive/upload-from-url';
|
||||
import { IRemoteUser } from '../../../models/user';
|
||||
import { IDriveFile } from '../../../models/drive-file';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
/**
|
||||
* Imageを作成します。
|
||||
*/
|
||||
export async function createImage(actor: IRemoteUser, image): Promise<IDriveFile> {
|
||||
log(`Creating the Image: ${image.url}`);
|
||||
|
||||
return await uploadFromUrl(image.url, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imageを解決します。
|
||||
*
|
||||
* Misskeyに対象のImageが登録されていればそれを返し、そうでなければ
|
||||
* リモートサーバーからフェッチしてMisskeyに登録しそれを返します。
|
||||
*/
|
||||
export async function resolveImage(actor: IRemoteUser, value: any): Promise<IDriveFile> {
|
||||
// TODO
|
||||
|
||||
// リモートサーバーからフェッチしてきて登録
|
||||
return await createImage(actor, value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue