Merge pull request #4210 from Nachtalb/na/inline-audio-file-support
Improve inline audio file support
This commit is contained in:
commit
adf1b5abec
@ -249,6 +249,8 @@ function parse(msg, chan, preview, res, client) {
|
||||
case "audio/x-midi":
|
||||
case "audio/x-mpeg":
|
||||
case "audio/x-mpeg-3":
|
||||
case "audio/flac":
|
||||
case "audio/x-m4a":
|
||||
if (!preview.link.startsWith("https://")) {
|
||||
break;
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ const inlineContentDispositionTypes = {
|
||||
"audio/mpeg": "audio.mp3",
|
||||
"audio/ogg": "audio.ogg",
|
||||
"audio/vnd.wave": "audio.wav",
|
||||
"audio/flac": "audio.flac",
|
||||
"audio/x-flac": "audio.flac",
|
||||
"audio/x-m4a": "audio.m4a",
|
||||
"image/bmp": "image.bmp",
|
||||
"image/gif": "image.gif",
|
||||
"image/jpeg": "image.jpg",
|
||||
@ -110,10 +111,12 @@ class Uploader {
|
||||
});
|
||||
}
|
||||
|
||||
// Send a more common mime type for audio files
|
||||
// so that browsers can play them correctly
|
||||
if (detectedMimeType === "audio/vnd.wave") {
|
||||
// Send a more common mime type for wave audio files
|
||||
// so that browsers can play them correctly
|
||||
detectedMimeType = "audio/wav";
|
||||
} else if (detectedMimeType === "audio/x-flac") {
|
||||
detectedMimeType = "audio/flac";
|
||||
}
|
||||
|
||||
res.setHeader("Content-Disposition", disposition);
|
||||
|
Loading…
Reference in New Issue
Block a user