Remove suffix, don't alert on download cancel

This commit is contained in:
2026-08-06 16:30:01 -05:00
parent fecc87cd66
commit f07e9f9c3a
7 changed files with 39 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ const FULL_URL_BY_SAMPLE = new Map();
const HISTORY_KEY = "capturedS3History";
const MAX_HISTORY_ITEMS = 500;
const TARGET_HOST = "splice.com";
const TARGET_PATH = "/sounds/search/samples";
const TARGET_PATH_PREFIX = "/sounds";
const AUDIO_SAMPLE_PATH_RE = /\/audio_samples\//i;
const WAVEFORM_PATH_RE = /\.wv\.json$/i;
const SCRAMBLED_PATH_RE = /-scrambled\//i;
@@ -18,7 +18,9 @@ function isDomainAllowed(pageUrl) {
}
try {
const parsed = new URL(pageUrl);
return parsed.protocol === "https:" && parsed.hostname === TARGET_HOST && parsed.pathname === TARGET_PATH;
const path = parsed.pathname || "";
const inSoundsPath = path === TARGET_PATH_PREFIX || path.startsWith(TARGET_PATH_PREFIX + "/");
return parsed.protocol === "https:" && parsed.hostname === TARGET_HOST && inSoundsPath;
} catch (error) {
return false;
}
@@ -409,7 +411,7 @@ function deriveFilename(entry, mode) {
}
return `${safeStem}.wav`;
}
return `${safeStem}_decoded.mp3`;
return `${safeStem}.mp3`;
}
async function downloadDirectUrl(url, entry) {