From 27c8430915af0a11a5f0c3216053cf3c5f090c50 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 10 Oct 2019 20:17:01 -0400 Subject: Implement custom audio source --- ext/bg/js/audio.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index 0bf836df..9e0ae67c 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -85,6 +85,11 @@ const audioUrlBuilders = { } throw new Error('Failed to find audio URL'); + }, + 'custom': async (definition, optionsContext) => { + const options = await apiOptionsGet(optionsContext); + const customSourceUrl = options.audio.customSourceUrl; + return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (definition.hasOwnProperty(m1) ? `${definition[m1]}` : m0)); } }; -- cgit v1.2.3