FIX: Windows build crash 'app\static does not exist' (datas absolute + APP_DIR freeze-aware) + VU meter ARM/MIDI keyboard

This commit is contained in:
2026-08-08 11:51:15 +00:00
parent f7b0172fdc
commit 7dda81b1d3
6 changed files with 48 additions and 15 deletions
+4 -1
View File
@@ -58,7 +58,10 @@ app.add_middleware(
# Mount storage directory (must come before general /static mount)
app.mount("/static/audio", StaticFiles(directory=settings.STORAGE_DIR), name="audio")
# Mount app static files (js, css)
STATIC_DIR = os.path.join(os.path.dirname(__file__), "static")
# Dùng settings.APP_DIR (freeze-aware) thay vì os.path.dirname(__file__):
# khi PyInstaller onefile, __file__ trỏ vào thư mục giải nén tạm _MEI...
# nhưng static/templates nằm trong sys._MEIPASS/app (config.py đã xử lý).
STATIC_DIR = os.path.join(settings.APP_DIR, "static")
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
# Include routers
+11 -1
View File
@@ -25744,8 +25744,18 @@ STRICT CONSTRAINTS:
try {
// Khi STOP (không play, không recording): v VU RNG không đc analyser/
// activity hết animation dính + master không full sau khi dng play.
// NGOI L: nếu có MIDI activity live (bt ARM track + bm phím MIDI
// keyboard KHÔNG play/record) thì KHÔNG early-return track VU phi
// nhy theo midiVuActivityRef + decay (user bug: ARM + phím MIDI VU
// đng yên vì block này v rng và return trưc khi đc activity).
const isRecActive = activeAudioRecordersRef.current && Object.keys(activeAudioRecordersRef.current).length > 0;
if (!isPlaying && !isRecActive) {
let liveMidiVu = false;
try {
for (const _k in midiVuActivityRef.current) {
if (midiVuActivityRef.current[_k] > 0.001) { liveMidiVu = true; break; }
}
} catch (e) { }
if (!isPlaying && !isRecActive && !liveMidiVu) {
setMasterVU(0);
setMasterMeterPeak(0);
Object.keys(trackVuRefs.current).forEach(k => {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -24,7 +24,7 @@
<script src="/static/js/services/midiExtractor.js?v=202607281052"></script>
<script src="/static/js/services/promptTemplateManager.js?v=202607281039"></script>
<script src="/static/js/services/undoRedoEngine.js?v=202607290941"></script>
<script src="/static/js/app.precompiled.js?v=202608070950" defer></script>
<script src="/static/js/app.precompiled.js?v=202608081200" defer></script>
<link rel="stylesheet" href="/static/css/styles.css?v=202607271016">
<style>
:root {