feat: expose per-server default plays setting
This commit is contained in:
7 files changed
+91
-1
No files matched your search
@@ -59,6 +59,7 @@ export const api = {
|
||||
remove: (id: string) => post('/api/remove', { id }),
|
||||
reorder: (queueIds: string[]) => post('/api/reorder', { queue_ids: queueIds }),
|
||||
setTrackPlays: (id: string, plays: number) => post('/api/queue/plays', { id, plays }),
|
||||
setDefaultPlays: (plays: number) => post('/api/default_plays', { default_plays: plays }),
|
||||
|
||||
uploads: () => request<{ files: UploadedFile[] }>('/api/uploads'),
|
||||
deleteUpload: (filename: string) =>
|
||||
|
||||
@@ -10,6 +10,7 @@ const props = defineProps<{ status: BotStatus | null }>()
|
||||
const { notify, run } = useToasts()
|
||||
const selected = ref('')
|
||||
const selectedNotification = ref('')
|
||||
const defaultPlays = ref(5)
|
||||
|
||||
const channels = computed(() => props.status?.voice_channels ?? [])
|
||||
const active = computed(() => props.status?.active_voice_channel ?? null)
|
||||
@@ -29,6 +30,14 @@ watch(
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.status?.default_plays,
|
||||
(value) => {
|
||||
if (value !== undefined) defaultPlays.value = value
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
[activeNotificationId, notificationChannels],
|
||||
([activeChannel, available]) => {
|
||||
@@ -61,6 +70,14 @@ async function setNotificationChannel() {
|
||||
'Nie udało się ustawić kanału logów',
|
||||
)
|
||||
}
|
||||
|
||||
async function saveDefaultPlays() {
|
||||
await run(
|
||||
() => api.setDefaultPlays(defaultPlays.value),
|
||||
'Zapisano domyślną liczbę odtworzeń',
|
||||
'Nie udało się zapisać domyślnej liczby odtworzeń',
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -121,6 +138,24 @@ async function setNotificationChannel() {
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="default-plays-row">
|
||||
<label for="default-plays">Domyślny licznik</label>
|
||||
<input
|
||||
id="default-plays"
|
||||
v-model.number="defaultPlays"
|
||||
class="premium-input"
|
||||
type="number"
|
||||
min="1"
|
||||
max="999"
|
||||
>
|
||||
<button
|
||||
class="btn btn-secondary"
|
||||
type="button"
|
||||
@click="saveDefaultPlays"
|
||||
>
|
||||
Zapisz
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -143,4 +178,20 @@ async function setNotificationChannel() {
|
||||
.notification-channel-row .premium-select {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.default-plays-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.default-plays-row label {
|
||||
min-width: 130px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.default-plays-row .premium-input {
|
||||
width: 90px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user