This commit is contained in:
tamaina 2023-01-15 12:37:04 +00:00
parent 16df492dec
commit fc751568e0
3 changed files with 18 additions and 2 deletions

View File

@ -68,6 +68,7 @@ export default class Logger {
if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log; if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log;
console.log(important ? chalk.bold(log) : log); console.log(important ? chalk.bold(log) : log);
if (level === 'error' && data) console.log(data);
if (store) { if (store) {
if (this.syslogClient) { if (this.syslogClient) {

View File

@ -126,7 +126,11 @@ export class FileServerService {
const convertFile = async () => { const convertFile = async () => {
if (isThumbnail) { if (isThumbnail) {
if (['image/jpeg', 'image/webp', 'image/avif', 'image/png', 'image/svg+xml'].includes(mime)) { if (['image/jpeg', 'image/webp', 'image/avif', 'image/png', 'image/svg+xml'].includes(mime)) {
return this.imageProcessingService.convertSharpToWebpStreamObj(Readable.fromWeb(response.body).pipe(sharp()), 498, 280); return this.imageProcessingService.convertSharpToWebpStreamObj(
Readable.fromWeb(response.body).pipe(sharp()),
498,
280
);
} else if (mime.startsWith('video/')) { } else if (mime.startsWith('video/')) {
await fileSaving; await fileSaving;
return await this.videoProcessingService.generateVideoThumbnail(path); return await this.videoProcessingService.generateVideoThumbnail(path);
@ -136,7 +140,12 @@ export class FileServerService {
if (isWebpublic) { if (isWebpublic) {
if (['image/svg+xml'].includes(mime)) { if (['image/svg+xml'].includes(mime)) {
return { return {
data: this.imageProcessingService.convertSharpToWebpStream(Readable.fromWeb(response.body).pipe(sharp()), 2048, 2048, { ...webpDefault, lossless: true }), data: this.imageProcessingService.convertSharpToWebpStream(
Readable.fromWeb(response.body).pipe(sharp()),
2048,
2048,
{ ...webpDefault, lossless: true }
),
ext: 'webp', ext: 'webp',
type: 'image/webp', type: 'image/webp',
}; };

View File

@ -108,6 +108,12 @@ export class MediaProxyServerService {
withoutEnlargement: true, withoutEnlargement: true,
}) })
.webp(webpDefault), .webp(webpDefault),
err => {
if (err) {
this.logger.error('Sharp pipeline error (emoji)', err);
throw new StatusError('Internal Error occured (in emoji pipeline, MediaProxy)', 500, 'Internal Error occured');
}
}
); );
image = { image = {