From 24d8563ccce142c46387e0d4ec51c168ff9011e5 Mon Sep 17 00:00:00 2001 From: Lyric <5h3ll3x@gmail.com> Date: Tue, 4 Mar 2025 23:24:26 +0900 Subject: [PATCH] fix: adjust audio file paths for non-production environments --- .../theme/components/SpeakWordInlineConverter.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/1000-hours/.vitepress/theme/components/SpeakWordInlineConverter.vue b/1000-hours/.vitepress/theme/components/SpeakWordInlineConverter.vue index 3c42ae8f..897492ef 100644 --- a/1000-hours/.vitepress/theme/components/SpeakWordInlineConverter.vue +++ b/1000-hours/.vitepress/theme/components/SpeakWordInlineConverter.vue @@ -90,6 +90,16 @@ function convertToInlineComponent(el) { const dataAudio = fillDataAudio(el); console.log('inline component', dataAudio) + // check the hostname. + // if the hostname is not `1000h.org`, add `/1000-hours` to the dataAudio[i].value + if (window.location.hostname !== '1000h.org' || window.location.hostname !== 'localhost') { + for (let i = 0; i < dataAudio.length; i++) { + if (dataAudio[i].value) { + dataAudio[i].value = `/1000-hours${dataAudio[i].value}`; + } + } + } + const wrapperEl = document.createElement('div') wrapperEl.classList.add('speak-word-wrapper') const canEl = document.createElement('div')