From b18cc7f18df452d44eb778d524896ab41546d731 Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 16 Feb 2023 08:39:34 -0700 Subject: [PATCH] Adding azw3 to icons. --- app/src/components/Common.js | 18 ++++++++++++------ wrolpi/files/lib.py | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/components/Common.js b/app/src/components/Common.js index 36719766..4f126147 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -617,7 +617,7 @@ export function FileIcon({file, disabled = true, size = 'huge', ...props}) { props['name'] = 'file'; props['color'] = mimetypeColor(mimetype); if (mimetype) { - if (mimetype.startsWith('text/html') || mimetype.startsWith('application/json') || mimetype.startsWith('text/yaml')) { + if (mimetype.startsWith('text/html') || mimetype.startsWith('application/json') || mimetype.startsWith('text/yaml') || mimetype.startsWith('text/xml')) { props['name'] = 'file code'; } else if (mimetype.startsWith('application/pdf')) { props['name'] = 'file pdf'; @@ -633,16 +633,22 @@ export function FileIcon({file, disabled = true, size = 'huge', ...props}) { props['name'] = 'file archive'; } else if (mimetype.startsWith('application/x-iso9660-image')) { props['name'] = 'dot circle'; - } else if (mimetype.startsWith('application/epub') || mimetype.startsWith('application/x-mobipocket-ebook')) { + } else if (mimetype.startsWith('application/epub') || mimetype.startsWith('application/x-mobipocket-ebook') || mimetype.startsWith('application/vnd.amazon.mobi8-ebook')) { props['name'] = 'book'; } else if (mimetype.startsWith('text/vtt') || mimetype.startsWith('text/srt')) { props['name'] = 'closed captioning'; - } else if (mimetype.startsWith('application/octet-stream') && lowerPath.endsWith('.dmg')) { - props['name'] = 'apple'; - } else if (mimetype.startsWith('application/x-openscad') || (mimetype.startsWith('application/octet-stream') && (lowerPath.endsWith('.stl') || lowerPath.endsWith('.blend')))) { - props['name'] = 'cube'; } else if (mimetype.startsWith('application/x-dosexec') || mimetype.startsWith('application/x-msi')) { props['name'] = 'microsoft'; + } else if (mimetype.startsWith('application/octet-stream')) { + if (lowerPath.endsWith('.stl')) { + props['name'] = 'cube'; + } else if (lowerPath.endsWith('.blend')) { + props['name'] = 'cube'; + } else if (lowerPath.endsWith('.dmg')) { + props['name'] = 'apple'; + } else if (lowerPath.endsWith('.azw3')) { + props['name'] = 'book'; + } } } return diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index 349f0342..949c53fa 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -153,6 +153,8 @@ def _mimetype_suffix_map(path: Path, mimetype: str): return 'text/srt' if suffix.endswith('.yaml') or suffix.endswith('.yml'): return 'text/yaml' + if suffix.endswith('.azw3'): + return 'application/vnd.amazon.mobi8-ebook' return mimetype