From a1d6180e9ac75bbf41786f6cb370031725d3344d Mon Sep 17 00:00:00 2001 From: Rintim Date: Sun, 21 Apr 2024 21:04:20 +0800 Subject: [PATCH] feat: audio blob support. --- noname/game/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/noname/game/index.js b/noname/game/index.js index 9053a1371..993b7d30c 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -409,7 +409,9 @@ export class Game { style.transform = "scale(1.05)"; } document.body.insertBefore(uiBackground, document.body.firstChild); - if (background.startsWith("db:")) uiBackground.setBackgroundDB(background.slice(3)); + if (background.startsWith("blob:") || background.startsWith("data:")) { + uiBackground.setBackgroundImage(background); + } else if (background.startsWith("db:")) uiBackground.setBackgroundDB(background.slice(3)); else if (background.startsWith("ext:")) uiBackground.setBackgroundImage(`extension/${background.slice(4)}`); else if (background == "default") { @@ -1441,7 +1443,8 @@ export class Game { if (_status.video) break; } if (path.startsWith("ext:")) path = path.replace(/^ext:/, "extension/"); - else if (!path.startsWith("db:")) path = `audio/${path}`; + else if (!["db:", "blob:", "data:"].some((prefix) => path.startsWith(prefix))) + path = `audio/${path}`; if (!lib.config.repeat_audio && _status.skillaudio.includes(path)) return; } const audio = document.createElement("audio");