From 53d43dc44c497fce7111beaa13755a365fb69aee Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 27 Apr 2025 16:19:58 -0400 Subject: [PATCH 1/2] working --- website/src/repl/idbutils.mjs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/website/src/repl/idbutils.mjs b/website/src/repl/idbutils.mjs index 70ccd8f8..5f5b75f4 100644 --- a/website/src/repl/idbutils.mjs +++ b/website/src/repl/idbutils.mjs @@ -54,25 +54,22 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete = splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user'; const blob = soundFile.blob; - // Files used to be uploaded as base64 strings, After Jan 1 2025 this check can be safely deleted - if (typeof blob === 'string') { - const soundPaths = sounds.get(parentDirectory) ?? new Set(); - soundPaths.add(blob); - sounds.set(parentDirectory, soundPaths); - return; - } - return blobToDataUrl(blob).then((soundPath) => { - const soundPaths = sounds.get(parentDirectory) ?? new Set(); - soundPaths.add(soundPath); - sounds.set(parentDirectory, soundPaths); + const titlePathMap = sounds.get(parentDirectory) ?? new Map(); + + titlePathMap.set(title,soundPath) + + sounds.set(parentDirectory, titlePathMap); return; }); }), ) .then(() => { - sounds.forEach((soundPaths, key) => { - const value = Array.from(soundPaths); + + sounds.forEach((titlePathMap, key) => { + const value = Array.from(titlePathMap.keys()).sort((a,b) => { + return a.localeCompare(b) + }).map(title => titlePathMap.get(title)); registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, value), { type: 'sample', From 3ee7d0cd4f7f53f1c9985c7fa9386c8728d044b0 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 27 Apr 2025 16:21:14 -0400 Subject: [PATCH 2/2] lint --- website/src/repl/idbutils.mjs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/website/src/repl/idbutils.mjs b/website/src/repl/idbutils.mjs index 5f5b75f4..5fc62c57 100644 --- a/website/src/repl/idbutils.mjs +++ b/website/src/repl/idbutils.mjs @@ -56,20 +56,21 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete = return blobToDataUrl(blob).then((soundPath) => { const titlePathMap = sounds.get(parentDirectory) ?? new Map(); - - titlePathMap.set(title,soundPath) - + + titlePathMap.set(title, soundPath); + sounds.set(parentDirectory, titlePathMap); return; }); }), ) .then(() => { - sounds.forEach((titlePathMap, key) => { - const value = Array.from(titlePathMap.keys()).sort((a,b) => { - return a.localeCompare(b) - }).map(title => titlePathMap.get(title)); + const value = Array.from(titlePathMap.keys()) + .sort((a, b) => { + return a.localeCompare(b); + }) + .map((title) => titlePathMap.get(title)); registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, value), { type: 'sample',