mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-12 13:48:33 +09:00
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/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', {
|
||||||
|
@ -39,8 +39,6 @@ export default Vue.extend({
|
|||||||
'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', {
|
||||||
|
@ -187,8 +187,6 @@ export default Vue.extend({
|
|||||||
'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', {
|
||||||
|
@ -31,8 +31,6 @@ export default Vue.extend({
|
|||||||
'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,
|
||||||
|
@ -111,8 +111,6 @@ export default Vue.extend({
|
|||||||
'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', {
|
||||||
|
@ -15,15 +15,20 @@ export async function proxyMedia(ctx: Koa.BaseContext) {
|
|||||||
try {
|
try {
|
||||||
await downloadUrl(url, path);
|
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;
|
if (!type.startsWith('image/')) throw 403;
|
||||||
|
|
||||||
let image: IImage;
|
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);
|
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);
|
image = await convertToJpeg(path, 200, 200);
|
||||||
} else {
|
} else {
|
||||||
image = {
|
image = {
|
||||||
|
@ -36,6 +36,8 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
|||||||
// thunbnail, webpublic を必要なら生成
|
// thunbnail, webpublic を必要なら生成
|
||||||
const alts = await generateAlts(path, type, !file.uri);
|
const alts = await generateAlts(path, type, !file.uri);
|
||||||
|
|
||||||
|
if (type === 'image/apng') type = 'image/png';
|
||||||
|
|
||||||
const meta = await fetchMeta();
|
const meta = await fetchMeta();
|
||||||
|
|
||||||
if (meta.useObjectStorage) {
|
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/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
|
||||||
|
@ -96,7 +96,7 @@ export async function convertToApng(path: string): Promise<IImage> {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
ext: 'apng',
|
ext: 'png',
|
||||||
type: 'image/vnd.mozilla.apng'
|
type: 'image/png'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user