fix(voice): media queue field mismatch, voice joinable filter, connect error toast

Audit voice (kirim/terima/music/screenshare) menemukan 3 masalah:
1. media:queue SILENT no-op — backend publish {source,mode} tapi gateway
   handler baca payload.url → selalu 'received without a URL'. Backend
   sekarang kirim {url,mode}, gateway terima url ATAU source (robust).
2. Voice connect gagal diam-diam saat user pilih channel tanpa permission
   (joinable=false, contoh Music 32/64/128/256k). Backend+gateway sekarang
   expose joinable; FE disable channel 'no akses' + empty state.
3. FE tidak kasih feedback saat connect gagal — tambah toast.error dengan
   pesan dari backend.

Verified live: @discordjs/voice connect ke Lofi Radio joinable sukses
(VOICE READY, DAVE session OK) — pipeline voice sebenarnya sehat, masalah
utama UX. media:queue fix akan di-verify setelah deploy.
This commit is contained in:
asepharyana
2026-08-03 07:48:50 +07:00
parent 9abb09dd33
commit a57eeb2e22
7 changed files with 40 additions and 10 deletions
@@ -18,6 +18,7 @@ import {
useVoiceStatus,
} from "@/hooks";
import { useWebSocket } from "@/lib/ws/context";
import { toast } from "sonner";
type VoiceTab = "connection" | "activity";
@@ -104,12 +105,22 @@ export default function VoicePage() {
selectedChannel={selectedChannel}
onGuildChange={handleGuildChange}
onChannelChange={(v) => setSelectedChannel(v ?? "")}
onConnect={() =>
connectMut.mutate({
guildId: selectedGuild,
channelId: selectedChannel,
})
}
onConnect={() => {
void connectMut
.mutateAsync({
guildId: selectedGuild,
channelId: selectedChannel,
})
.catch((err: unknown) => {
const msg =
err instanceof Error
? err.message
: "Gagal connect ke voice channel";
toast.error("Voice connect gagal", {
description: msg,
});
});
}}
onDisconnect={() => {
if (micActive) {
setMicActive(false);
@@ -119,10 +119,19 @@ export function VoiceConnectionCard({
</SelectTrigger>
<SelectContent>
{voiceChannels.map((c) => (
<SelectItem key={c.id} value={c.id}>
{c.name}
<SelectItem
key={c.id}
value={c.id}
disabled={c.joinable === false}
>
{c.joinable === false ? `${c.name} (no akses)` : c.name}
</SelectItem>
))}
{voiceChannels.length === 0 && (
<div className="px-3 py-2 text-xs text-text-secondary/60">
Tidak ada voice channel
</div>
)}
</SelectContent>
</Select>
</div>
+2
View File
@@ -8,6 +8,8 @@ export interface Channel {
id: string;
name: string;
type: "voice" | "text";
/** Whether the selfbot account can actually join this voice channel. */
joinable?: boolean;
}
/** Shape of the /api/config response (camelCase keys from backend). */