Add quick fix for non root bases

This commit is contained in:
Priere 2023-12-03 16:47:40 -05:00
parent ac41426a20
commit 3e5664a877
7 changed files with 34 additions and 14 deletions

View file

@ -13,6 +13,10 @@ import { FilesTab } from './FilesTab';
const TAURI = window.__TAURI__;
const { BASE_URL } = import.meta.env;
const base = BASE_URL;
const baseNoTrailing = base.endsWith('/') ? base.slice(0, -1) : base;
export function Footer({ context }) {
const footerContent = useRef();
const [log, setLog] = useState([]);
@ -154,7 +158,7 @@ function WelcomeTab() {
</p>
<p>
To learn more about what this all means, check out the{' '}
<a href="./workshop/getting-started" target="_blank">
<a href={`${baseNoTrailing}/workshop/getting-started`} target="_blank">
interactive tutorial
</a>
. Also feel free to join the{' '}

View file

@ -12,6 +12,10 @@ import './Repl.css';
const { BASE_URL } = import.meta.env;
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
const { BASE_URL } = import.meta.env;
const base = BASE_URL;
const baseNoTrailing = base.endsWith('/') ? base.slice(0, -1) : base;
export function Header({ context }) {
const {
embedded,

View file

@ -3,6 +3,10 @@ import { registerSynthSounds, registerZZFXSounds, samples } from '@strudel.cycle
import './piano.mjs';
import './files.mjs';
const { BASE_URL } = import.meta.env;
const base = BASE_URL;
const baseNoTrailing = base.endsWith('/') ? base.slice(0, -1) : base;
export async function prebake() {
// https://archive.org/details/SalamanderGrandPianoV3
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
@ -14,16 +18,16 @@ export async function prebake() {
// => getting "window is not defined", as soon as "@strudel.cycles/soundfonts" is imported statically
// seems to be a problem with soundfont2
import('@strudel.cycles/soundfonts').then(({ registerSoundfonts }) => registerSoundfonts()),
samples(`./piano.json`, `./piano/`, { prebake: true }),
samples(`${baseNoTrailing}/piano.json`, `./piano/`, { prebake: true }),
// https://github.com/sgossner/VCSL/
// https://api.github.com/repositories/126427031/contents/
// LICENSE: CC0 general-purpose
samples(`./vcsl.json`, 'github:sgossner/VCSL/master/', { prebake: true }),
samples(`./tidal-drum-machines.json`, 'github:ritchse/tidal-drum-machines/main/machines/', {
samples(`${baseNoTrailing}/vcsl.json`, 'github:sgossner/VCSL/master/', { prebake: true }),
samples(`${baseNoTrailing}/tidal-drum-machines.json`, 'github:ritchse/tidal-drum-machines/main/machines/', {
prebake: true,
tag: 'drum-machines',
}),
samples(`./EmuSP12.json`, `./EmuSP12/`, { prebake: true, tag: 'drum-machines' }),
samples(`${baseNoTrailing}/EmuSP12.json`, `${baseNoTrailing}/EmuSP12/`, { prebake: true, tag: 'drum-machines' }),
samples(
{
casio: ['casio/high.wav', 'casio/low.wav', 'casio/noise.wav'],