APNGでもMIME typeはimage/pngにするように
This commit is contained in:
parent
dfd991a6c6
commit
e579eb2bf4
|
@ -98,8 +98,6 @@ export default Vue.extend({
|
|||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/apng',
|
||||
'image/vnd.mozilla.apng',
|
||||
];
|
||||
|
||||
this.$root.api('users/notes', {
|
||||
|
|
|
@ -39,8 +39,6 @@ export default Vue.extend({
|
|||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/apng',
|
||||
'image/vnd.mozilla.apng',
|
||||
];
|
||||
|
||||
this.$root.api('users/notes', {
|
||||
|
|
|
@ -187,8 +187,6 @@ export default Vue.extend({
|
|||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/apng',
|
||||
'image/vnd.mozilla.apng',
|
||||
];
|
||||
|
||||
this.$root.api('notes/local-timeline', {
|
||||
|
|
|
@ -31,8 +31,6 @@ export default Vue.extend({
|
|||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/apng',
|
||||
'image/vnd.mozilla.apng',
|
||||
];
|
||||
this.$root.api('users/notes', {
|
||||
userId: this.user.id,
|
||||
|
|
|
@ -111,8 +111,6 @@ export default Vue.extend({
|
|||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/apng',
|
||||
'image/vnd.mozilla.apng',
|
||||
];
|
||||
|
||||
this.$root.api('notes/local-timeline', {
|
||||
|
|
|
@ -15,15 +15,20 @@ export async function proxyMedia(ctx: Koa.BaseContext) {
|
|||
try {
|
||||
await downloadUrl(url, path);
|
||||
|
||||
const [type, ext] = await detectMine(path);
|
||||
let [type, ext] = await detectMine(path);
|
||||
|
||||
if (type === 'image/apng') {
|
||||
type = 'image/png';
|
||||
ext = 'png';
|
||||
}
|
||||
|
||||
if (!type.startsWith('image/')) throw 403;
|
||||
|
||||
let image: IImage;
|
||||
|
||||
if ('static' in ctx.query && ['image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
|
||||
if ('static' in ctx.query && ['image/png', 'image/gif'].includes(type)) {
|
||||
image = await convertToPng(path, 498, 280);
|
||||
} else if ('preview' in ctx.query && ['image/jpeg', 'image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
|
||||
} else if ('preview' in ctx.query && ['image/jpeg', 'image/png', 'image/gif'].includes(type)) {
|
||||
image = await convertToJpeg(path, 200, 200);
|
||||
} else {
|
||||
image = {
|
||||
|
|
|
@ -36,6 +36,8 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
|||
// thunbnail, webpublic を必要なら生成
|
||||
const alts = await generateAlts(path, type, !file.uri);
|
||||
|
||||
if (type === 'image/apng') type = 'image/png';
|
||||
|
||||
const meta = await fetchMeta();
|
||||
|
||||
if (meta.useObjectStorage) {
|
||||
|
@ -46,8 +48,6 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
|||
if (type === 'image/jpeg') ext = '.jpg';
|
||||
if (type === 'image/png') ext = '.png';
|
||||
if (type === 'image/webp') ext = '.webp';
|
||||
if (type === 'image/apng') ext = '.apng';
|
||||
if (type === 'image/vnd.mozilla.apng') ext = '.apng';
|
||||
}
|
||||
|
||||
const baseUrl = meta.objectStorageBaseUrl
|
||||
|
|
|
@ -96,7 +96,7 @@ export async function convertToApng(path: string): Promise<IImage> {
|
|||
|
||||
return {
|
||||
data,
|
||||
ext: 'apng',
|
||||
type: 'image/vnd.mozilla.apng'
|
||||
ext: 'png',
|
||||
type: 'image/png'
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue