mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 02:30:29 +03:00
Render file as readable with ext (#1446)
This commit is contained in:
parent
609b132106
commit
152576e85d
4 changed files with 58 additions and 11 deletions
|
|
@ -57,6 +57,43 @@ export const READABLE_TEXT_MIME_TYPES = [
|
|||
...TEXT_MIME_TYPE,
|
||||
];
|
||||
|
||||
export const READABLE_EXT_TO_MIME_TYPE: Record<string, string> = {
|
||||
go: 'text/go',
|
||||
rs: 'text/rust',
|
||||
py: 'text/python',
|
||||
swift: 'text/swift',
|
||||
c: 'text/c',
|
||||
cpp: 'text/cpp',
|
||||
java: 'text/java',
|
||||
kt: 'text/kotlin',
|
||||
lua: 'text/lua',
|
||||
php: 'text/php',
|
||||
ts: 'text/typescript',
|
||||
js: 'text/javascript',
|
||||
jsx: 'text/jsx',
|
||||
tsx: 'text/tsx',
|
||||
html: 'text/html',
|
||||
xhtml: 'text/xhtml',
|
||||
xht: 'text/xhtml',
|
||||
css: 'text/css',
|
||||
scss: 'text/scss',
|
||||
sass: 'text/sass',
|
||||
json: 'text/json',
|
||||
md: 'text/markdown',
|
||||
yaml: 'text/yaml',
|
||||
yni: 'text/yni',
|
||||
xml: 'text/xml',
|
||||
txt: 'text/plain',
|
||||
text: 'text/plain',
|
||||
conf: 'text/conf',
|
||||
cfg: 'text/conf',
|
||||
cnf: 'text/conf',
|
||||
log: 'text/log',
|
||||
me: 'text/me',
|
||||
cvs: 'text/cvs',
|
||||
tvs: 'text/tvs',
|
||||
};
|
||||
|
||||
export const ALLOWED_BLOB_MIME_TYPES = [
|
||||
...IMAGE_MIME_TYPES,
|
||||
...VIDEO_MIME_TYPES,
|
||||
|
|
@ -92,3 +129,7 @@ export const mimeTypeToExt = (mimeType: string): string => {
|
|||
const extStart = mimeType.lastIndexOf('/') + 1;
|
||||
return mimeType.slice(extStart);
|
||||
};
|
||||
export const getFileNameExt = (fileName: string): string => {
|
||||
const extStart = fileName.lastIndexOf('.') + 1;
|
||||
return fileName.slice(extStart);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue