From adc3c16ef3bd53a4f1bb84ab7ca0fcc64384fe8f Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 24 Jul 2018 05:04:43 +0900 Subject: [PATCH] wip --- cli/clean-cached-remote-files.js | 4 ++-- src/models/drive-file.ts | 7 ++++--- src/remote/activitypub/models/person.ts | 8 ++++---- src/server/file/send-drive-file.ts | 2 +- src/services/drive/add-file.ts | 16 +++++++++++----- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cli/clean-cached-remote-files.js b/cli/clean-cached-remote-files.js index a9c38a4cdf..5b388c73b4 100644 --- a/cli/clean-cached-remote-files.js +++ b/cli/clean-cached-remote-files.js @@ -9,7 +9,7 @@ const q = { 'metadata._user.host': { $ne: null }, - 'metadata.isMetaOnly': false + 'metadata.withoutChunks': false }; async function main() { @@ -57,7 +57,7 @@ async function main() { DriveFile.update({ _id: file._id }, { $set: { - 'metadata.isMetaOnly': true + 'metadata.withoutChunks': true } }) ]).then(async () => { diff --git a/src/models/drive-file.ts b/src/models/drive-file.ts index 3a0390f792..0b7212665d 100644 --- a/src/models/drive-file.ts +++ b/src/models/drive-file.ts @@ -31,8 +31,9 @@ export type IMetadata = { comment: string; uri?: string; url?: string; + src?: string; deletedAt?: Date; - isMetaOnly?: boolean; + withoutChunks?: boolean; isSensitive?: boolean; }; @@ -155,9 +156,9 @@ export const pack = ( _target = Object.assign(_target, _file.metadata); + _target.url = _file.metadata.url ? _file.metadata.url : `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}`; _target.src = _file.metadata.url; - _target.url = _file.metadata.isMetaOnly ? _file.metadata.url : `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}`; - _target.isRemote = _file.metadata.isMetaOnly; + _target.isRemote = _file.metadata.withoutChunks; if (_target.properties == null) _target.properties = {}; diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index eee4aa1bfa..4ff8d23be7 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -152,8 +152,8 @@ export async function createPerson(value: any, resolver?: Resolver): Promise