Merge branch 'develop' into vue3
This commit is contained in:
commit
10d783006d
15 changed files with 329 additions and 32 deletions
|
|
@ -15,6 +15,7 @@ import { packedHashtagSchema } from '../../../models/repositories/hashtag';
|
|||
import { packedPageSchema } from '../../../models/repositories/page';
|
||||
import { packedUserGroupSchema } from '../../../models/repositories/user-group';
|
||||
import { packedNoteFavoriteSchema } from '../../../models/repositories/note-favorite';
|
||||
import { packedChannelSchema } from '../../../models/repositories/channel';
|
||||
|
||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
||||
const res: any = schema;
|
||||
|
|
@ -82,4 +83,5 @@ export const schemas = {
|
|||
Blocking: convertSchemaToOpenApiSchema(packedBlockingSchema),
|
||||
Hashtag: convertSchemaToOpenApiSchema(packedHashtagSchema),
|
||||
Page: convertSchemaToOpenApiSchema(packedPageSchema),
|
||||
Channel: convertSchemaToOpenApiSchema(packedChannelSchema),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -160,12 +160,30 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
|||
}
|
||||
}
|
||||
|
||||
const img = sharp(path);
|
||||
const metadata = await img.metadata();
|
||||
const isAnimated = metadata.pages && metadata.pages > 1;
|
||||
if (!['image/jpeg', 'image/png', 'image/webp'].includes(type)) {
|
||||
logger.debug(`web image and thumbnail not created (not an required file)`);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
};
|
||||
}
|
||||
|
||||
// skip animated
|
||||
if (isAnimated) {
|
||||
let img: sharp.Sharp | null = null;
|
||||
|
||||
try {
|
||||
img = sharp(path);
|
||||
const metadata = await img.metadata();
|
||||
const isAnimated = metadata.pages && metadata.pages > 1;
|
||||
|
||||
// skip animated
|
||||
if (isAnimated) {
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn(`sharp failed: ${e}`);
|
||||
return {
|
||||
webpublic: null,
|
||||
thumbnail: null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue