additional detection with mime-types in module tracker

This commit is contained in:
Puniko 2023-02-19 10:29:20 +01:00
parent f323c65dde
commit eb6dbca9fd
2 changed files with 15 additions and 2 deletions

View file

@ -23,7 +23,7 @@ import XBanner from './media-banner.vue';
import XImage from './media-image.vue'; import XImage from './media-image.vue';
import XVideo from './media-video.vue'; import XVideo from './media-video.vue';
import XModPlayer from './mod-player.vue'; import XModPlayer from './mod-player.vue';
import { FILE_TYPE_BROWSERSAFE, FILE_EXT_TRACKER_MODULES } from '@/const'; import { FILE_TYPE_BROWSERSAFE, FILE_TYPE_TRACKER_MODULES, FILE_EXT_TRACKER_MODULES } from '@/const';
const props = defineProps<{ const props = defineProps<{
mediaList: foundkey.entities.DriveFile[]; mediaList: foundkey.entities.DriveFile[];
@ -130,7 +130,9 @@ const previewable = (file: foundkey.entities.DriveFile): boolean => {
}; };
const isModule = (file: foundkey.entities.DriveFile): boolean => { const isModule = (file: foundkey.entities.DriveFile): boolean => {
return FILE_EXT_TRACKER_MODULES.some((ext) => { return FILE_TYPE_TRACKER_MODULES.some((type) => {
return file.type === type;
}) || FILE_EXT_TRACKER_MODULES.some((ext) => {
return file.name.toLowerCase().endsWith("." + ext); return file.name.toLowerCase().endsWith("." + ext);
}); });
}; };

View file

@ -47,6 +47,17 @@ export const FILE_TYPE_BROWSERSAFE = [
'audio/vnd.wave', 'audio/vnd.wave',
]; ];
export const FILE_TYPE_TRACKER_MODULES = [
"audio/mod",
"audio/x-mod",
"audio/s3m",
"audio/x-s3m",
"audio/xm",
"audio/x-xm",
"audio/it",
"audio/x-it"
];
export const FILE_EXT_TRACKER_MODULES = [ export const FILE_EXT_TRACKER_MODULES = [
'mod', 'mod',
's3m', 's3m',