update
This commit is contained in:
parent
b9b81e6665
commit
3cfcb89c04
3 changed files with 6 additions and 4 deletions
|
@ -46,7 +46,7 @@ DriveFile.findOne({
|
||||||
DriveFile.update({ _id: x._id }, {
|
DriveFile.update({ _id: x._id }, {
|
||||||
$set: {
|
$set: {
|
||||||
'metadata.url': `${config.driveUrl}/${uuid.v4()}${ext}`,
|
'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`,
|
'metadata.thumbnailUrl': `${config.driveUrl}/${uuid.v4()}.jpg`,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ import DriveFile, { getDriveFileBucket } from '../../models/drive-file';
|
||||||
import DriveFileThumbnail, { getDriveFileThumbnailBucket } from '../../models/drive-file-thumbnail';
|
import DriveFileThumbnail, { getDriveFileThumbnailBucket } from '../../models/drive-file-thumbnail';
|
||||||
import DriveFileWebpublic, { getDriveFileWebpublicBucket } from '../../models/drive-file-webpublic';
|
import DriveFileWebpublic, { getDriveFileWebpublicBucket } from '../../models/drive-file-webpublic';
|
||||||
import { serverLogger } from '..';
|
import { serverLogger } from '..';
|
||||||
|
import config from '../../config';
|
||||||
|
|
||||||
const assets = `${__dirname}/../../server/file/assets/`;
|
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) {
|
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
|
// Fetch drive file
|
||||||
const file = await DriveFile.findOne({
|
const file = await DriveFile.findOne({
|
||||||
|
|
|
@ -48,8 +48,8 @@ export default async function(file: IDriveFile, isExpired = false) {
|
||||||
set.metadata.withoutChunks = true;
|
set.metadata.withoutChunks = true;
|
||||||
set.metadata.isRemote = true;
|
set.metadata.isRemote = true;
|
||||||
set.metadata.url = file.metadata.uri;
|
set.metadata.url = file.metadata.uri;
|
||||||
set.metadata.thumbnailUrl = file.metadata.uri;
|
set.metadata.thumbnailUrl = undefined;
|
||||||
set.metadata.webpublicUrl = file.metadata.uri;
|
set.metadata.webpublicUrl = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
await DriveFile.update({ _id: file._id }, {
|
await DriveFile.update({ _id: file._id }, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue