Skip to content

Commit

Permalink
v0.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaina committed May 10, 2023
1 parent 6bf5fbd commit 0e79a81
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 177 deletions.
4 changes: 4 additions & 0 deletions built/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const FILE_TYPE_BROWSERSAFE = [
'video/webm',
'audio/webm',
'audio/aac',
// see https://github.com/misskey-dev/misskey/pull/10686
'audio/flac',
'audio/wav',
// backward compatibility
'audio/x-flac',
'audio/vnd.wave',
];
Expand Down
12 changes: 11 additions & 1 deletion built/file-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function detectType(path) {
return TYPE_OCTET_STREAM;
}
return {
mime: type.mime,
mime: fixMime(type.mime),
ext: type.ext,
};
}
Expand Down Expand Up @@ -59,3 +59,13 @@ const dictionary = {
'sharp-animation-convertible-image': ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/avif', 'image/svg+xml', 'image/x-icon', 'image/bmp'],
};
export const isMimeImage = (mime, type) => dictionary[type].includes(mime);
function fixMime(mime) {
// see https://github.com/misskey-dev/misskey/pull/10686
if (mime === "audio/x-flac") {
return "audio/flac";
}
if (mime === "audio/vnd.wave") {
return "audio/wav";
}
return mime;
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey-media-proxy",
"version": "0.0.21",
"version": "0.0.22",
"description": "The Media Proxy for Misskey",
"main": "built/index.js",
"packageManager": "[email protected]",
Expand All @@ -26,25 +26,25 @@
},
"homepage": "https://github.com/misskey-dev/media-proxy#readme",
"devDependencies": {
"@swc/cli": "^0.1.61",
"@swc/core": "^1.3.32",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.57",
"@types/content-disposition": "^0.5.5",
"@types/node": "^18.11.19",
"@types/node": "^18.16.7",
"@types/sharp": "^0.31.1",
"@types/tmp": "^0.2.3",
"typescript": "^4.9.5"
},
"dependencies": {
"@fastify/static": "^6.8.0",
"@fastify/static": "^6.10.1",
"cacheable-lookup": "^7.0.0",
"content-disposition": "^0.5.4",
"fastify": "^4.12.0",
"fastify": "^4.17.0",
"fastify-cli": "^5.7.1",
"file-type": "^18.2.0",
"got": "^12.5.3",
"file-type": "^18.4.0",
"got": "^12.6.0",
"hpagent": "^1.2.0",
"ip-cidr": "^3.1.0",
"is-svg": "^4.3.2",
"is-svg": "^4.4.0",
"private-ip": "^3.0.0",
"sharp": "^0.31.3",
"sharp-read-bmp": "github:misskey-dev/sharp-read-bmp",
Expand Down
Loading

0 comments on commit 0e79a81

Please sign in to comment.