diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Api/OverlayImageController.cs b/Jellyfin.Plugin.MediaBarEnhanced/Api/OverlayImageController.cs index 0e58f4d..1fc9457 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Api/OverlayImageController.cs +++ b/Jellyfin.Plugin.MediaBarEnhanced/Api/OverlayImageController.cs @@ -97,13 +97,19 @@ namespace Jellyfin.Plugin.MediaBarEnhanced.Api string targetPath = existingFiles[0]; - // Read the file and return as a generic octet stream. - // We use FileShare.ReadWrite so that if someone is currently overwriting the file (uploading), we don't block them, - // and we also don't get blocked by other readers. - var stream = new FileStream(targetPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + // Read the file and return with appropriate MIME type + // We use FileShare.ReadWrite | FileShare.Delete so that if someone is currently overwriting the file (uploading), we don't block them. + var stream = new FileStream(targetPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); - // "image/*" works reliably as browsers will sniff the exact image mime type (jpeg, png, webp). - return File(stream, "image/*"); + string mimeType = "application/octet-stream"; + string ext = Path.GetExtension(targetPath).ToLowerInvariant(); + switch (ext) { + case ".jpg": case ".jpeg": mimeType = "image/jpeg"; break; + case ".png": mimeType = "image/png"; break; + case ".gif": mimeType = "image/gif"; break; + case ".webp": mimeType = "image/webp"; break; + } + return File(stream, mimeType); } /// diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Configuration/configPage.html b/Jellyfin.Plugin.MediaBarEnhanced/Configuration/configPage.html index 3af78be..047e479 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Configuration/configPage.html +++ b/Jellyfin.Plugin.MediaBarEnhanced/Configuration/configPage.html @@ -266,7 +266,7 @@
Uploading an image will securely save it to the server and automatically update the URL field above.
-

Styles

+

Styles

@@ -985,7 +985,7 @@ '
Comma-separated or Newline separated list of Movie/Series/Collection IDs to show during this season.
Same options available as for the default media IDs.
' + '
' + '

Custom Overlay Overrides

' + - '
' + + '
' + '
' + '
' + ' ' + @@ -996,13 +996,13 @@ '
Override the global image URL.
' + '
' + '
' + - '
' + - '
' + + '
' + + '
' + ' cloud_upload' + ' Upload seasonal image' + ' ' + ' ' + - ' ' + + ' ' + '
' + '
' + '
'; @@ -1077,7 +1077,7 @@ clearBtn.style.display = 'block'; if(icon) icon.style.display = 'none'; if(text) { - text.textContent = 'Drag and drop a new image here...'; + text.textContent = 'Drag and drop a new image here, or click to select'; text.style.display = 'block'; text.style.position = 'absolute'; text.style.bottom = '5px'; @@ -1093,7 +1093,7 @@ clearBtn.style.display = 'none'; if(icon) icon.style.display = 'block'; if(text) { - text.textContent = 'Upload seasonal image'; + text.textContent = 'Upload seasonal overlay image'; text.style.display = 'block'; text.style.position = 'static'; text.style.backgroundColor = 'transparent';