mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-27 20:37:32 -07:00
20 lines
495 B
TypeScript
20 lines
495 B
TypeScript
import { IDriveFile } from '../models/drive-file';
|
|
import config from '../config';
|
|
|
|
export default function(file: IDriveFile, thumbnail = false): string {
|
|
if (file == null) return null;
|
|
|
|
if (file.metadata.withoutChunks) {
|
|
if (thumbnail) {
|
|
return file.metadata.thumbnailUrl || file.metadata.url;
|
|
} else {
|
|
return file.metadata.url;
|
|
}
|
|
} else {
|
|
if (thumbnail) {
|
|
return `${config.drive_url}/${file._id}?thumbnail`;
|
|
} else {
|
|
return `${config.drive_url}/${file._id}`;
|
|
}
|
|
}
|
|
}
|