Fixing stl file mimetype.

This commit is contained in:
Roland 2023-02-21 15:49:11 -07:00
parent 54709c268c
commit 977f42529f
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 21 additions and 17 deletions

View file

@ -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);

View file

@ -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')) {

View file

@ -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 <DropdownLinks link={link}/>
} else {
const end = link.end ? {end: true} : {end: undefined};
return <NavLink
className={classes}
className='item'
to={link.to}
{...end}
>
{link.text}
</NavLink>
} else {
return <DropdownLinks link={link}/>
}
}

View file

@ -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'):