mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
APNG support
This commit is contained in:
parent
c28639437f
commit
cb9c97516e
@ -97,7 +97,9 @@ export default Vue.extend({
|
|||||||
const image = [
|
const image = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
'image/gif'
|
'image/gif',
|
||||||
|
'image/apng',
|
||||||
|
'image/vnd.mozilla.apng',
|
||||||
];
|
];
|
||||||
|
|
||||||
this.$root.api('users/notes', {
|
this.$root.api('users/notes', {
|
||||||
|
@ -38,7 +38,9 @@ export default Vue.extend({
|
|||||||
const image = [
|
const image = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
'image/gif'
|
'image/gif',
|
||||||
|
'image/apng',
|
||||||
|
'image/vnd.mozilla.apng',
|
||||||
];
|
];
|
||||||
|
|
||||||
this.$root.api('users/notes', {
|
this.$root.api('users/notes', {
|
||||||
|
@ -186,7 +186,9 @@ export default Vue.extend({
|
|||||||
const image = [
|
const image = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
'image/gif'
|
'image/gif',
|
||||||
|
'image/apng',
|
||||||
|
'image/vnd.mozilla.apng',
|
||||||
];
|
];
|
||||||
|
|
||||||
this.$root.api('notes/local-timeline', {
|
this.$root.api('notes/local-timeline', {
|
||||||
|
@ -30,7 +30,9 @@ export default Vue.extend({
|
|||||||
const image = [
|
const image = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
'image/gif'
|
'image/gif',
|
||||||
|
'image/apng',
|
||||||
|
'image/vnd.mozilla.apng',
|
||||||
];
|
];
|
||||||
this.$root.api('users/notes', {
|
this.$root.api('users/notes', {
|
||||||
userId: this.user.id,
|
userId: this.user.id,
|
||||||
|
@ -110,7 +110,9 @@ export default Vue.extend({
|
|||||||
const image = [
|
const image = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
'image/gif'
|
'image/gif',
|
||||||
|
'image/apng',
|
||||||
|
'image/vnd.mozilla.apng',
|
||||||
];
|
];
|
||||||
|
|
||||||
this.$root.api('notes/local-timeline', {
|
this.$root.api('notes/local-timeline', {
|
||||||
|
@ -21,9 +21,9 @@ export async function proxyMedia(ctx: Koa.BaseContext) {
|
|||||||
|
|
||||||
let image: IImage;
|
let image: IImage;
|
||||||
|
|
||||||
if ('static' in ctx.query && ['image/png', 'image/gif'].includes(type)) {
|
if ('static' in ctx.query && ['image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
|
||||||
image = await convertToPng(path, 498, 280);
|
image = await convertToPng(path, 498, 280);
|
||||||
} else if ('preview' in ctx.query && ['image/jpeg', 'image/png', 'image/gif'].includes(type)) {
|
} else if ('preview' in ctx.query && ['image/jpeg', 'image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
|
||||||
image = await convertToJpeg(path, 200, 200);
|
image = await convertToJpeg(path, 200, 200);
|
||||||
} else {
|
} else {
|
||||||
image = {
|
image = {
|
||||||
|
@ -46,6 +46,8 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
|||||||
if (type === 'image/jpeg') ext = '.jpg';
|
if (type === 'image/jpeg') ext = '.jpg';
|
||||||
if (type === 'image/png') ext = '.png';
|
if (type === 'image/png') ext = '.png';
|
||||||
if (type === 'image/webp') ext = '.webp';
|
if (type === 'image/webp') ext = '.webp';
|
||||||
|
if (type === 'image/apng') ext = '.apng';
|
||||||
|
if (type === 'image/vnd.mozilla.apng') ext = '.apng';
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = meta.objectStorageBaseUrl
|
const baseUrl = meta.objectStorageBaseUrl
|
||||||
@ -181,6 +183,8 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
|||||||
thumbnail = await convertToPng(path, 498, 280);
|
thumbnail = await convertToPng(path, 498, 280);
|
||||||
} else if (['image/gif'].includes(type)) {
|
} else if (['image/gif'].includes(type)) {
|
||||||
thumbnail = await convertToGif(path);
|
thumbnail = await convertToGif(path);
|
||||||
|
} else if (['image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
|
||||||
|
thumbnail = await convertToApng(path);
|
||||||
} else if (type.startsWith('video/')) {
|
} else if (type.startsWith('video/')) {
|
||||||
try {
|
try {
|
||||||
thumbnail = await GenerateVideoThumbnail(path);
|
thumbnail = await GenerateVideoThumbnail(path);
|
||||||
@ -356,7 +360,7 @@ export default async function(
|
|||||||
|
|
||||||
let propPromises: Promise<void>[] = [];
|
let propPromises: Promise<void>[] = [];
|
||||||
|
|
||||||
const isImage = ['image/jpeg', 'image/gif', 'image/png', 'image/webp'].includes(mime);
|
const isImage = ['image/jpeg', 'image/gif', 'image/png', 'image/apng', 'image/vnd.mozilla.apng', 'image/webp'].includes(mime);
|
||||||
|
|
||||||
if (isImage) {
|
if (isImage) {
|
||||||
const img = sharp(path);
|
const img = sharp(path);
|
||||||
|
Loading…
Reference in New Issue
Block a user