diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-31 22:35:02 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-31 22:35:02 +0900 |
| commit | 1a51b9870039da8b328acc673b2e8cb08ae2e663 (patch) | |
| tree | 71784c690f794cf0b3f37f3de56ce7316643da19 /src/remote | |
| parent | Revert "Clean up" (diff) | |
| download | sharkey-1a51b9870039da8b328acc673b2e8cb08ae2e663.tar.gz sharkey-1a51b9870039da8b328acc673b2e8cb08ae2e663.tar.bz2 sharkey-1a51b9870039da8b328acc673b2e8cb08ae2e663.zip | |
Refactor
Diffstat (limited to 'src/remote')
| -rw-r--r-- | src/remote/activitypub/models/person.ts | 5 | ||||
| -rw-r--r-- | src/remote/activitypub/renderer/document.ts | 4 | ||||
| -rw-r--r-- | src/remote/activitypub/renderer/image.ts | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index f115dee87d..7842e87882 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -15,6 +15,7 @@ import { URL } from 'url'; import { resolveNote } from './note'; import registerInstance from '../../../services/register-instance'; import Instance from '../../../models/instance'; +import getDriveFileUrl from '../../../misc/get-drive-file-url'; const log = debug('misskey:activitypub'); @@ -303,8 +304,8 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje featured: person.featured, avatarId: avatar ? avatar._id : null, bannerId: banner ? banner._id : null, - avatarUrl: (avatar && avatar.metadata.thumbnailUrl) ? avatar.metadata.thumbnailUrl : (avatar && avatar.metadata.url) ? avatar.metadata.url : null, - bannerUrl: banner && banner.metadata.url ? banner.metadata.url : null, + avatarUrl: getDriveFileUrl(avatar, true), + bannerUrl: getDriveFileUrl(banner, true), description: htmlToMFM(person.summary), followersCount, followingCount, diff --git a/src/remote/activitypub/renderer/document.ts b/src/remote/activitypub/renderer/document.ts index 1f4543d7ee..17721e9417 100644 --- a/src/remote/activitypub/renderer/document.ts +++ b/src/remote/activitypub/renderer/document.ts @@ -1,8 +1,8 @@ -import config from '../../../config'; import { IDriveFile } from '../../../models/drive-file'; +import getDriveFileUrl from '../../../misc/get-drive-file-url'; export default (file: IDriveFile) => ({ type: 'Document', mediaType: file.contentType, - url: file.metadata.url || `${config.drive_url}/${file._id}` + url: getDriveFileUrl(file) }); diff --git a/src/remote/activitypub/renderer/image.ts b/src/remote/activitypub/renderer/image.ts index b2f2555003..ec637b9521 100644 --- a/src/remote/activitypub/renderer/image.ts +++ b/src/remote/activitypub/renderer/image.ts @@ -1,8 +1,8 @@ -import config from '../../../config'; import { IDriveFile } from '../../../models/drive-file'; +import getDriveFileUrl from '../../../misc/get-drive-file-url'; export default (file: IDriveFile) => ({ type: 'Image', - url: file.metadata.url || `${config.drive_url}/${file._id}`, + url: getDriveFileUrl(file), sensitive: file.metadata.isSensitive }); |