From 977f42529f958df92c7667e72f2ca30d09645007 Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 21 Feb 2023 15:49:11 -0700 Subject: [PATCH] Fixing stl file mimetype. --- app/src/api.js | 2 +- app/src/components/Common.js | 2 ++ app/src/components/Nav.js | 32 +++++++++++++++++--------------- wrolpi/files/lib.py | 2 +- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/src/api.js b/app/src/api.js index b07cb97e..a2b8fb35 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -18,7 +18,7 @@ function timeoutPromise(ms, promise) { }) } -async function apiCall(url, method, body, ms = 20000) { +async function apiCall(url, method, body, ms = 60_000) { let init = {method}; if (body !== undefined) { init.body = JSON.stringify(body); diff --git a/app/src/components/Common.js b/app/src/components/Common.js index ae450ed0..c7950456 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -639,6 +639,8 @@ export function FileIcon({file, disabled = true, size = 'huge', ...props}) { props['name'] = 'book'; } else if (mimetype.startsWith('text/vtt') || mimetype.startsWith('text/srt')) { props['name'] = 'closed captioning'; + } else if (mimetype.startsWith('application/x-openscad') || mimetype.startsWith('model/stl')) { + 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')) { diff --git a/app/src/components/Nav.js b/app/src/components/Nav.js index 908897a8..31bf8f59 100644 --- a/app/src/components/Nav.js +++ b/app/src/components/Nav.js @@ -5,15 +5,19 @@ import {Media, StatusContext, ThemeContext} from "../contexts/contexts"; import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"; import {DarkModeToggle, HotspotStatusIcon, NAME} from "./Common"; -const links = [{text: 'Videos', to: '/videos', key: 'videos'}, { - text: 'Archive', to: '/archive', key: 'archive' -}, {text: 'Map', to: '/map', key: 'map'}, {text: 'Files', to: '/files', key: 'files'}, { - text: 'Inventory', to: '/inventory', key: 'inventory' -}, { - key: 'more', text: 'More', links: [{to: '/more/otp', text: 'One Time Pad', end: true}, { - to: '/more/statistics', text: 'Statistics', end: true - },] -},]; +const links = [ + {text: 'Videos', to: '/videos', key: 'videos'}, + {text: 'Archive', to: '/archive', key: 'archive'}, + {text: 'Map', to: '/map', key: 'map'}, + {text: 'Files', to: '/files', key: 'files'}, + {text: 'Inventory', to: '/inventory', key: 'inventory'}, + {text: 'More', key: 'more', + links: [ + {to: '/more/otp', text: 'One Time Pad', end: true}, + {to: '/more/statistics', text: 'Statistics', end: true}, + ] + }, +]; const admin = {to: '/admin', text: 'Admin', key: 'admin'}; const rightLinks = [admin,]; @@ -29,19 +33,17 @@ function DropdownLinks({link}) { function MenuLink({link}) { // Wrapper around NavLink to handle Navlink/Dropdown change. - let classes = 'item'; - - if (!link.links) { + if (link.links) { + return + } else { const end = link.end ? {end: true} : {end: undefined}; return {link.text} - } else { - return } } diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index 949c53fa..7fcc9958 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -142,7 +142,7 @@ def _mimetype_suffix_map(path: Path, mimetype: str): if suffix.endswith('.html') or suffix.endswith('.htm'): return 'text/html' if suffix.endswith('.stl'): - return 'application/sta' + return 'model/stl' if suffix.endswith('.scad'): return 'application/x-openscad' if suffix.endswith('.js'):