This commit is contained in:
pavel 2026-02-25 01:08:13 +01:00
commit a4abbf7844
3 changed files with 9 additions and 4 deletions

View file

@ -1214,7 +1214,8 @@ function renderSounds(sounds) {
async function deleteSound(soundId) { async function deleteSound(soundId) {
if (!state.selectedGuildId) return; if (!state.selectedGuildId) return;
try { try {
const response = await fetch(`/guilds/${state.selectedGuildId}/sounds/${soundId}`, { const url = API_BASE_URL ? `${API_BASE_URL}/guilds/${state.selectedGuildId}/sounds/${soundId}` : `/guilds/${state.selectedGuildId}/sounds/${soundId}`;
const response = await fetch(url, {
method: 'DELETE' method: 'DELETE'
}); });
if (!response.ok) { if (!response.ok) {
@ -1228,11 +1229,12 @@ async function deleteSound(soundId) {
} }
function playRemoteSound(url) { function playRemoteSound(url) {
const fullUrl = API_BASE_URL && !url.startsWith('http') ? `${API_BASE_URL}${url}` : url;
if (state.voice.ws && state.voice.ws.readyState === WebSocket.OPEN) { if (state.voice.ws && state.voice.ws.readyState === WebSocket.OPEN) {
state.voice.ws.send(JSON.stringify({ type: 'play_sound', sound_url: url })); state.voice.ws.send(JSON.stringify({ type: 'play_sound', sound_url: fullUrl }));
} }
// Also play locally immediately // Also play locally immediately
const audio = new Audio(url); const audio = new Audio(fullUrl);
audio.play().catch(console.error); audio.play().catch(console.error);
} }
@ -1459,7 +1461,8 @@ async function init() {
try { try {
// Need to use fetch directly because api() might not handle FormData correctly depending on implementation // Need to use fetch directly because api() might not handle FormData correctly depending on implementation
const response = await fetch(`/guilds/${state.selectedGuildId}/sounds`, { const url = API_BASE_URL ? `${API_BASE_URL}/guilds/${state.selectedGuildId}/sounds` : `/guilds/${state.selectedGuildId}/sounds`;
const response = await fetch(url, {
method: 'POST', method: 'POST',
body: formData body: formData
}); });

View file

@ -367,6 +367,7 @@ select {
pointer-events: none; pointer-events: none;
white-space: nowrap; white-space: nowrap;
order: -1; order: -1;
margin-right: 4px;
} }
@keyframes fadeInOut { @keyframes fadeInOut {

View file

@ -367,6 +367,7 @@ select {
pointer-events: none; pointer-events: none;
white-space: nowrap; white-space: nowrap;
order: -1; order: -1;
margin-right: 4px;
} }
@keyframes fadeInOut { @keyframes fadeInOut {