Merge pull request #1034 from tidalcycles/fix-sampler-paths

Fix sampler paths
This commit is contained in:
Felix Roos 2024-03-30 16:05:27 +01:00 committed by GitHub
commit eb3e6d60b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 6 deletions

View File

@ -14,9 +14,9 @@
"snapshot": "npm run pretest && vitest run -u --silent",
"repl": "npm run prestart && cd website && npm run dev",
"start": "npm run prestart && cd website && npm run dev",
"dev": "npm run prestart && cd website && npm run dev & npm run sampler",
"dev": "npm run prestart && cd website && npm run dev",
"build": "npm run prebuild && cd website && npm run build",
"preview": "cd website && npm run preview & npm run sampler",
"preview": "cd website && npm run preview",
"osc": "cd packages/osc && npm run server",
"jsdoc": "jsdoc packages/ -c jsdoc/jsdoc.config.json",
"jsdoc-json": "jsdoc packages/ --template ./node_modules/jsdoc-json --destination doc.json -c jsdoc/jsdoc.config.json",

View File

@ -1,6 +1,6 @@
{
"name": "@strudel/sampler",
"version": "0.0.7",
"version": "0.0.8",
"description": "",
"keywords": [
"tidalcycles",

View File

@ -68,12 +68,13 @@ const server = http.createServer(async (req, res) => {
res.setHeader('Content-Type', 'application/json');
return res.end(JSON.stringify(banks));
}
if (!files.includes(req.url)) {
let subpath = decodeURIComponent(req.url);
if (!files.includes(subpath)) {
res.statusCode = 404;
res.end('File not found');
return;
}
const filePath = join(directory, req.url);
const filePath = join(directory, subpath);
const readStream = createReadStream(filePath);
readStream.on('error', (err) => {
res.statusCode = 500;

View File

@ -1,5 +1,5 @@
# samples folder
1. copy any samples to this folder
2. either run strudel locally (`pnpm dev` or `pnpm build && pnpm preview`), or run `npx @strudel/sampler` from this folder
2. run `npx @strudel/sampler` from this folder
3. add `samples('local:')` to your code