New "browse" UI

Also, separated out browse, ?meta, and ?module request handlers.

Fixes #82
This commit is contained in:
Michael Jackson
2019-07-24 17:55:13 -07:00
parent ea35b3c4b0
commit 34baab07ab
57 changed files with 2431 additions and 686 deletions

View File

@ -1,3 +1,4 @@
import path from 'path';
import mime from 'mime';
mime.define(
@ -19,5 +20,9 @@ mime.define(
const textFiles = /\/?(\.[a-z]*rc|\.git[a-z]*|\.[a-z]*ignore|\.lock)$/i;
export default function getContentType(file) {
return textFiles.test(file) ? 'text/plain' : mime.getType(file);
const name = path.basename(file);
return textFiles.test(name)
? 'text/plain'
: mime.getType(name) || 'text/plain';
}