From 1014d592f7acadb759c17e54d4a1f1f6c49e6515 Mon Sep 17 00:00:00 2001 From: Tony Ribeiro Date: Thu, 24 Aug 2023 22:17:54 +0200 Subject: [PATCH] Added a refresh assets button to audio UI to detect audio asset again. Usefull after download an asset or putting a file manually. --- public/scripts/extensions/audio/index.js | 11 +++++++++++ public/scripts/extensions/audio/style.css | 5 +++++ public/scripts/extensions/audio/window.html | 6 ++++++ server.js | 6 +++--- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/public/scripts/extensions/audio/index.js b/public/scripts/extensions/audio/index.js index fed86fdd3..d082f1c3d 100644 --- a/public/scripts/extensions/audio/index.js +++ b/public/scripts/extensions/audio/index.js @@ -563,6 +563,17 @@ jQuery(async () => { $("#audio_bgm_cooldown").on("input", onBGMCooldownInput); + // Reset assets container, will be redected like if ST restarted + $("#audio_refresh_assets").on("click", function(){ + console.debug(DEBUG_PREFIX,"Refreshing audio assets"); + fallback_BGMS = null; + ambients = null; + characterMusics = {}; + currentCharacterBGM = null; + currentExpressionBGM = null; + currentBackground = null; + }) + // DBG $("#audio_debug").on("click", function () { if ($("#audio_debug").is(':checked')) { diff --git a/public/scripts/extensions/audio/style.css b/public/scripts/extensions/audio/style.css index 361386c71..97b3d42b4 100644 --- a/public/scripts/extensions/audio/style.css +++ b/public/scripts/extensions/audio/style.css @@ -14,4 +14,9 @@ .audio-mute-button-muted { color: red; +} + +#audio_refresh_assets { + width: 50px; + height: 30px; } \ No newline at end of file diff --git a/public/scripts/extensions/audio/window.html b/public/scripts/extensions/audio/window.html index c9eaf467c..7d5425aa7 100644 --- a/public/scripts/extensions/audio/window.html +++ b/public/scripts/extensions/audio/window.html @@ -16,6 +16,12 @@ Debug +
+ + +
diff --git a/server.js b/server.js index 58d5944df..33ae47a2b 100644 --- a/server.js +++ b/server.js @@ -5070,13 +5070,13 @@ app.post('/asset_download', jsonParser, async (request, response) => { const url = request.body.url; const inputCategory = request.body.category; const inputFilename = sanitize(request.body.filename); - const validCategories = ["bgm", "ambient"] + const validCategories = ["bgm", "ambient"]; // Check category - let category = null + let category = null; for (i of validCategories) if (i == inputCategory) - category = i + category = i; if (category === null) { console.debug("Bad request: unsuported asset category.");