set butterchurn as the default visualizer

This commit is contained in:
Eduard Prigoana 2026-02-11 09:49:59 +00:00
parent 9d81ada6ab
commit 304eb78d7b
5 changed files with 34 additions and 11 deletions

View file

@ -684,9 +684,9 @@ export const visualizerSettings = {
getPreset() {
try {
return localStorage.getItem(this.PRESET_KEY) || 'lcd';
return localStorage.getItem(this.PRESET_KEY) || 'butterchurn';
} catch {
return 'lcd';
return 'butterchurn';
}
},

View file

@ -20,21 +20,30 @@ async function loadPresetsModule() {
isLoading = true;
try {
// Dynamic import to code-split butterchurn-presets into separate chunk
const butterchurnPresets = await import('butterchurn-presets');
console.log('[Butterchurn] Presets module loaded, type:', typeof butterchurnPresets);
// Load butterchurn-presets via script tag to avoid ES module issues
if (!window.butterchurnPresets) {
await new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = '/lib/butterchurnPresets.min.js';
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
});
}
// The module has a static getPresets method
if (typeof butterchurnPresets.default?.getPresets !== 'function') {
const butterchurnPresets = window.butterchurnPresets;
console.log('[Butterchurn] Presets loaded, type:', typeof butterchurnPresets);
if (typeof butterchurnPresets?.getPresets !== 'function') {
console.error(
'[Butterchurn] butterchurnPresets.getPresets is not a function:',
typeof butterchurnPresets.default?.getPresets
typeof butterchurnPresets?.getPresets
);
isLoading = false;
return;
}
const allPresets = butterchurnPresets.default.getPresets();
const allPresets = butterchurnPresets.getPresets();
cachedPresets = allPresets || {};
cachedPresetKeys = Object.keys(cachedPresets);

View file

@ -48,11 +48,11 @@
},
"dependencies": {
"@neutralinojs/lib": "^6.5.0",
"cookie-session": "^2.1.0",
"jose": "^6.0.11",
"butterchurn": "^2.6.7",
"butterchurn-presets": "^2.4.7",
"cookie-session": "^2.1.0",
"dashjs": "^5.1.1",
"jose": "^6.0.11",
"pocketbase": "^0.26.5"
}
}

1
public/lib/butterchurnPresets.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -8,6 +8,19 @@ export default defineConfig(({ mode }) => {
return {
base: './',
resolve: {
alias: {
pocketbase: '/node_modules/pocketbase/dist/pocketbase.es.js',
},
},
optimizeDeps: {
exclude: ['pocketbase'],
},
server: {
fs: {
allow: ['.', 'node_modules'],
},
},
build: {
outDir: 'dist',
emptyOutDir: true,