This commit is contained in:
syuilo 2019-03-02 11:29:18 +09:00
parent b9b81e6665
commit 3cfcb89c04
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 6 additions and 4 deletions

View file

@ -46,7 +46,7 @@ DriveFile.findOne({
DriveFile.update({ _id: x._id }, {
$set: {
'metadata.url': `${config.driveUrl}/${uuid.v4()}${ext}`,
'metadata.webpublicUrl': `${config.driveUrl}/${uuid.v4()}.jpg`,
'metadata.webpublicUrl': `${config.driveUrl}/${uuid.v4()}${ext}`,
'metadata.thumbnailUrl': `${config.driveUrl}/${uuid.v4()}.jpg`,
}
});

View file

@ -4,6 +4,7 @@ import DriveFile, { getDriveFileBucket } from '../../models/drive-file';
import DriveFileThumbnail, { getDriveFileThumbnailBucket } from '../../models/drive-file-thumbnail';
import DriveFileWebpublic, { getDriveFileWebpublicBucket } from '../../models/drive-file-webpublic';
import { serverLogger } from '..';
import config from '../../config';
const assets = `${__dirname}/../../server/file/assets/`;
@ -13,7 +14,8 @@ const commonReadableHandlerGenerator = (ctx: Koa.BaseContext) => (e: Error): voi
};
export default async function(ctx: Koa.BaseContext) {
const url = ctx.href;
let url = ctx.href;
if (url.startsWith('http://') && config.url.startsWith('https://')) url = url.replace('http://', 'https://');
// Fetch drive file
const file = await DriveFile.findOne({

View file

@ -48,8 +48,8 @@ export default async function(file: IDriveFile, isExpired = false) {
set.metadata.withoutChunks = true;
set.metadata.isRemote = true;
set.metadata.url = file.metadata.uri;
set.metadata.thumbnailUrl = file.metadata.uri;
set.metadata.webpublicUrl = file.metadata.uri;
set.metadata.thumbnailUrl = undefined;
set.metadata.webpublicUrl = undefined;
}
await DriveFile.update({ _id: file._id }, {