client: improved module tracker file detection

Reviewed-on: FoundKeyGang/FoundKey#344
Changelog: Fixed
This commit is contained in:
Johann150 2023-02-19 15:03:44 +01:00
commit 3acf127e1d
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 13 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,7 @@ 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.includes(file.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',