text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```vue <template> <tab :label="$gettext('Artwork')"> <div class="row g-3"> <div class="col-md-8"> <form-group id="edit_form_art"> <template #label> {{ $gettext('Select PNG/JPG artwork file') }} </template> <template #description> {{ $gettext('Artwork must be a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels for Apple Podcasts.') }} </template> <template #default="{id}"> <form-file :id="id" accept="image/jpeg, image/png" @uploaded="uploaded" /> </template> </form-group> </div> <div v-if="src && src !== ''" class="col-md-4" > <img :src="src" :alt="$gettext('Artwork')" class="rounded img-fluid" > <div class="block-buttons pt-3"> <button type="button" class="btn btn-block btn-danger" @click="deleteArt" > {{ $gettext('Clear Artwork') }} </button> </div> </div> </div> </tab> </template> <script setup lang="ts"> import {computed, ref, toRef, watch} from "vue"; import {useAxios} from "~/vendor/axios"; import FormGroup from "~/components/Form/FormGroup.vue"; import FormFile from "~/components/Form/FormFile.vue"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ modelValue: { type: Object, default: null }, artworkSrc: { type: String, default: null }, newArtUrl: { type: String, required: true }, }); const emit = defineEmits(['update:modelValue']); const artworkSrc = ref(props.artworkSrc); const reloadArt = () => { artworkSrc.value = props.artworkSrc + '?' + Math.floor(Date.now() / 1000); } watch(toRef(props, 'artworkSrc'), reloadArt); const localSrc = ref(null); const src = computed(() => { return localSrc.value ?? artworkSrc.value; }); const {axios} = useAxios(); const uploaded = (file) => { if (null === file) { return; } const fileReader = new FileReader(); fileReader.addEventListener('load', () => { localSrc.value = fileReader.result; }, false); fileReader.readAsDataURL(file); const url = (props.artworkSrc) ? props.artworkSrc : props.newArtUrl; const formData = new FormData(); formData.append('art', file); axios.post(url, formData).then((resp) => { emit('update:modelValue', resp.data); reloadArt(); }); }; const deleteArt = () => { if (props.artworkSrc) { axios.delete(props.artworkSrc).then(() => { reloadArt(); localSrc.value = null; }); } else { reloadArt(); localSrc.value = null; } } </script> ```
/content/code_sandbox/frontend/components/Stations/Podcasts/Common/Artwork.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
701
```vue <template> <div class="row g-2" v-bind="$attrs" > <div class="col-6"> <input :id="id+'_date'" v-model="publishDate" class="form-control" type="date" > </div> <div class="col-6"> <input :id="id+'_time'" v-model="publishTime" class="form-control" type="time" > </div> </div> </template> <script setup lang="ts"> import {ref, toRef, watch} from "vue"; import {useLuxon} from "~/vendor/luxon.ts"; import {useAzuraCastStation} from "~/vendor/azuracast.ts"; const props = defineProps({ id: { type: String, required: true, }, modelValue: { type: Number, default: null } }); const emit = defineEmits(['update:modelValue']); const publishDate = ref<string>(''); const publishTime = ref<string>(''); const {DateTime} = useLuxon(); const {timezone} = useAzuraCastStation(); watch(toRef(props, 'modelValue'), (publishAt) => { if (publishAt !== null) { const publishDateTime = DateTime.fromSeconds(publishAt, {zone: timezone}); publishDate.value = publishDateTime.toISODate(); publishTime.value = publishDateTime.toISOTime({ suppressMilliseconds: true, includeOffset: false }); } else { publishDate.value = ''; publishTime.value = ''; } }, { immediate: true }); const updatePublishAt = () => { if (publishDate.value.length > 0 && publishTime.value.length > 0) { const publishDateTimeString = publishDate.value + 'T' + publishTime.value; const publishDateTime = DateTime.fromISO(publishDateTimeString, {zone: timezone}); emit('update:modelValue', publishDateTime.toSeconds()); } else { emit('update:modelValue', null); } } watch(publishDate, () => { updatePublishAt(); }); watch(publishTime, () => { updatePublishAt(); }); </script> ```
/content/code_sandbox/frontend/components/Stations/Podcasts/Common/PublishAtFields.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
485
```vue <template> <section class="card mb-4" role="region" > <div class="card-header text-bg-primary"> <div class="d-flex align-items-center"> <h2 class="card-title flex-fill my-0"> {{ $gettext('Station Statistics') }} </h2> <div class="flex-shrink"> <date-range-dropdown v-model="dateRange" time-picker :tz="timezone" /> </div> </div> </div> <div class="card-body"> <tabs destroy-on-hide> <tab :label="$gettext('Best & Worst')"> <best-and-worst-tab :api-url="bestAndWorstUrl" :date-range="dateRange" /> </tab> <tab :label="$gettext('Listeners By Time Period')"> <listeners-by-time-period-tab :api-url="listenersByTimePeriodUrl" :date-range="dateRange" /> </tab> <tab :label="$gettext('Listening Time')"> <listening-time-tab :api-url="listeningTimeUrl" :date-range="dateRange" /> </tab> <tab :label="$gettext('Streams')"> <streams-tab :api-url="byStreamUrl" :date-range="dateRange" /> </tab> <tab v-if="showFullAnalytics" :label="$gettext('Clients')" > <clients-tab :api-url="byClientUrl" :date-range="dateRange" /> </tab> <tab v-if="showFullAnalytics" :label="$gettext('Browsers')" > <browsers-tab :api-url="byBrowserUrl" :date-range="dateRange" /> </tab> <tab v-if="showFullAnalytics" :label="$gettext('Countries')" > <countries-tab :api-url="byCountryUrl" :date-range="dateRange" /> </tab> </tabs> </div> </section> </template> <script setup lang="ts"> import DateRangeDropdown from "~/components/Common/DateRangeDropdown.vue"; import ListenersByTimePeriodTab from "./Overview/ListenersByTimePeriodTab.vue"; import BestAndWorstTab from "./Overview/BestAndWorstTab.vue"; import BrowsersTab from "./Overview/BrowsersTab.vue"; import CountriesTab from "./Overview/CountriesTab.vue"; import StreamsTab from "./Overview/StreamsTab.vue"; import ClientsTab from "./Overview/ClientsTab.vue"; import ListeningTimeTab from "~/components/Stations/Reports/Overview/ListeningTimeTab.vue"; import {ref} from "vue"; import {getStationApiUrl} from "~/router"; import Tabs from "~/components/Common/Tabs.vue"; import Tab from "~/components/Common/Tab.vue"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; import {useAzuraCastStation} from "~/vendor/azuracast.ts"; const props = defineProps({ showFullAnalytics: { type: Boolean, required: true } }); const listenersByTimePeriodUrl = getStationApiUrl('/reports/overview/charts'); const bestAndWorstUrl = getStationApiUrl('/reports/overview/best-and-worst'); const byStreamUrl = getStationApiUrl('/reports/overview/by-stream'); const byBrowserUrl = getStationApiUrl('/reports/overview/by-browser'); const byCountryUrl = getStationApiUrl('/reports/overview/by-country'); const byClientUrl = getStationApiUrl('/reports/overview/by-client'); const listeningTimeUrl = getStationApiUrl('/reports/overview/by-listening-time'); const {timezone} = useAzuraCastStation(); const {now} = useStationDateTimeFormatter(); const nowTz = now(); const dateRange = ref({ startDate: nowTz.minus({days: 13}).toJSDate(), endDate: nowTz.toJSDate(), }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
876
```vue <template> <div class="card"> <div class="card-header text-bg-primary"> <div class="d-lg-flex align-items-center"> <h2 class="card-title flex-fill my-0"> {{ $gettext('Song Playback Timeline') }} </h2> <div class="flex-shrink buttons mt-2 mt-lg-0"> <a id="btn-export" class="btn btn-dark" :href="exportUrl" target="_blank" > <icon :icon="IconDownload" /> <span> {{ $gettext('Download CSV') }} </span> </a> </div> <div class="flex-shrink buttons ms-lg-2 mt-2 mt-lg-0"> <date-range-dropdown v-model="dateRange" time-picker :tz="timezone" /> </div> </div> </div> <data-table ref="$datatable" paginated select-fields :fields="fields" :api-url="apiUrl" > <template #cell(delta)="row"> <span class="typography-subheading"> <template v-if="row.item.delta_total > 0"> <span class="text-success"> <icon :icon="IconTrendingUp" /> {{ abs(row.item.delta_total) }} </span> </template> <template v-else-if="row.item.delta_total < 0"> <span class="text-danger"> <icon :icon="IconTrendingDown" /> {{ abs(row.item.delta_total) }} </span> </template> <template v-else> 0 </template> </span> </template> <template #cell(song)="row"> <div :class="{'text-muted': !row.item.is_visible}"> <template v-if="row.item.song.title"> <b>{{ row.item.song.title }}</b><br> {{ row.item.song.artist }} </template> <template v-else> {{ row.item.song.text }} </template> </div> </template> <template #cell(source)="row"> <template v-if="row.item.is_request"> {{ $gettext('Listener Request') }} </template> <template v-else-if="row.item.playlist"> {{ $gettext('Playlist:') }} {{ row.item.playlist }} </template> <template v-else-if="row.item.streamer"> {{ $gettext('Live Streamer:') }} {{ row.item.streamer }} </template> <template v-else> &nbsp; </template> </template> </data-table> </div> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import DataTable, {DataTableField} from "~/components/Common/DataTable.vue"; import DateRangeDropdown from "~/components/Common/DateRangeDropdown.vue"; import {computed, nextTick, ref, watch} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {getStationApiUrl} from "~/router"; import {IconDownload, IconTrendingDown, IconTrendingUp} from "~/components/Common/icons"; import useHasDatatable, {DataTableTemplateRef} from "~/functions/useHasDatatable.ts"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; import {useLuxon} from "~/vendor/luxon.ts"; import {useAzuraCastStation} from "~/vendor/azuracast.ts"; const baseApiUrl = getStationApiUrl('/history'); const {timezone} = useAzuraCastStation(); const {DateTime} = useLuxon(); const { now, formatDateTimeAsDateTime, formatTimestampAsDateTime } = useStationDateTimeFormatter(); const nowTz = now(); const dateRange = ref( { startDate: nowTz.minus({days: 13}).toJSDate(), endDate: nowTz.toJSDate(), } ); const {$gettext} = useTranslate(); const fields: DataTableField[] = [ { key: 'played_at', label: $gettext('Date/Time (Browser)'), selectable: true, sortable: false, visible: false, formatter: (value) => formatDateTimeAsDateTime( DateTime.fromSeconds(value, {zone: 'system'}), DateTime.DATETIME_SHORT ) }, { key: 'played_at_station', label: $gettext('Date/Time (Station)'), sortable: false, selectable: true, visible: true, formatter: (_value, _key, item) => formatTimestampAsDateTime( item.played_at, DateTime.DATETIME_SHORT ) }, { key: 'listeners_start', label: $gettext('Listeners'), selectable: true, sortable: false }, { key: 'delta', label: $gettext('Change'), selectable: true, sortable: false }, { key: 'song', isRowHeader: true, label: $gettext('Song Title'), selectable: true, sortable: false }, { key: 'source', label: $gettext('Source'), selectable: true, sortable: false } ]; const apiUrl = computed(() => { const apiUrl = new URL(baseApiUrl.value, document.location.href); const apiUrlParams = apiUrl.searchParams; apiUrlParams.set('start', DateTime.fromJSDate(dateRange.value.startDate).toISO()); apiUrlParams.set('end', DateTime.fromJSDate(dateRange.value.endDate).toISO()); return apiUrl.toString(); }); const exportUrl = computed(() => { const exportUrl = new URL(apiUrl.value, document.location.href); const exportUrlParams = exportUrl.searchParams; exportUrlParams.set('format', 'csv'); return exportUrl.toString(); }); const abs = (val) => { return Math.abs(val); }; const $datatable = ref<DataTableTemplateRef>(null); const {navigate} = useHasDatatable($datatable); watch(dateRange, () => nextTick(navigate)); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Timeline.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,329
```vue <template> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-header text-bg-primary"> <div class="d-lg-flex align-items-center"> <div class="flex-fill my-0"> <h2 class="card-title"> {{ $gettext('Listeners') }} </h2> </div> <div class="flex-shrink buttons mt-2 mt-lg-0"> <a id="btn-export" class="btn btn-dark" :href="exportUrl" target="_blank" > <icon :icon="IconDownload" /> <span> {{ $gettext('Download CSV') }} </span> </a> </div> <div v-if="!isLive" class="flex-shrink buttons ms-lg-2 mt-2 mt-lg-0" > <date-range-dropdown v-model="dateRange" time-picker :min-date="minDate" :max-date="maxDate" :tz="timezone" /> </div> </div> </div> <div class="card-body pb-0"> <nav class="nav nav-tabs" role="tablist" > <div class="nav-item" role="presentation" > <button class="nav-link" :class="(isLive) ? 'active' : ''" type="button" role="tab" @click="setIsLive(true)" > {{ $gettext('Live Listeners') }} </button> </div> <div class="nav-item" role="presentation" > <button class="nav-link" :class="(!isLive) ? 'active' : ''" type="button" role="tab" @click="setIsLive(false)" > {{ $gettext('Listener History') }} </button> </div> </nav> </div> <div id="map"> <StationReportsListenersMap :listeners="filteredListeners" /> </div> <div> <div class="card-body"> <div class="row row-cols-md-auto align-items-center"> <div class="col-12 text-start text-md-end h5"> {{ $gettext('Unique Listeners') }} <br> <small> {{ $gettext('for selected period') }} </small> </div> <div class="col-12 h3"> {{ listeners.length }} </div> <div class="col-12 text-start text-md-end h5"> {{ $gettext('Total Listener Hours') }} <br> <small> {{ $gettext('for selected period') }} </small> </div> <div class="col-12 h3"> {{ totalListenerHours }} </div> <div class="col-12"> <listener-filters-bar v-model:filters="filters" /> </div> </div> </div> <data-table id="station_listeners" ref="$datatable" paginated handle-client-side :fields="fields" :items="filteredListeners" select-fields @refresh-clicked="updateListeners()" > <!-- eslint-disable-next-line --> <template #cell(device.client)="row"> <div class="d-flex align-items-center"> <div class="flex-shrink-0 pe-2"> <span v-if="row.item.device.is_bot"> <icon :icon="IconRouter" /> <span class="visually-hidden"> {{ $gettext('Bot/Crawler') }} </span> </span> <span v-else-if="row.item.device.is_mobile"> <icon :icon="IconSmartphone" /> <span class="visually-hidden"> {{ $gettext('Mobile') }} </span> </span> <span v-else> <icon :icon="IconDesktopWindows" /> <span class="visually-hidden"> {{ $gettext('Desktop') }} </span> </span> </div> <div class="flex-fill"> <div v-if="row.item.device.client"> {{ row.item.device.client }} </div> <div class="small"> {{ row.item.user_agent }} </div> </div> </div> </template> <template #cell(stream)="row"> <span v-if="row.item.mount_name === ''"> {{ $gettext('Unknown') }} </span> <span v-else> {{ row.item.mount_name }}<br> <small v-if="row.item.mount_is_local"> {{ $gettext('Local') }} </small> <small v-else> {{ $gettext('Remote') }} </small> </span> </template> <template #cell(location)="row"> <span v-if="row.item.location.description"> {{ row.item.location.description }} </span> <span v-else> {{ $gettext('Unknown') }} </span> </template> </data-table> </div> <div class="card-body card-padding-sm text-muted" v-html="attribution" /> </div> </div> </div> </template> <script setup lang="ts"> import StationReportsListenersMap from "./Listeners/Map.vue"; import Icon from "~/components/Common/Icon.vue"; import DataTable, {DataTableField} from "~/components/Common/DataTable.vue"; import DateRangeDropdown from "~/components/Common/DateRangeDropdown.vue"; import {computed, ComputedRef, nextTick, onMounted, Ref, ref, ShallowRef, shallowRef, watch} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {useAxios} from "~/vendor/axios"; import {getStationApiUrl} from "~/router"; import {IconDesktopWindows, IconDownload, IconRouter, IconSmartphone} from "~/components/Common/icons"; import useHasDatatable, {DataTableTemplateRef} from "~/functions/useHasDatatable"; import {ListenerFilters, ListenerTypeFilter} from "~/components/Stations/Reports/Listeners/listenerFilters.ts"; import {filter} from "lodash"; import formatTime from "~/functions/formatTime.ts"; import ListenerFiltersBar from "./Listeners/FiltersBar.vue"; import {ApiListener} from "~/entities/ApiInterfaces.ts"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; import {useLuxon} from "~/vendor/luxon.ts"; const props = defineProps({ attribution: { type: String, required: true } }); const apiUrl = getStationApiUrl('/listeners'); const isLive = ref<boolean>(true); const listeners: ShallowRef<ApiListener[]> = shallowRef([]); const {DateTime} = useLuxon(); const { now, formatTimestampAsDateTime } = useStationDateTimeFormatter(); const nowTz = now(); const minDate = nowTz.minus({years: 5}).toJSDate(); const maxDate = nowTz.plus({days: 5}).toJSDate(); const dateRange = ref({ startDate: nowTz.minus({days: 1}).toJSDate(), endDate: nowTz.toJSDate() }); const filters: Ref<ListenerFilters> = ref({ minLength: null, maxLength: null, type: ListenerTypeFilter.All, }); const {$gettext} = useTranslate(); const fields: DataTableField[] = [ { key: 'ip', label: $gettext('IP'), sortable: false, selectable: true, visible: true }, { key: 'connected_time', label: $gettext('Time'), sortable: true, formatter: (_col, _key, item) => { return formatTime(item.connected_time) }, selectable: true, visible: true }, { key: 'connected_time_sec', label: $gettext('Time (sec)'), sortable: false, formatter: (_col, _key, item) => { return item.connected_time; }, selectable: true, visible: false }, { key: 'connected_on', label: $gettext('Start Time'), sortable: true, formatter: (_col, _key, item) => formatTimestampAsDateTime( item.connected_on, DateTime.DATETIME_SHORT ), selectable: true, visible: false }, { key: 'connected_until', label: $gettext('End Time'), sortable: true, formatter: (_col, _key, item) => formatTimestampAsDateTime( item.connected_until, DateTime.DATETIME_SHORT ), selectable: true, visible: false }, { key: 'device.client', isRowHeader: true, label: $gettext('User Agent'), sortable: true, selectable: true, visible: true }, { key: 'stream', label: $gettext('Stream'), sortable: true, selectable: true, visible: true }, { key: 'location', label: $gettext('Location'), sortable: true, sorter: (row: ApiListener): string => { return row.location?.country + ' ' + row.location?.region + ' ' + row.location?.city; }, selectable: true, visible: true } ]; const exportUrl = computed(() => { const exportUrl = new URL(apiUrl.value, document.location.href); const exportUrlParams = exportUrl.searchParams; exportUrlParams.set('format', 'csv'); if (!isLive.value) { exportUrlParams.set('start', DateTime.fromJSDate(dateRange.value.startDate).toISO()); exportUrlParams.set('end', DateTime.fromJSDate(dateRange.value.endDate).toISO()); } return exportUrl.toString(); }); const totalListenerHours = computed(() => { let tlh_seconds = 0; filteredListeners.value.forEach(function (listener) { tlh_seconds += listener.connected_time; }); const tlh_hours = tlh_seconds / 3600; return Math.round((tlh_hours + 0.00001) * 100) / 100; }); const {axios} = useAxios(); const $datatable = ref<DataTableTemplateRef>(null); const {navigate} = useHasDatatable($datatable); const hasFilters: ComputedRef<boolean> = computed(() => { return null !== filters.value.minLength || null !== filters.value.maxLength || ListenerTypeFilter.All !== filters.value.type; }); const filteredListeners: ComputedRef<ApiListener[]> = computed(() => { if (!hasFilters.value) { return listeners.value; } return filter( listeners.value, (row: ApiListener) => { const connectedTime: number = row.connected_time; if (null !== filters.value.minLength && connectedTime < filters.value.minLength) { return false; } if (null !== filters.value.maxLength && connectedTime > filters.value.maxLength) { return false; } if (ListenerTypeFilter.All !== filters.value.type) { if (ListenerTypeFilter.Mobile === filters.value.type && !row.device.is_mobile) { return false; } else if (ListenerTypeFilter.Desktop === filters.value.type && row.device.is_mobile) { return false; } } return true; } ); }); const updateListeners = () => { const params: { [key: string]: any } = {}; if (!isLive.value) { params.start = DateTime.fromJSDate(dateRange.value.startDate).toISO(); params.end = DateTime.fromJSDate(dateRange.value.endDate).toISO(); } axios.get(apiUrl.value, {params: params}).then((resp) => { listeners.value = resp.data; navigate(); if (isLive.value) { setTimeout(updateListeners, (!document.hidden) ? 15000 : 30000); } }).catch((error) => { if (isLive.value && (!error.response || error.response.data.code !== 403)) { setTimeout(updateListeners, (!document.hidden) ? 30000 : 120000); } }); }; watch(dateRange, updateListeners); onMounted(updateListeners); const setIsLive = (newValue: boolean) => { isLive.value = newValue; nextTick(updateListeners); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Listeners.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
2,729
```vue <template> <card-page :title="$gettext('SoundExchange Report')" > <form id="report-form" class="form vue-form" method="GET" :action="apiUrl" target="_blank" > <div class="card-body"> <form-fieldset> <p> This report is intended for licensing in the United States only, for webcasters paying royalties via SoundExchange. Learn more about the requirements for reporting and classification on the <a href="path_to_url" target="_blank" > SoundExchange web site </a>. </p> <ul> <li> AzuraCast assumes that your station fits SoundExchange Transmission Category A, "Eligible nonsubscription transmissions other than broadcast simulcasts and transmissions of non-music programming." If your station does not fall within this category, update the transmission category field accordingly. </li> <li> The data collected by AzuraCast meets the SoundExchange standard for Actual Total Performances (ATP) by tracking unique listeners across all song plays. All other information is derived from the metadata of the uploaded songs themselves, and may not be completely accurate. </li> <li> Reporting requirements for SoundExchange may change at any time. AzuraCast is non-commercial community-built software and cannot guarantee that its reporting format will always be up-to-date. </li> <li> You should always verify the report generated by AzuraCast before sending it. In particular, either the ISRC (International Standard Recording Code) or *both* the album and label are required for every row, and may not be provided in the song metadata. To locate an ISRC for a track, you should use <a href="path_to_url" target="_blank" >SoundExchange's ISRC search tool</a>. </li> </ul> </form-fieldset> <form-fieldset class="row"> <form-group-field id="form_start_date" name="start_date" :field="v$.start_date" input-type="date" class="col mb-3" > <template #label> {{ $gettext('Start Date') }} </template> </form-group-field> <form-group-field id="form_end_date" name="end_date" :field="v$.end_date" input-type="date" class="col mb-3" > <template #label> {{ $gettext('End Date') }} </template> </form-group-field> <form-group-checkbox id="form_edit_fetch_isrc" name="fetch_isrc" :field="v$.fetch_isrc" class="col-md-12" > <template #label> {{ $gettext('Attempt to Automatically Retrieve ISRC When Missing') }} </template> <template #description> {{ $gettext('If enabled, AzuraCast will connect to the MusicBrainz database to attempt to find an ISRC for any files where one is missing. Disabling this may improve performance.') }} </template> </form-group-checkbox> </form-fieldset> <button type="submit" class="btn" :class="(v$.$invalid) ? 'btn-danger' : 'btn-primary'" > {{ $gettext('Generate Report') }} </button> </div> </form> </card-page> </template> <script setup lang="ts"> import {required} from '@vuelidate/validators'; import FormGroupField from "~/components/Form/FormGroupField.vue"; import FormFieldset from "~/components/Form/FormFieldset.vue"; import FormGroupCheckbox from "~/components/Form/FormGroupCheckbox.vue"; import {useVuelidateOnForm} from "~/functions/useVuelidateOnForm"; import {getStationApiUrl} from "~/router"; import CardPage from "~/components/Common/CardPage.vue"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; const apiUrl = getStationApiUrl('/reports/soundexchange'); const {now} = useStationDateTimeFormatter(); const lastMonth = now().minus({months: 1}); const {v$} = useVuelidateOnForm( { start_date: {required}, end_date: {required}, fetch_isrc: {} }, { start_date: lastMonth.startOf('month').toISODate(), end_date: lastMonth.endOf('month').toISODate(), fetch_isrc: false } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/SoundExchange.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,020
```vue <template> <section class="card" role="region" > <div class="card-header text-bg-primary"> <h2 class="card-title"> {{ $gettext('Song Requests') }} </h2> </div> <div class="card-body"> <nav class="nav nav-tabs" role="tablist" > <div v-for="tab in tabs" :key="tab.type" class="nav-item" role="presentation" > <button class="nav-link" :class="(activeType === tab.type) ? 'active' : ''" type="button" role="tab" @click="setType(tab.type)" > {{ tab.title }} </button> </div> </nav> </div> <div v-if="activeType === 'pending'" class="card-body" > <button type="button" class="btn btn-danger" @click="doClear()" > <icon :icon="IconRemove" /> <span> {{ $gettext('Clear Pending Requests') }} </span> </button> </div> <data-table id="station_queue" ref="$datatable" :fields="fields" :api-url="listUrlForType" > <template #cell(timestamp)="row"> {{ formatTimestampAsDateTime(row.item.timestamp) }} </template> <template #cell(played_at)="row"> <span v-if="row.item.played_at === 0"> {{ $gettext('Not Played') }} </span> <span v-else> {{ formatTimestampAsDateTime(row.item.played_at) }} </span> </template> <template #cell(song_title)="row"> <div v-if="row.item.track.title"> <b>{{ row.item.track.title }}</b><br> {{ row.item.track.artist }} </div> <div v-else> {{ row.item.track.text }} </div> </template> <template #cell(ip)="row"> {{ row.item.ip }} </template> <template #cell(actions)="row"> <button v-if="row.item.played_at === 0" type="button" class="btn btn-sm btn-danger" @click="doDelete(row.item.links.delete)" > {{ $gettext('Delete') }} </button> </template> </data-table> </section> </template> <script setup lang="ts"> import DataTable, {DataTableField} from '~/components/Common/DataTable.vue'; import Icon from "~/components/Common/Icon.vue"; import {computed, nextTick, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {useSweetAlert} from "~/vendor/sweetalert"; import {useNotify} from "~/functions/useNotify"; import {useAxios} from "~/vendor/axios"; import {getStationApiUrl} from "~/router"; import {IconRemove} from "~/components/Common/icons"; import {DataTableTemplateRef} from "~/functions/useHasDatatable.ts"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; const listUrl = getStationApiUrl('/reports/requests'); const clearUrl = getStationApiUrl('/reports/requests/clear'); const activeType = ref('pending'); const listUrlForType = computed(() => { return listUrl.value + '?type=' + activeType.value; }); const {$gettext} = useTranslate(); const fields: DataTableField[] = [ {key: 'timestamp', label: $gettext('Date Requested'), sortable: false}, {key: 'played_at', label: $gettext('Date Played'), sortable: false}, {key: 'song_title', isRowHeader: true, label: $gettext('Song Title'), sortable: false}, {key: 'ip', label: $gettext('Requester IP'), sortable: false}, {key: 'actions', label: $gettext('Actions'), sortable: false} ]; const tabs = [ { type: 'pending', title: $gettext('Pending Requests') }, { type: 'history', title: $gettext('Request History') } ]; const $datatable = ref<DataTableTemplateRef>(null); const relist = () => { $datatable.value?.refresh(); }; const setType = (type) => { activeType.value = type; nextTick(relist); }; const {formatTimestampAsDateTime} = useStationDateTimeFormatter(); const {confirmDelete} = useSweetAlert(); const {notifySuccess} = useNotify(); const {axios} = useAxios(); const doDelete = (url) => { confirmDelete({ title: $gettext('Delete Request?'), }).then((result) => { if (result.value) { axios.delete(url).then((resp) => { notifySuccess(resp.data.message); relist(); }); } }); }; const doClear = () => { confirmDelete({ title: $gettext('Clear All Pending Requests?'), confirmButtonText: $gettext('Clear'), }).then((result) => { if (result.value) { axios.post(clearUrl.value).then((resp) => { notifySuccess(resp.data.message); relist(); }); } }); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Requests.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,164
```vue <template> <common-metrics-view :date-range="dateRange" :api-url="apiUrl" field-key="browser" :field-label="$gettext('Browser')" > <template #by_listeners_legend> {{ $gettext('Top Browsers by Listeners') }} </template> <template #by_connected_time_legend> {{ $gettext('Top Browsers by Connected Time') }} </template> </common-metrics-view> </template> <script setup lang="ts"> import CommonMetricsView from "./CommonMetricsView.vue"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/BrowsersTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
166
```vue <template> <common-metrics-view :date-range="dateRange" :api-url="apiUrl" field-key="client" :field-label="$gettext('Client')" > <template #by_listeners_legend> {{ $gettext('Clients by Listeners') }} </template> <template #by_connected_time_legend> {{ $gettext('Clients by Connected Time') }} </template> </common-metrics-view> </template> <script setup lang="ts"> import CommonMetricsView from "./CommonMetricsView.vue"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/ClientsTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
162
```vue <template> <span v-if="song.title !== ''"> <b>{{ song.title }}</b><br> {{ song.artist }} </span> <span v-else> {{ song.text }} </span> </template> <script setup lang="ts"> const props = defineProps({ song: { type: Object, required: true } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/SongText.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
86
```vue <template> <div class="buttons mb-3"> <input id="result-type-average" v-model="resultType" type="radio" class="btn-check" autocomplete="off" value="average" > <label class="btn btn-sm btn-outline-secondary" for="result-type-average" > {{ $gettext('Average Listeners') }} </label> <input id="result-type-unique" v-model="resultType" type="radio" class="btn-check" autocomplete="off" value="unique" > <label class="btn btn-sm btn-outline-secondary" for="result-type-unique" > {{ $gettext('Unique Listeners') }} </label> </div> <loading :loading="isLoading" lazy > <div class="row"> <div class="col-md-6 mb-4"> <fieldset> <legend> {{ $gettext('Listeners by Day') }} </legend> <time-series-chart style="width: 100%;" :data="chartData.daily.metrics" :alt="chartData.daily.alt" /> </fieldset> </div> <div class="col-md-6 mb-4"> <fieldset> <legend> {{ $gettext('Listeners by Day of Week') }} </legend> <pie-chart style="width: 100%;" :data="chartData.day_of_week.metrics" :labels="chartData.day_of_week.labels" :alt="chartData.day_of_week.alt" /> </fieldset> </div> <div class="col-md-12 mb-4"> <fieldset> <legend> {{ $gettext('Listeners by Hour') }} </legend> <div class="buttons mb-3"> <template v-for="(hourLabel, hour) in currentHourOptions" :key="hour" > <input :id="`charts-hour-${hour}`" v-model="currentHour" type="radio" class="btn-check" autocomplete="off" :value="hour" > <label class="btn btn-sm btn-outline-secondary" :for="`charts-hour-${hour}`" > {{ hourLabel }} </label> </template> </div> <hour-chart style="width: 100%;" :data="currentHourlyChart.metrics" :labels="currentHourlyChart.labels" :alt="currentHourlyChart.alt" :aspect-ratio="3" /> </fieldset> </div> </div> </loading> </template> <script setup lang="ts"> import TimeSeriesChart from "~/components/Common/Charts/TimeSeriesChart.vue"; import HourChart from "~/components/Common/Charts/HourChart.vue"; import PieChart from "~/components/Common/Charts/PieChart.vue"; import {computed, ref, toRef, watch} from "vue"; import {useAsyncState, useMounted} from "@vueuse/core"; import {useAxios} from "~/vendor/axios"; import Loading from "~/components/Common/Loading.vue"; import {useLuxon} from "~/vendor/luxon"; import {useTranslate} from "~/vendor/gettext.ts"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); const dateRange = toRef(props, 'dateRange'); const {axios} = useAxios(); const {DateTime} = useLuxon(); const resultType = ref('average'); const blankChartSection = { labels: [], metrics: [], alt: [] }; const {state: chartData, isLoading, execute: relist} = useAsyncState( () => axios.get(props.apiUrl, { params: { type: resultType.value, start: DateTime.fromJSDate(dateRange.value.startDate).toISO(), end: DateTime.fromJSDate(dateRange.value.endDate).toISO() } }).then(r => r.data), { daily: {...blankChartSection}, day_of_week: {...blankChartSection}, hourly: { all: {...blankChartSection}, day0: {...blankChartSection}, day1: {...blankChartSection}, day2: {...blankChartSection}, day3: {...blankChartSection}, day4: {...blankChartSection}, day5: {...blankChartSection}, day6: {...blankChartSection}, } }, { shallow: true } ); const currentHour = ref('all'); const {$gettext} = useTranslate(); const currentHourOptions = computed(() => ({ 'all': $gettext('All Days'), 'day0': $gettext('Monday'), 'day1': $gettext('Tuesday'), 'day2': $gettext('Wednesday'), 'day3': $gettext('Thursday'), 'day4': $gettext('Friday'), 'day5': $gettext('Saturday'), 'day6': $gettext('Sunday'), })); const currentHourlyChart = computed(() => { return chartData.value?.hourly[currentHour.value]; }); const isMounted = useMounted(); watch(dateRange, () => { if (isMounted.value) { relist(); } }); watch(resultType, () => { if (isMounted.value) { relist(); } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/ListenersByTimePeriodTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,199
```vue <template> <loading :loading="isLoading"> <fieldset> <legend> {{ $gettext('Listeners by Listening Time') }} </legend> <pie-chart style="width: 100%;" :data="stats.chart.datasets" :labels="stats.chart.labels" :alt="stats.chart.alt" :aspect-ratio="4" /> </fieldset> <data-table id="listening_time_table" ref="$datatable" paginated handle-client-side :fields="fields" :items="stats.all" @refresh-clicked="reloadData()" /> </loading> </template> <script setup lang="ts"> import PieChart from "~/components/Common/Charts/PieChart.vue"; import DataTable, {DataTableField} from "~/components/Common/DataTable.vue"; import {ref, toRef, watch} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {useAsyncState, useMounted} from "@vueuse/core"; import {useAxios} from "~/vendor/axios"; import Loading from "~/components/Common/Loading.vue"; import {useLuxon} from "~/vendor/luxon"; import useHasDatatable, {DataTableTemplateRef} from "~/functions/useHasDatatable"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true } }); const {$gettext} = useTranslate(); const fields: DataTableField[] = [ {key: 'label', label: $gettext('Listening Time'), sortable: false}, {key: 'value', label: $gettext('Listeners'), sortable: false} ]; const dateRange = toRef(props, 'dateRange'); const {axios} = useAxios(); const {DateTime} = useLuxon(); const {state: stats, isLoading, execute: reloadData} = useAsyncState( () => axios.get(props.apiUrl, { params: { start: DateTime.fromJSDate(dateRange.value.startDate).toISO(), end: DateTime.fromJSDate(dateRange.value.endDate).toISO() } }).then(r => r.data), { all: [], chart: { labels: [], datasets: [], alt: [] } } ); const $datatable = ref<DataTableTemplateRef>(); const {navigate} = useHasDatatable($datatable); const isMounted = useMounted(); watch(dateRange, () => { if (isMounted.value) { reloadData(); navigate(); } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/ListeningTimeTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
549
```vue <template> <loading :loading="isLoading" lazy > <div class="row"> <div class="col-md-6 mb-4"> <fieldset> <legend> <slot name="by_listeners_legend" /> </legend> <pie-chart style="width: 100%;" :data="stats.top_listeners.datasets" :labels="stats.top_listeners.labels" :alt="stats.top_listeners.alt" /> </fieldset> </div> <div class="col-md-6 mb-4"> <fieldset> <legend> <slot name="by_connected_time_legend" /> </legend> <pie-chart style="width: 100%;" :data="stats.top_connected_time.datasets" :labels="stats.top_connected_time.labels" :alt="stats.top_connected_time.alt" /> </fieldset> </div> </div> <data-table :id="fieldKey+'_table'" ref="$datatable" paginated handle-client-side :fields="fields" :items="stats.all" @refresh-clicked="reloadData()" > <template #cell(connected_seconds_calc)="row"> {{ formatTime(row.item.connected_seconds) }} </template> </data-table> </loading> </template> <script setup lang="ts"> import PieChart from "~/components/Common/Charts/PieChart.vue"; import DataTable, {DataTableField} from "~/components/Common/DataTable.vue"; import formatTime from "~/functions/formatTime"; import {ref, toRef, watch} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {useAsyncState, useMounted} from "@vueuse/core"; import {useAxios} from "~/vendor/axios"; import Loading from "~/components/Common/Loading.vue"; import {useLuxon} from "~/vendor/luxon"; import useHasDatatable, {DataTableTemplateRef} from "~/functions/useHasDatatable"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, fieldKey: { type: String, required: true }, fieldLabel: { type: String, required: true }, }); const {$gettext} = useTranslate(); const fields: DataTableField[] = [ {key: props.fieldKey, label: props.fieldLabel, sortable: true}, {key: 'listeners', label: $gettext('Listeners'), sortable: true}, {key: 'connected_seconds_calc', label: $gettext('Time'), sortable: false}, {key: 'connected_seconds', label: $gettext('Time (sec)'), sortable: true} ]; const dateRange = toRef(props, 'dateRange'); const {axios} = useAxios(); const {DateTime} = useLuxon(); const {state: stats, isLoading, execute: reloadData} = useAsyncState( () => axios.get(props.apiUrl, { params: { start: DateTime.fromJSDate(dateRange.value.startDate).toISO(), end: DateTime.fromJSDate(dateRange.value.endDate).toISO() } }).then(r => r.data), { all: [], top_listeners: { labels: [], datasets: [], alt: [] }, top_connected_time: { labels: [], datasets: [], alt: [] }, } ); const $datatable = ref<DataTableTemplateRef>(null); const {navigate} = useHasDatatable($datatable); const isMounted = useMounted(); watch(dateRange, () => { if (isMounted.value) { reloadData(); navigate(); } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/CommonMetricsView.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
812
```vue <template> <common-metrics-view :date-range="dateRange" :api-url="apiUrl" field-key="stream" :field-label="$gettext('Stream')" > <template #by_listeners_legend> {{ $gettext('Top Streams by Listeners') }} </template> <template #by_connected_time_legend> {{ $gettext('Top Streams by Connected Time') }} </template> </common-metrics-view> </template> <script setup lang="ts"> import CommonMetricsView from "./CommonMetricsView.vue"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/StreamsTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
164
```vue <template> <common-metrics-view :date-range="dateRange" :api-url="apiUrl" field-key="country" :field-label="$gettext('Country')" > <template #by_listeners_legend> {{ $gettext('Top Countries by Listeners') }} </template> <template #by_connected_time_legend> {{ $gettext('Top Countries by Connected Time') }} </template> </common-metrics-view> </template> <script setup lang="ts"> import CommonMetricsView from "./CommonMetricsView.vue"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/CountriesTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
164
```vue <template> <loading :loading="isLoading" lazy > <div class="row"> <div class="col-md-6 mb-4"> <fieldset> <legend> {{ $gettext('Best Performing Songs') }} </legend> <table class="table table-striped table-condensed table-nopadding"> <colgroup> <col width="20%"> <col width="80%"> </colgroup> <thead> <tr> <th> {{ $gettext('Change') }} </th> <th> {{ $gettext('Song') }} </th> </tr> </thead> <tbody> <tr v-for="row in state.bestAndWorst.best" :key="row.song.id" > <td class=" text-center text-success"> <icon :icon="IconChevronUp" /> {{ row.stat_delta }} <br> <small>{{ row.stat_start }} to {{ row.stat_end }}</small> </td> <td> <song-text :song="row.song" /> </td> </tr> </tbody> </table> </fieldset> </div> <div class="col-md-6 mb-4"> <fieldset> <legend> {{ $gettext('Worst Performing Songs') }} </legend> <table class="table table-striped table-condensed table-nopadding"> <colgroup> <col width="20%"> <col width="80%"> </colgroup> <thead> <tr> <th> {{ $gettext('Change') }} </th> <th> {{ $gettext('Song') }} </th> </tr> </thead> <tbody> <tr v-for="row in state.bestAndWorst.worst" :key="row.song.id" > <td class="text-center text-danger"> <icon :icon="IconChevronDown" /> {{ row.stat_delta }} <br> <small>{{ row.stat_start }} to {{ row.stat_end }}</small> </td> <td> <song-text :song="row.song" /> </td> </tr> </tbody> </table> </fieldset> </div> <div class="col-md-12 mb-4"> <fieldset> <legend> {{ $gettext('Most Played Songs') }} </legend> <table class="table table-striped table-condensed table-nopadding"> <colgroup> <col width="10%"> <col width="90%"> </colgroup> <thead> <tr> <th> {{ $gettext('Plays') }} </th> <th> {{ $gettext('Song') }} </th> </tr> </thead> <tbody> <tr v-for="row in state.mostPlayed" :key="row.song.id" > <td class="text-center"> {{ row.num_plays }} </td> <td> <song-text :song="row.song" /> </td> </tr> </tbody> </table> </fieldset> </div> </div> </loading> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import {useAsyncState, useMounted} from "@vueuse/core"; import {toRef, watch} from "vue"; import {useAxios} from "~/vendor/axios"; import SongText from "~/components/Stations/Reports/Overview/SongText.vue"; import Loading from "~/components/Common/Loading.vue"; import {useLuxon} from "~/vendor/luxon"; import {IconChevronDown, IconChevronUp} from "~/components/Common/icons"; const props = defineProps({ dateRange: { type: Object, required: true }, apiUrl: { type: String, required: true }, }); const dateRange = toRef(props, 'dateRange'); const {axios} = useAxios(); const {DateTime} = useLuxon(); const {state, isLoading, execute: relist} = useAsyncState( () => axios.get(props.apiUrl, { params: { start: DateTime.fromJSDate(dateRange.value.startDate).toISO(), end: DateTime.fromJSDate(dateRange.value.endDate).toISO() } }).then(r => r.data), { bestAndWorst: { best: [], worst: [] }, mostPlayed: [] } ); const isMounted = useMounted(); watch(dateRange, () => { if (isMounted.value) { relist(); } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Overview/BestAndWorstTab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,050
```vue <template> <div id="leaflet-container" ref="$container" > <slot v-if="$map" :map="$map" /> </div> </template> <script setup lang="ts"> import {onMounted, provide, ref, shallowRef, watch} from "vue"; import {Control, Icon, map, tileLayer} from 'leaflet'; import useTheme from "~/functions/theme"; import 'leaflet-fullscreen'; import {useTranslate} from "~/vendor/gettext"; const $container = ref<HTMLDivElement | null>(null); const $map = shallowRef(null); provide('map', $map); const {currentTheme} = useTheme(); const {$gettext} = useTranslate(); onMounted(() => { Icon.Default.imagePath = '/static/img/leaflet/'; // Init map const mapObj = map( $container.value ); mapObj.setView([40, 0], 1); mapObj.addControl(new Control.Fullscreen({ title: { 'false': $gettext('View Fullscreen'), 'true': $gettext('Exit Fullscreen') } })); $map.value = mapObj; // Add tile layer const addTileLayer = () => { if (!currentTheme.value) { return; } const tileUrl = `path_to_url{s}.global.ssl.fastly.net/${currentTheme.value}_all/{z}/{x}/{y}.png`; const tileAttribution = 'Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL.'; tileLayer(tileUrl, { id: 'main', attribution: tileAttribution, }).addTo(mapObj); }; addTileLayer(); watch(currentTheme, () => { addTileLayer(); }); }); </script> <style lang="scss"> @import 'leaflet/dist/leaflet.css'; @import 'leaflet-fullscreen/dist/leaflet.fullscreen.css'; .leaflet-container { height: 300px; z-index: 0; } </style> ```
/content/code_sandbox/frontend/components/Stations/Reports/Listeners/InnerMap.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
444
```vue <template> <inner-map v-if="visibleListeners.length < 3000" > <map-point v-for="l in visibleListeners" :key="l.hash" :position="[l.location.lat, l.location.lon]" > {{ $gettext('IP') }} : {{ l.ip }}<br> {{ $gettext('Country') }} : {{ l.location.country }}<br> {{ $gettext('Region') }} : {{ l.location.region }}<br> {{ $gettext('City') }} : {{ l.location.city }}<br> {{ $gettext('Time') }} : {{ l.connected_time }}<br> {{ $gettext('User Agent') }} : {{ l.user_agent }} </map-point> </inner-map> </template> <script setup lang="ts"> import InnerMap from "./InnerMap.vue"; import MapPoint from "./MapPoint.vue"; import {computed} from "vue"; import {filter} from "lodash"; const props = defineProps({ listeners: { type: Array<any>, default: () => { return []; } }, }); const visibleListeners = computed(() => { return filter(props.listeners, function (l) { return null !== l.location.lat && null !== l.location.lon; }); }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Listeners/Map.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
285
```vue <template> <div class="row row-cols-md-auto g-3 align-items-center"> <div class="col-12"> <label for="minLength">{{ $gettext('Min. Connected Time') }}</label> <div class="input-group input-group-sm"> <input id="minLength" v-model="filters.minLength" type="number" class="form-control" min="0" step="1" > </div> </div> <div class="col-12"> <label for="maxLength">{{ $gettext('Max. Connected Time') }}</label> <div class="input-group input-group-sm"> <input id="maxLength" v-model="filters.maxLength" type="number" class="form-control" min="0" step="1" > </div> </div> <div class="col-12"> <label for="type">{{ $gettext('Listener Type') }}</label> <div class="input-group input-group-sm"> <select v-model="filters.type" class="form-select form-select-sm" > <option :value="ListenerTypeFilter.All"> {{ $gettext('All Types') }} </option> <option :value="ListenerTypeFilter.Mobile"> {{ $gettext('Mobile') }} </option> <option :value="ListenerTypeFilter.Desktop"> {{ $gettext('Desktop') }} </option> <option :value="ListenerTypeFilter.Bot"> {{ $gettext('Bot/Crawler') }} </option> </select> </div> </div> <div class="col-12"> <button type="button" class="btn btn-sm btn-secondary" @click="clearFilters" > <icon :icon="IconClearAll" /> <span> {{ $gettext('Clear Filters') }} </span> </button> </div> </div> </template> <script setup lang="ts"> import {ListenerFilters, ListenerTypeFilter} from "./listenerFilters.ts"; import {useVModel} from "@vueuse/core"; import {WritableComputedRef} from "vue"; import {IconClearAll} from "~/components/Common/icons.ts"; import Icon from "~/components/Common/Icon.vue"; const props = defineProps<{ filters: ListenerFilters }>(); const emit = defineEmits(['update:filters']); const filters: WritableComputedRef<ListenerFilters> = useVModel(props, 'filters', emit); const clearFilters = () => { filters.value.minLength = null; filters.value.maxLength = null; filters.value.type = ListenerTypeFilter.All; } </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Listeners/FiltersBar.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
586
```vue <template> <div ref="$content"> <slot /> </div> </template> <script setup lang="ts"> import {inject, onUnmounted, ref, watch} from 'vue'; import {marker} from 'leaflet'; const props = defineProps({ position: { type: Array, required: true } }); const $map = inject('map'); const map = $map.value; const mapMarker = marker(props.position); mapMarker.addTo(map); const popup = new L.Popup(); const $content = ref<HTMLDivElement | null>(null); watch( $content, (newContent) => { popup.setContent(newContent); mapMarker.bindPopup(popup); }, {immediate: true} ); onUnmounted(() => { mapMarker.remove(); }); </script> ```
/content/code_sandbox/frontend/components/Stations/Reports/Listeners/MapPoint.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
174
```vue <template> <profile-header v-bind="pickProps(props, headerPanelProps)" :station="profileInfo.station" /> <div id="profile" class="row row-of-cards" > <div class="col-lg-7"> <template v-if="hasStarted"> <profile-now-playing v-bind="pickProps(props, nowPlayingPanelProps)" @api-call="makeApiCall" /> <profile-schedule :schedule-items="profileInfo.schedule" /> <profile-streams :station="profileInfo.station" /> </template> <template v-else> <now-playing-not-started-panel /> </template> <profile-public-pages v-bind="pickProps(props, {...publicPagesPanelProps,...embedModalProps})" /> </div> <div class="col-lg-5"> <profile-requests v-if="stationSupportsRequests" v-bind="pickProps(props, requestsPanelProps)" /> <profile-streamers v-if="stationSupportsStreamers" v-bind="pickProps(props, streamersPanelProps)" /> <template v-if="hasActiveFrontend"> <profile-frontend v-bind="pickProps(props, frontendPanelProps)" :frontend-running="profileInfo.services.frontend_running" @api-call="makeApiCall" /> </template> <template v-if="hasActiveBackend"> <profile-backend v-bind="pickProps(props, backendPanelProps)" :backend-running="profileInfo.services.backend_running" @api-call="makeApiCall" /> </template> <template v-else> <profile-backend-none /> </template> </div> </div> </template> <script setup lang="ts"> import ProfileStreams from './StreamsPanel.vue'; import ProfileHeader from './HeaderPanel.vue'; import ProfileNowPlaying from './NowPlayingPanel.vue'; import ProfileSchedule from './SchedulePanel.vue'; import ProfileRequests from './RequestsPanel.vue'; import ProfileStreamers from './StreamersPanel.vue'; import ProfilePublicPages from './PublicPagesPanel.vue'; import ProfileFrontend from './FrontendPanel.vue'; import ProfileBackendNone from './BackendNonePanel.vue'; import ProfileBackend from './BackendPanel.vue'; import NowPlayingNotStartedPanel from "./NowPlayingNotStartedPanel.vue"; import {BackendAdapter, FrontendAdapter} from '~/entities/RadioAdapters'; import NowPlaying from '~/entities/NowPlaying'; import {computed} from "vue"; import {useAxios} from "~/vendor/axios"; import backendPanelProps from "./backendPanelProps"; import embedModalProps from "./embedModalProps"; import frontendPanelProps from "./frontendPanelProps"; import headerPanelProps from "./headerPanelProps"; import nowPlayingPanelProps from "./nowPlayingPanelProps"; import publicPagesPanelProps from "./publicPagesPanelProps"; import requestsPanelProps from "./requestsPanelProps"; import streamersPanelProps from "./streamersPanelProps"; import {pickProps} from "~/functions/pickProps"; import {useSweetAlert} from "~/vendor/sweetalert"; import {useNotify} from "~/functions/useNotify"; import {useTranslate} from "~/vendor/gettext"; import useAutoRefreshingAsyncState from "~/functions/useAutoRefreshingAsyncState.ts"; const props = defineProps({ ...backendPanelProps, ...embedModalProps, ...frontendPanelProps, ...headerPanelProps, ...nowPlayingPanelProps, ...publicPagesPanelProps, ...requestsPanelProps, ...streamersPanelProps, profileApiUri: { type: String, required: true }, stationSupportsRequests: { type: Boolean, required: true }, stationSupportsStreamers: { type: Boolean, required: true } }); const hasActiveFrontend = computed(() => { return props.frontendType !== FrontendAdapter.Remote; }); const hasActiveBackend = computed(() => { return props.backendType !== BackendAdapter.None; }); const {axios, axiosSilent} = useAxios(); const {state: profileInfo} = useAutoRefreshingAsyncState( () => axiosSilent.get(props.profileApiUri).then((r) => r.data), { station: { ...NowPlaying.station }, services: { backend_running: false, frontend_running: false, has_started: false, needs_restart: false }, schedule: [] }, { timeout: 15000 } ); const {showAlert} = useSweetAlert(); const {notify} = useNotify(); const {$gettext} = useTranslate(); const makeApiCall = (uri) => { showAlert({ title: $gettext('Are you sure?') }).then((result) => { if (!result.value) { return; } axios.post(uri).then((resp) => { notify(resp.data.formatted_message, { variant: (resp.data.success) ? 'success' : 'warning' }); }); }); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/EnabledProfile.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,092
```vue <template> <card-page id="profile-frontend" class="mb-4" header-id="hdr_frontend" > <template #header="{id}"> <h3 :id="id" class="card-title" > {{ $gettext('Broadcasting Service') }} <running-badge :running="frontendRunning" /> <br> <small>{{ frontendName }}</small> </h3> </template> <template v-if="userAllowedForStation(StationPermission.Broadcasting)"> <div class="collapse" :class="(credentialsVisible) ? 'show' : ''" > <table class="table table-striped table-responsive"> <tbody> <tr class="align-middle"> <td> <a :href="frontendAdminUri" target="_blank" > {{ $gettext('Administration') }} </a> </td> <td class="px-0"> <div> {{ $gettext('Username:') }} <span class="text-monospace">admin</span> </div> <div> {{ $gettext('Password:') }} <span class="text-monospace">{{ frontendAdminPassword }}</span> </div> </td> <td class="px-0"> <copy-to-clipboard-button :text="frontendAdminPassword" hide-text /> </td> </tr> <tr class="align-middle"> <td> {{ $gettext('Port') }} </td> <td class="ps-0" colspan="2" > {{ frontendPort }} <div v-if="isShoutcast" class="form-text" > {{ $gettext('Some clients may require that you enter a port number that is either one above or one below this number.') }} </div> </td> </tr> <tr class="align-middle"> <td> {{ $gettext('Source') }} </td> <td class="px-0"> <div> {{ $gettext('Username:') }} <span class="text-monospace">source</span> </div> <div> {{ $gettext('Password:') }} <span class="text-monospace">{{ frontendSourcePassword }}</span> </div> </td> <td class="px-0"> <copy-to-clipboard-button :text="frontendSourcePassword" hide-text /> </td> </tr> <tr class="align-middle"> <td> {{ $gettext('Relay') }} </td> <td class="px-0"> <div> {{ $gettext('Username:') }} <span class="text-monospace">relay</span> </div> <div> {{ $gettext('Password:') }} <span class="text-monospace">{{ frontendRelayPassword }}</span> </div> </td> <td class="px-0"> <copy-to-clipboard-button :text="frontendRelayPassword" hide-text /> </td> </tr> </tbody> </table> </div> </template> <template v-if="userAllowedForStation(StationPermission.Broadcasting)" #footer_actions > <a class="btn btn-link text-primary" @click.prevent="credentialsVisible = !credentialsVisible" > <icon :icon="IconMoreHoriz" /> <span> {{ langShowHideCredentials }} </span> </a> <template v-if="hasStarted"> <button type="button" class="btn btn-link text-secondary" @click="makeApiCall(frontendRestartUri)" > <icon :icon="IconUpdate" /> <span> {{ $gettext('Restart') }} </span> </button> <button v-if="!frontendRunning" type="button" class="btn btn-link text-success" @click="makeApiCall(frontendStartUri)" > <icon :icon="IconPlay" /> <span> {{ $gettext('Start') }} </span> </button> <button v-if="frontendRunning" type="button" class="btn btn-link text-danger" @click="makeApiCall(frontendStopUri)" > <icon :icon="IconStop" /> <span> {{ $gettext('Stop') }} </span> </button> </template> </template> </card-page> </template> <script setup lang="ts"> import {FrontendAdapter} from '~/entities/RadioAdapters'; import CopyToClipboardButton from '~/components/Common/CopyToClipboardButton.vue'; import Icon from '~/components/Common/Icon.vue'; import RunningBadge from "~/components/Common/Badges/RunningBadge.vue"; import {computed} from "vue"; import frontendPanelProps from "~/components/Stations/Profile/frontendPanelProps"; import {useTranslate} from "~/vendor/gettext"; import CardPage from "~/components/Common/CardPage.vue"; import {StationPermission, userAllowedForStation} from "~/acl"; import useOptionalStorage from "~/functions/useOptionalStorage"; import {IconMoreHoriz, IconPlay, IconStop, IconUpdate} from "~/components/Common/icons"; const props = defineProps({ ...frontendPanelProps, frontendRunning: { type: Boolean, required: true } }); const emit = defineEmits(['api-call']); const credentialsVisible = useOptionalStorage<boolean>('station_show_frontend_credentials', false); const {$gettext} = useTranslate(); const langShowHideCredentials = computed(() => { return (credentialsVisible.value) ? $gettext('Hide Credentials') : $gettext('Show Credentials') }); const frontendName = computed(() => { if (props.frontendType === FrontendAdapter.Icecast) { return 'Icecast'; } else if (props.frontendType === FrontendAdapter.Shoutcast) { return 'Shoutcast'; } return ''; }); const isShoutcast = computed(() => { return props.frontendType === FrontendAdapter.Shoutcast; }); const makeApiCall = (uri) => { emit('api-call', uri); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/FrontendPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,385
```vue <template> <card-page id="profile-backend" header-id="hdr_backend" > <template #header="{id}"> <h3 :id="id" class="card-title" > {{ $gettext('AutoDJ Service') }} <running-badge :running="backendRunning" /> <br> <small>{{ backendName }}</small> </h3> </template> <div class="card-body"> <p class="card-text"> {{ langTotalTracks }} </p> <div v-if="userAllowedForStation(StationPermission.Media)" class="buttons" > <router-link class="btn btn-primary" :to="{name: 'stations:files:index'}" > {{ $gettext('Music Files') }} </router-link> <router-link class="btn btn-primary" :to="{name: 'stations:playlists:index'}" > {{ $gettext('Playlists') }} </router-link> </div> </div> <template v-if="userAllowedForStation(StationPermission.Broadcasting) && hasStarted" #footer_actions > <button type="button" class="btn btn-link text-secondary" @click="makeApiCall(backendRestartUri)" > <icon :icon="IconUpdate" /> <span> {{ $gettext('Restart') }} </span> </button> <button v-if="!backendRunning" type="button" class="btn btn-link text-success" @click="makeApiCall(backendStartUri)" > <icon :icon="IconPlay" /> <span> {{ $gettext('Start') }} </span> </button> <button v-if="backendRunning" type="button" class="btn btn-link text-danger" @click="makeApiCall(backendStopUri)" > <icon :icon="IconStop" /> <span> {{ $gettext('Stop') }} </span> </button> </template> </card-page> </template> <script setup lang="ts"> import {BackendAdapter} from '~/entities/RadioAdapters'; import Icon from '~/components/Common/Icon.vue'; import RunningBadge from "~/components/Common/Badges/RunningBadge.vue"; import {useTranslate} from "~/vendor/gettext"; import {computed} from "vue"; import backendPanelProps from "~/components/Stations/Profile/backendPanelProps"; import CardPage from "~/components/Common/CardPage.vue"; import {StationPermission, userAllowedForStation} from "~/acl"; import {IconPlay, IconStop, IconUpdate} from "~/components/Common/icons"; const props = defineProps({ ...backendPanelProps, backendRunning: { type: Boolean, required: true } }); const emit = defineEmits(['api-call']); const {$gettext, $ngettext} = useTranslate(); const langTotalTracks = computed(() => { const numSongs = $ngettext( '%{numSongs} uploaded song', '%{numSongs} uploaded songs', props.numSongs, {numSongs: props.numSongs} ); const numPlaylists = $ngettext( '%{numPlaylists} playlist', '%{numPlaylists} playlists', props.numPlaylists, {numPlaylists: props.numPlaylists} ); return $gettext( 'LiquidSoap is currently shuffling from %{songs} and %{playlists}.', { songs: numSongs, playlists: numPlaylists } ); }); const backendName = computed(() => { if (props.backendType === BackendAdapter.Liquidsoap) { return 'Liquidsoap'; } return ''; }); const makeApiCall = (uri) => { emit('api-call', uri); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/BackendPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
847
```vue <template> <card-page header-id="hdr_streamers"> <template #header="{id}"> <h3 :id="id" class="card-title" > {{ $gettext('Streamers/DJs') }} <enabled-badge :enabled="enableStreamers" /> </h3> </template> <template v-if="userAllowedForStation(StationPermission.Streamers) || userAllowedForStation(StationPermission.Profile)" #footer_actions > <template v-if="enableStreamers"> <router-link v-if="userAllowedForStation(StationPermission.Streamers)" class="btn btn-link text-primary" :to="{name: 'stations:streamers:index'}" > <icon :icon="IconSettings" /> <span> {{ $gettext('Manage') }} </span> </router-link> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-danger" @click="toggleStreamers" > <icon :icon="IconClose" /> <span> {{ $gettext('Disable') }} </span> </button> </template> <template v-else> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-success" @click="toggleStreamers" > <icon :icon="IconCheck" /> <span> {{ $gettext('Enable') }} </span> </button> </template> </template> </card-page> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import EnabledBadge from "~/components/Common/Badges/EnabledBadge.vue"; import streamersPanelProps from "~/components/Stations/Profile/streamersPanelProps"; import CardPage from "~/components/Common/CardPage.vue"; import {StationPermission, userAllowedForStation} from "~/acl"; import useToggleFeature from "~/components/Stations/Profile/useToggleFeature"; import {IconCheck, IconClose, IconSettings} from "~/components/Common/icons"; const props = defineProps({ ...streamersPanelProps }); const toggleStreamers = useToggleFeature('enable_streamers', !props.enableStreamers); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/StreamersPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
504
```vue <template> <card-page id="profile-nowplaying" class="nowplaying" header-id="hdr_now_playing" > <template #header="{id}"> <div class="d-flex align-items-center"> <h3 :id="id" class="flex-shrink card-title my-0" > {{ $gettext('On the Air') }} </h3> <h6 class="card-subtitle text-end flex-fill my-0" style="line-height: 1;" > <icon class="align-middle" :icon="IconHeadphones" /> <span class="ps-1"> {{ langListeners }} </span> <br> <small> <span class="pe-1">{{ np.listeners.unique }}</span> {{ $gettext('Unique') }} </small> </h6> <router-link v-if="userAllowedForStation(StationPermission.Reports)" class="flex-shrink btn btn-link text-white ms-2 px-1 py-2" :to="{name: 'stations:reports:listeners'}" :title="$gettext('Listener Report')" > <icon :icon="IconLogs" /> </router-link> </div> </template> <div class="card-body"> <loading :loading="np.loading"> <div class="row"> <div class="col-md-6"> <div class="clearfix"> <div class="d-table"> <div class="d-table-row"> <div class="d-table-cell align-middle text-end pe-2 pb-2"> <icon :icon="IconMusicNote" /> </div> <div class="d-table-cell align-middle w-100 pb-2"> <h5 class="m-0"> {{ $gettext('Now Playing') }} </h5> </div> </div> <div class="d-table-row"> <div class="d-table-cell align-top text-end pe-2"> <a v-if="np.now_playing.song.art" v-lightbox :href="np.now_playing.song.art" target="_blank" > <img class="rounded" :src="np.now_playing.song.art" alt="Album Art" style="width: 50px;" > </a> </div> <div class="d-table-cell align-middle w-100"> <div v-if="!np.is_online"> <h5 class="media-heading m-0 text-muted"> {{ offlineText ?? $gettext('Station Offline') }} </h5> </div> <div v-else-if="np.now_playing.song.title !== ''"> <h6 class="media-heading m-0" style="line-height: 1.2;" > {{ np.now_playing.song.title }}<br> <small class="text-muted">{{ np.now_playing.song.artist }}</small> </h6> </div> <div v-else> <h6 class="media-heading m-0" style="line-height: 1.2;" > {{ np.now_playing.song.text }} </h6> </div> <div v-if="np.now_playing.playlist"> <small class="text-muted"> {{ $gettext('Playlist') }} : {{ np.now_playing.playlist }}</small> </div> <div v-if="currentTrackElapsedDisplay" class="nowplaying-progress" > <small> {{ currentTrackElapsedDisplay }} / {{ currentTrackDurationDisplay }} </small> </div> </div> </div> </div> </div> </div> <div class="col-md-6"> <div v-if="!np.live.is_live && np.playing_next" class="clearfix" > <div class="d-table"> <div class="d-table-row"> <div class="d-table-cell align-middle pe-2 text-end pb-2"> <icon :icon="IconSkipNext" /> </div> <div class="d-table-cell align-middle w-100 pb-2"> <h5 class="m-0"> {{ $gettext('Playing Next') }} </h5> </div> </div> <div class="d-table-row"> <div class="d-table-cell align-top text-end pe-2"> <a v-if="np.playing_next.song.art" v-lightbox :href="np.playing_next.song.art" target="_blank" > <img :src="np.playing_next.song.art" class="rounded" alt="Album Art" style="width: 40px;" > </a> </div> <div class="d-table-cell align-middle w-100"> <div v-if="np.playing_next.song.title !== ''"> <h6 class="media-heading m-0" style="line-height: 1;" > {{ np.playing_next.song.title }}<br> <small class="text-muted">{{ np.playing_next.song.artist }}</small> </h6> </div> <div v-else> <h6 class="media-heading m-0" style="line-height: 1;" > {{ np.playing_next.song.text }} </h6> </div> <div v-if="np.playing_next.playlist"> <small class="text-muted"> {{ $gettext('Playlist') }} : {{ np.playing_next.playlist }}</small> </div> </div> </div> </div> </div> <div v-else-if="np.live.is_live" class="clearfix" > <h6 style="margin-left: 22px;"> <icon :icon="IconMic" /> {{ $gettext('Live') }} </h6> <h4 class="media-heading" style="margin-left: 22px;" > {{ np.live.streamer_name }} </h4> </div> </div> </div> </loading> </div> <template v-if="isLiquidsoap && userAllowedForStation(StationPermission.Broadcasting)" #footer_actions > <button v-if="!np.live.is_live" id="btn_skip_song" type="button" class="btn btn-link text-primary" @click="makeApiCall(backendSkipSongUri)" > <icon :icon="IconSkipNext" /> <span> {{ $gettext('Skip Song') }} </span> </button> <button v-if="np.live.is_live" id="btn_disconnect_streamer" type="button" class="btn btn-link text-primary" @click="makeApiCall(backendDisconnectStreamerUri)" > <icon :icon="IconVolumeOff" /> <span> {{ $gettext('Disconnect Streamer') }} </span> </button> <button id="btn_update_metadata" type="button" class="btn btn-link text-secondary" @click="updateMetadata()" > <icon :icon="IconUpdate" /> <span> {{ $gettext('Update Metadata') }} </span> </button> </template> </card-page> <template v-if="isLiquidsoap && userAllowedForStation(StationPermission.Broadcasting)"> <update-metadata-modal ref="$updateMetadataModal" /> </template> </template> <script setup lang="ts"> import {BackendAdapter} from '~/entities/RadioAdapters'; import Icon from '~/components/Common/Icon.vue'; import {computed, Ref, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import nowPlayingPanelProps from "~/components/Stations/Profile/nowPlayingPanelProps"; import useNowPlaying from "~/functions/useNowPlaying"; import Loading from "~/components/Common/Loading.vue"; import CardPage from "~/components/Common/CardPage.vue"; import {useLightbox} from "~/vendor/lightbox"; import {StationPermission, userAllowedForStation} from "~/acl"; import {useAzuraCastStation} from "~/vendor/azuracast"; import { IconHeadphones, IconLogs, IconMic, IconMusicNote, IconSkipNext, IconUpdate, IconVolumeOff } from "~/components/Common/icons"; import UpdateMetadataModal from "~/components/Stations/Profile/UpdateMetadataModal.vue"; const props = defineProps({ ...nowPlayingPanelProps, }); const emit = defineEmits(['api-call']); const {offlineText} = useAzuraCastStation(); const { np, currentTrackDurationDisplay, currentTrackElapsedDisplay } = useNowPlaying(props); const {$ngettext} = useTranslate(); const langListeners = computed(() => { return $ngettext( '%{listeners} Listener', '%{listeners} Listeners', np.value?.listeners?.total ?? 0, {listeners: np.value?.listeners?.total ?? 0} ); }); const isLiquidsoap = computed(() => { return props.backendType === BackendAdapter.Liquidsoap; }); const {vLightbox} = useLightbox(); const makeApiCall = (uri) => { emit('api-call', uri); }; const $updateMetadataModal: Ref<InstanceType<typeof UpdateMetadataModal> | null> = ref(null); const updateMetadata = () => { $updateMetadataModal.value?.open(); } </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/NowPlayingPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
2,121
```vue <template> <card-page header-id="hdr_streams" :title="$gettext('Streams')" > <table class="table table-striped table-responsive mb-0"> <colgroup> <col style="width: 2%;"> <col style="width: 78%;"> <col style="width: 20%;"> </colgroup> <template v-if="station.mounts.length > 0"> <thead> <tr> <th colspan="2"> {{ $gettext('Local Streams') }} </th> <th class="text-end"> {{ $gettext('Listeners') }} </th> </tr> </thead> <tbody> <tr v-for="mount in station.mounts" :key="mount.id" class="align-middle" > <td class="pe-1"> <play-button class="btn-lg" :url="mount.url" is-stream /> </td> <td class="ps-1"> <h6 class="mb-1"> {{ mount.name }} </h6> <a :href="mount.url" target="_blank" >{{ mount.url }}</a> </td> <td class="ps-1 text-end"> <icon class="sm align-middle" :icon="IconHeadphones" /> <span class="listeners-total ps-1">{{ mount.listeners.total }}</span><br> <small> <span class="listeners-unique pe-1">{{ mount.listeners.unique }}</span> {{ $gettext('Unique') }} </small> </td> </tr> </tbody> </template> <template v-if="station.remotes.length > 0"> <thead> <tr> <th colspan="2"> {{ $gettext('Remote Relays') }} </th> <th class="text-end"> {{ $gettext('Listeners') }} </th> </tr> </thead> <tbody> <tr v-for="remote in station.remotes" :key="remote.id" class="align-middle" > <td class="pe-1"> <play-button class="btn-lg" :url="remote.url" is-stream /> </td> <td class="ps-1"> <h6 class="mb-1"> {{ remote.name }} </h6> <a :href="remote.url" target="_blank" >{{ remote.url }}</a> </td> <td class="ps-1 text-end"> <icon class="sm align-middle" :icon="IconHeadphones" /> <span class="listeners-total ps-1">{{ remote.listeners.total }}</span><br> <small> <span class="listeners-unique pe-1">{{ remote.listeners.unique }}</span> {{ $gettext('Unique') }} </small> </td> </tr> </tbody> </template> <template v-if="station.hls_enabled"> <thead> <tr> <th colspan="2"> {{ $gettext('HTTP Live Streaming (HLS)') }} </th> <th class="text-end"> {{ $gettext('Listeners') }} </th> </tr> </thead> <tbody> <tr class="align-middle"> <td class="pe-1"> <play-button class="btn-lg" :url="station.hls_url" is-stream is-hls /> </td> <td class="ps-1"> <a :href="station.hls_url" target="_blank" >{{ station.hls_url }}</a> </td> <td class="ps-1 text-end"> <icon class="sm align-middle" :icon="IconHeadphones" /> <span class="listeners-total ps-1"> {{ station.hls_listeners }} {{ $gettext('Unique') }} </span> </td> </tr> </tbody> </template> </table> <template #footer_actions> <a class="btn btn-link text-primary" :href="station.playlist_pls_url" > <icon :icon="IconDownload" /> <span> {{ $gettext('Download PLS') }} </span> </a> <a class="btn btn-link text-primary" :href="station.playlist_m3u_url" > <icon :icon="IconDownload" /> <span> {{ $gettext('Download M3U') }} </span> </a> </template> </card-page> </template> <script setup lang="ts"> import Icon from '~/components/Common/Icon.vue'; import PlayButton from "~/components/Common/PlayButton.vue"; import CardPage from "~/components/Common/CardPage.vue"; import {IconDownload, IconHeadphones} from "~/components/Common/icons"; const props = defineProps({ station: { type: Object, required: true } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/StreamsPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,144
```vue <template> <card-page id="profile-backend" header-id="hdr_backend_disabled" :title="$gettext('AutoDJ Disabled')" > <div class="card-body"> <p class="card-text"> {{ $gettext('AutoDJ has been disabled for this station. No music will automatically be played when a source is not live.') }} </p> </div> </card-page> </template> <script setup lang="ts"> import CardPage from "~/components/Common/CardPage.vue"; </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/BackendNonePanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
117
```vue <template> <card-page v-if="processedScheduleItems.length > 0" class="scheduled" header-id="hdr_scheduled" :title="$gettext('Scheduled')" > <table class="table table-striped mb-0"> <tbody> <tr v-for="row in processedScheduleItems" :key="row.id" > <td> <div class="d-flex w-100 justify-content-between align-items-center"> <h5 class="m-0"> <small> <template v-if="row.type === 'playlist'"> {{ $gettext('Playlist') }} </template> <template v-else> {{ $gettext('Streamer/DJ') }} </template> </small><br> {{ row.name }} </h5> <p class="text-end m-0"> <small>{{ row.start_formatted }} - {{ row.end_formatted }}</small> <br> <strong> <template v-if="row.is_now"> {{ $gettext('Now') }} </template> <template v-else>{{ row.time_until }}</template> </strong> </p> </div> </td> </tr> </tbody> </table> </card-page> </template> <script setup lang="ts"> import {map} from "lodash"; import {computed} from "vue"; import CardPage from "~/components/Common/CardPage.vue"; import useStationDateTimeFormatter from "~/functions/useStationDateTimeFormatter.ts"; import {useLuxon} from "~/vendor/luxon.ts"; const props = defineProps({ scheduleItems: { type: Array<any>, required: true } }); const {DateTime} = useLuxon(); const { now, timestampToDateTime, formatDateTime } = useStationDateTimeFormatter(); const processedScheduleItems = computed(() => { const nowTz = now(); return map(props.scheduleItems, (row) => { const startMoment = timestampToDateTime(row.start_timestamp); const endMoment = timestampToDateTime(row.end_timestamp); row.time_until = startMoment.toRelative(); row.start_formatted = formatDateTime( startMoment, startMoment.hasSame(nowTz, 'day') ? DateTime.TIME_SIMPLE : DateTime.DATETIME_MED ); row.end_formatted = formatDateTime( endMoment, endMoment.hasSame(startMoment, 'day') ? DateTime.TIME_SIMPLE : DateTime.DATETIME_MED ); return row; }); }); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/SchedulePanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
554
```vue <template> <card-page header-id="hdr_public_pages"> <template #header="{id}"> <h3 :id="id" class="card-title" > {{ $gettext('Public Pages') }} <enabled-badge :enabled="enablePublicPage" /> </h3> </template> <template v-if="enablePublicPage"> <table class="table table-striped table-responsive-md mb-0"> <colgroup> <col style="width: 30%;"> <col style="width: 70%;"> </colgroup> <tbody> <tr> <td>{{ $gettext('Public Page') }}</td> <td> <a :href="publicPageUri" target="_blank" >{{ publicPageUri }}</a> </td> </tr> <tr v-if="stationSupportsStreamers && enableStreamers"> <td>{{ $gettext('Web DJ') }}</td> <td> <a :href="publicWebDjUri" target="_blank" >{{ publicWebDjUri }}</a> </td> </tr> <tr v-if="enableOnDemand"> <td>{{ $gettext('On-Demand Media') }}</td> <td> <a :href="publicOnDemandUri" target="_blank" >{{ publicOnDemandUri }}</a> </td> </tr> <tr> <td>{{ $gettext('Podcasts') }}</td> <td> <a :href="publicPodcastsUri" target="_blank" >{{ publicPodcastsUri }}</a> </td> </tr> <tr> <td>{{ $gettext('Schedule') }}</td> <td> <a :href="publicScheduleUri" target="_blank" >{{ publicScheduleUri }}</a> </td> </tr> </tbody> </table> </template> <template #footer_actions> <template v-if="enablePublicPage"> <a class="btn btn-link text-secondary" @click.prevent="doOpenEmbed" > <icon :icon="IconCode" /> <span> {{ $gettext('Embed Widgets') }} </span> </a> <router-link v-if="userAllowedForStation(StationPermission.Profile)" class="btn btn-link text-secondary" :to="{name: 'stations:branding'}" > <icon :icon="IconBranding" /> <span> {{ $gettext('Edit Branding') }} </span> </router-link> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-danger" @click="togglePublicPages" > <icon :icon="IconClose" /> <span> {{ $gettext('Disable') }} </span> </button> </template> <template v-else> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-success" @click="togglePublicPages" > <icon :icon="IconCheck" /> <span> {{ $gettext('Enable') }} </span> </button> </template> </template> </card-page> <embed-modal v-bind="pickProps($props, embedModalProps)" ref="$embedModal" /> </template> <script setup lang="ts"> import Icon from '~/components/Common/Icon.vue'; import EnabledBadge from "~/components/Common/Badges/EnabledBadge.vue"; import {ref} from "vue"; import EmbedModal from "~/components/Stations/Profile/EmbedModal.vue"; import publicPagesPanelProps from "~/components/Stations/Profile/publicPagesPanelProps"; import embedModalProps from "~/components/Stations/Profile/embedModalProps"; import {pickProps} from "~/functions/pickProps"; import CardPage from "~/components/Common/CardPage.vue"; import {StationPermission, userAllowedForStation} from "~/acl"; import useToggleFeature from "~/components/Stations/Profile/useToggleFeature"; import {IconBranding, IconCheck, IconClose, IconCode} from "~/components/Common/icons"; const props = defineProps({ ...publicPagesPanelProps, ...embedModalProps }); const $embedModal = ref<InstanceType<typeof EmbedModal> | null>(null); const doOpenEmbed = () => { $embedModal.value?.open(); }; const togglePublicPages = useToggleFeature('enable_public_page', !props.enablePublicPage); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/PublicPagesPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,024
```vue <template> <div class="outside-card-header d-flex align-items-center"> <div v-if="station.listen_url && hasStarted" class="flex-shrink-0 me-2" > <play-button class="btn-xl" :url="station.listen_url" is-stream /> </div> <div class="flex-fill"> <h2 class="display-6 m-0"> {{ stationName }}<br> <small v-if="stationDescription" class="text-muted" > {{ stationDescription }} </small> </h2> </div> <div v-if="userAllowedForStation(StationPermission.Profile)" class="flex-shrink-0 ms-3" > <router-link class="btn btn-primary" role="button" :to="{name: 'stations:profile:edit'}" > <icon :icon="IconEdit" /> <span> {{ $gettext('Edit Profile') }} </span> </router-link> </div> </div> </template> <script setup lang="ts"> import Icon from '~/components/Common/Icon.vue'; import PlayButton from "~/components/Common/PlayButton.vue"; import headerPanelProps from "~/components/Stations/Profile/headerPanelProps"; import {StationPermission, userAllowedForStation} from "~/acl"; import {IconEdit} from "~/components/Common/icons"; const props = defineProps({ ...headerPanelProps, station: { type: Object, required: true } }); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/HeaderPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
349
```vue <template> <modal id="update_metadata" ref="$modal" centered :title="$gettext('Update Metadata')" @hidden="onHidden" @shown="onShown" > <info-card> {{ $gettext('Use this form to send a manual metadata update. Note that this will override any existing metadata on the stream.') }} </info-card> <form @submit.prevent="doUpdateMetadata"> <div class="row g-3"> <form-group-field id="update_metadata_title" ref="$field" class="col-12" :field="v$.title" :label="$gettext('Title')" /> <form-group-field id="update_metadata_artist" class="col-12" :field="v$.artist" :label="$gettext('Artist')" /> </div> <invisible-submit-button /> </form> <template #modal-footer> <button type="button" class="btn btn-secondary" @click="hide" > {{ $gettext('Close') }} </button> <button type="button" class="btn" :class="(v$.$invalid) ? 'btn-danger' : 'btn-primary'" @click="doUpdateMetadata" > {{ $gettext('Update Metadata') }} </button> </template> </modal> </template> <script setup lang="ts"> import {required} from '@vuelidate/validators'; import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVuelidateOnForm} from "~/functions/useVuelidateOnForm"; import {nextTick, ref} from "vue"; import {useNotify} from "~/functions/useNotify"; import {useAxios} from "~/vendor/axios"; import {useTranslate} from "~/vendor/gettext"; import Modal from "~/components/Common/Modal.vue"; import InvisibleSubmitButton from "~/components/Common/InvisibleSubmitButton.vue"; import {ModalTemplateRef, useHasModal} from "~/functions/useHasModal.ts"; import {getStationApiUrl} from "~/router.ts"; import InfoCard from "~/components/Common/InfoCard.vue"; const updateMetadataUrl = getStationApiUrl('/nowplaying/update'); const {form, v$, resetForm, ifValid} = useVuelidateOnForm( { title: {required}, artist: {} }, { title: null, artist: null } ); const $modal = ref<ModalTemplateRef>(null); const {hide, show: open} = useHasModal($modal); const onHidden = () => { resetForm(); } const $field = ref<InstanceType<typeof FormGroupField> | null>(null); const onShown = () => { nextTick(() => { $field.value?.focus(); }) }; const {notifySuccess} = useNotify(); const {axios} = useAxios(); const {$gettext} = useTranslate(); const doUpdateMetadata = () => { ifValid(() => { axios.post(updateMetadataUrl.value, form.value).then(() => { notifySuccess($gettext('Metadata updated.')); }).finally(() => { hide(); }); }); }; defineExpose({ open }); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/UpdateMetadataModal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
708
```vue <template> <div class="outside-card-header d-flex align-items-center"> <div class="flex-fill"> <h2 class="display-6 m-0"> {{ name }} </h2> </div> <div v-if="userAllowedForStation(StationPermission.Profile)" class="flex-shrink-0 ms-3" > <router-link class="btn btn-primary" role="button" :to="{name: 'stations:profile:edit'}" > <icon :icon="IconEdit" /> <span> {{ $gettext('Edit Profile') }} </span> </router-link> </div> </div> <card-page id="station-disabled" :title="$gettext('Station Disabled')" > <div class="card-body"> <p class="card-text"> {{ $gettext('Your station is currently not enabled for broadcasting. You can still manage media, playlists, and other station settings. To re-enable broadcasting, edit your station profile.') }} </p> </div> </card-page> </template> <script setup lang="ts"> import {StationPermission, userAllowedForStation} from "~/acl.ts"; import {IconEdit} from "~/components/Common/icons.ts"; import Icon from "~/components/Common/Icon.vue"; import CardPage from "~/components/Common/CardPage.vue"; import {useAzuraCastStation} from "~/vendor/azuracast.ts"; const {name} = useAzuraCastStation(); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/StationDisabledPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
334
```vue <template> <card-page id="profile-now-playing" header-id="hdr_now_playing" :title="$gettext('On the Air')" > <div class="card-body"> <p class="card-text"> {{ $gettext('Information about the current playing track will appear here once your station has started.') }} </p> </div> </card-page> </template> <script setup lang="ts"> import CardPage from "~/components/Common/CardPage.vue"; </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/NowPlayingNotStartedPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
111
```vue <template> <modal id="embed_modal" ref="$modal" size="lg" :title="$gettext('Embed Widgets')" hide-footer no-enforce-focus > <div class="row"> <div class="col-md-7"> <section class="card mb-3" role="region" > <div class="card-header text-bg-primary"> <h2 class="card-title"> {{ $gettext('Customize') }} </h2> </div> <div class="card-body"> <div class="row"> <div class="col-md-6"> <form-group-multi-check id="embed_type" v-model="selectedType" :label="$gettext('Widget Type')" :options="types" stacked radio /> </div> <div class="col-md-6"> <form-group-multi-check id="embed_theme" v-model="selectedTheme" :label="$gettext('Theme')" name="embed_theme" :options="themes" stacked radio /> </div> </div> </div> </section> </div> <div class="col-md-5"> <section class="card mb-3" role="region" > <div class="card-header text-bg-primary"> <h2 class="card-title"> {{ $gettext('Embed Code') }} </h2> </div> <div class="card-body"> <textarea class="full-width form-control text-preformatted" spellcheck="false" style="height: 100px;" readonly :value="embedCode" /> <copy-to-clipboard-button :text="embedCode" /> </div> </section> </div> </div> <section class="card mb-3" role="region" :data-bs-theme="selectedTheme" > <div class="card-header text-bg-primary"> <h2 class="card-title"> {{ $gettext('Preview') }} </h2> </div> <div class="card-body"> <iframe width="100%" :src="embedUrl" frameborder="0" style="width: 100%; border: 0;" :style="{ 'min-height': embedHeight }" /> </div> </section> </modal> </template> <script setup lang="ts"> import CopyToClipboardButton from '~/components/Common/CopyToClipboardButton.vue'; import {computed, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import embedModalProps from "./embedModalProps"; import Modal from "~/components/Common/Modal.vue"; import FormGroupMultiCheck from "~/components/Form/FormGroupMultiCheck.vue"; import {ModalTemplateRef, useHasModal} from "~/functions/useHasModal.ts"; const props = defineProps({ ...embedModalProps }); const selectedType = ref('player'); const selectedTheme = ref('light'); const {$gettext} = useTranslate(); const types = computed(() => { const types = [ { value: 'player', text: $gettext('Radio Player') }, { value: 'history', text: $gettext('History') }, { value: 'podcasts', text: $gettext('Podcasts') }, { value: 'schedule', text: $gettext('Schedule') } ]; if (props.stationSupportsRequests && props.enableRequests) { types.push({ value: 'requests', text: $gettext('Requests') }); } if (props.enableOnDemand) { types.push({ value: 'ondemand', text: $gettext('On-Demand Media') }); } return types; }); const themes = computed(() => { return [ { value: 'browser', text: $gettext('Browser Default') }, { value: 'light', text: $gettext('Light') }, { value: 'dark', text: $gettext('Dark') } ]; }); const baseEmbedUrl = computed(() => { switch (selectedType.value) { case 'history': return props.publicHistoryEmbedUri; case 'ondemand': return props.publicOnDemandEmbedUri; case 'requests': return props.publicRequestEmbedUri; case 'schedule': return props.publicScheduleEmbedUri; case 'podcasts': return props.publicPodcastsEmbedUri; case 'player': default: return props.publicPageEmbedUri; } }); const embedUrl = computed(() => { const baseUrl = new URL(baseEmbedUrl.value); if (selectedTheme.value !== 'browser') { baseUrl.searchParams.set('theme', selectedTheme.value); } return baseUrl.toString(); }); const embedHeight = computed(() => { switch (selectedType.value) { case 'ondemand': case 'podcasts': return '400px'; case 'requests': return '850px'; case 'history': return '300px'; case 'schedule': return '800px' case 'player': default: return '150px'; } }); const embedCode = computed(() => { return '<iframe src="' + embedUrl.value + '" frameborder="0" allowtransparency="true" style="width: 100%; min-height: ' + embedHeight.value + '; border: 0;"></iframe>'; }); const $modal = ref<ModalTemplateRef>(null); const {show: open} = useHasModal($modal); defineExpose({ open }); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/EmbedModal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,246
```vue <template> <card-page header-id="hdr_song_requests"> <template #header="{id}"> <h3 :id="id" class="card-title" > {{ $gettext('Song Requests') }} <enabled-badge :enabled="enableRequests" /> </h3> </template> <template v-if="userAllowedForStation(StationPermission.Broadcasting) || userAllowedForStation(StationPermission.Profile)" #footer_actions > <template v-if="enableRequests"> <router-link v-if="userAllowedForStation(StationPermission.Broadcasting)" class="btn btn-link text-primary" :to="{name: 'stations:reports:requests'}" > <icon :icon="IconLogs" /> <span> {{ $gettext('View') }} </span> </router-link> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-danger" @click="toggleRequests" > <icon :icon="IconClose" /> <span> {{ $gettext('Disable') }} </span> </button> </template> <template v-else> <button v-if="userAllowedForStation(StationPermission.Profile)" type="button" class="btn btn-link text-success" @click="toggleRequests" > <icon :icon="IconCheck" /> <span> {{ $gettext('Enable') }} </span> </button> </template> </template> </card-page> </template> <script setup lang="ts"> import Icon from '~/components/Common/Icon.vue'; import requestsPanelProps from "~/components/Stations/Profile/requestsPanelProps"; import EnabledBadge from "~/components/Common/Badges/EnabledBadge.vue"; import CardPage from "~/components/Common/CardPage.vue"; import {StationPermission, userAllowedForStation} from "~/acl"; import useToggleFeature from "~/components/Stations/Profile/useToggleFeature"; import {IconCheck, IconClose, IconLogs} from "~/components/Common/icons"; const props = defineProps({ ...requestsPanelProps }); const toggleRequests = useToggleFeature('enable_requests', !props.enableRequests); </script> ```
/content/code_sandbox/frontend/components/Stations/Profile/RequestsPanel.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
493
```vue <template> <div class="row g-3"> <form-group-field id="edit_form_username" class="col-md-6" :field="v$.username" > <template #label> {{ $gettext('Username') }} </template> </form-group-field> <form-group-field id="edit_form_password" class="col-md-6" :field="v$.password" input-type="password" > <template v-if="isEditMode" #label > {{ $gettext('New Password') }} </template> <template v-else #label > {{ $gettext('Password') }} </template> <template v-if="isEditMode" #description > {{ $gettext('Leave blank to use the current password.') }} </template> </form-group-field> <form-group-field id="edit_form_publicKeys" class="col-md-12" :field="v$.publicKeys" input-type="textarea" > <template #label> {{ $gettext('SSH Public Keys') }} </template> <template #description> {{ $gettext('Optionally supply SSH public keys this user can use to connect instead of a password. Enter one key per line.') }} </template> </form-group-field> </div> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {computed} from "vue"; import {required} from "@vuelidate/validators"; const props = defineProps({ form: { type: Object, required: true }, isEditMode: { type: Boolean, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$} = useVuelidateOnFormTab( computed(() => { return { username: {required}, password: props.isEditMode ? {} : {required}, publicKeys: {} } }), form, { username: '', password: null, publicKeys: null } ); </script> ```
/content/code_sandbox/frontend/components/Stations/SftpUsers/Form.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
531
```vue <template> <modal-form ref="$modal" :loading="loading" :title="langTitle" :error="error" :disable-save-button="v$.$invalid" @submit="doSubmit" @hidden="clearContents" > <sftp-users-form v-model:form="form" :is-edit-mode="isEditMode" /> </modal-form> </template> <script setup lang="ts"> import SftpUsersForm from "./Form.vue"; import {baseEditModalProps, ModalFormTemplateRef, useBaseEditModal} from "~/functions/useBaseEditModal"; import {computed, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import ModalForm from "~/components/Common/ModalForm.vue"; const props = defineProps({ ...baseEditModalProps, }); const emit = defineEmits(['relist']); const $modal = ref<ModalFormTemplateRef>(null); const { loading, error, isEditMode, form, v$, clearContents, create, edit, doSubmit, close } = useBaseEditModal( props, emit, $modal, {}, {} ); const {$gettext} = useTranslate(); const langTitle = computed(() => { return isEditMode.value ? $gettext('Edit SFTP User') : $gettext('Add SFTP User'); }); defineExpose({ create, edit, close }); </script> ```
/content/code_sandbox/frontend/components/Stations/SftpUsers/EditModal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
322
```vue <template> <modal-form ref="$modal" :loading="loading" :title="langTitle" :error="error" :disable-save-button="v$.$invalid" @submit="doSubmit" @hidden="clearContents" > <type-select v-if="!type" :type-details="typeDetails" @select="setType" /> <tabs v-else> <basic-info v-model:form="form" :trigger-details="triggerDetails" :triggers="triggers" /> <component :is="formComponent" v-model:form="form" :label="typeTitle" /> </tabs> </modal-form> </template> <script setup lang="ts"> import TypeSelect from "./Form/TypeSelect.vue"; import BasicInfo from "./Form/BasicInfo.vue"; import {get, map} from "lodash"; import Generic from "./Form/Generic.vue"; import Email from "./Form/Email.vue"; import Tunein from "./Form/Tunein.vue"; import Discord from "./Form/Discord.vue"; import Telegram from "./Form/Telegram.vue"; import GoogleAnalyticsV4 from "./Form/GoogleAnalyticsV4.vue"; import MatomoAnalytics from "./Form/MatomoAnalytics.vue"; import Mastodon from "./Form/Mastodon.vue"; import {baseEditModalProps, ModalFormTemplateRef, useBaseEditModal} from "~/functions/useBaseEditModal"; import {computed, nextTick, provide, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import ModalForm from "~/components/Common/ModalForm.vue"; import {getTriggers, WebhookType} from "~/entities/Webhooks"; import Tabs from "~/components/Common/Tabs.vue"; import RadioDe from "~/components/Stations/Webhooks/Form/RadioDe.vue"; import GetMeRadio from "~/components/Stations/Webhooks/Form/GetMeRadio.vue"; import RadioReg from "~/components/Stations/Webhooks/Form/RadioReg.vue"; const props = defineProps({ ...baseEditModalProps, nowPlayingUrl: { type: String, required: true }, typeDetails: { type: Object, required: true }, triggerDetails: { type: Object, required: true } }); provide('nowPlayingUrl', props.nowPlayingUrl); const emit = defineEmits(['relist']); const type = ref(null); const $modal = ref<ModalFormTemplateRef>(null); const webhookComponents = { [WebhookType.Generic]: Generic, [WebhookType.Email]: Email, [WebhookType.TuneIn]: Tunein, [WebhookType.RadioDe]: RadioDe, [WebhookType.RadioReg]: RadioReg, [WebhookType.GetMeRadio]: GetMeRadio, [WebhookType.Discord]: Discord, [WebhookType.Telegram]: Telegram, [WebhookType.Mastodon]: Mastodon, [WebhookType.GoogleAnalyticsV4]: GoogleAnalyticsV4, [WebhookType.MatomoAnalytics]: MatomoAnalytics, }; const triggers = computed(() => { if (!type.value) { return []; } return map( getTriggers(type.value), (trigger) => { return { key: trigger, title: get(props.triggerDetails, [trigger, 'title']), description: get(props.triggerDetails, [trigger, 'description']) }; } ); }); const typeTitle = computed(() => { return get(props.typeDetails, [type.value, 'title'], ''); }); const formComponent = computed(() => { return get(webhookComponents, type.value, Generic); }); const { loading, error, isEditMode, form, v$, resetForm, clearContents: originalClearContents, create, edit, doSubmit, close } = useBaseEditModal( props, emit, $modal, {}, {}, { populateForm: (data, formRef) => { type.value = data.type; formRef.value = { name: data.name, triggers: data.triggers, config: data.config }; }, getSubmittableFormData(formRef, isEditModeRef) { const formData = formRef.value; if (!isEditModeRef.value) { formData.type = type.value; } return formData; }, } ); const {$gettext} = useTranslate(); const langTitle = computed(() => { if (isEditMode.value) { return $gettext('Edit Web Hook'); } return type.value ? $gettext('Add Web Hook') : $gettext('Select Web Hook Type'); }); const clearContents = () => { type.value = null; originalClearContents(); }; const setType = (newType) => { type.value = newType; nextTick(resetForm); }; defineExpose({ create, edit, close }); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/EditModal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,078
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3 mb-3"> <form-group-field id="form_config_bot_token" class="col-md-6" :field="v$.config.bot_token" :label="$gettext('Bot Token')" > <template #description> <a href="path_to_url#botfather" target="_blank" > {{ $gettext('See the Telegram Documentation for more details.') }} </a> </template> </form-group-field> <form-group-field id="form_config_chat_id" class="col-md-6" :field="v$.config.chat_id" :label="$gettext('Chat ID')" :description="$gettext('Unique identifier for the target chat or username of the target channel (in the format @channelusername).')" /> <form-group-field id="form_config_api" class="col-md-6" :field="v$.config.api" :label="$gettext('Custom API Base URL')" :description="$gettext('Leave blank to use the default Telegram API URL (recommended).')" /> </div> <common-formatting-info /> <div class="row g-3"> <form-group-field id="form_config_text" class="col-md-12" :field="v$.config.text" input-type="textarea" :label="$gettext('Main Message Content')" /> <form-group-multi-check id="form_config_parse_mode" class="col-md-12" :field="v$.config.parse_mode" :options="parseModeOptions" stacked radio :label="$gettext('Message parsing mode')" > <template #description> <a href="path_to_url#sendmessage" target="_blank" > {{ $gettext('See the Telegram documentation for more details.') }} </a> </template> </form-group-multi-check> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import CommonFormattingInfo from "./Common/FormattingInfo.vue"; import {computed} from "vue"; import {useTranslate} from "~/vendor/gettext"; import FormGroupMultiCheck from "~/components/Form/FormGroupMultiCheck.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {$gettext} = useTranslate(); const {v$, tabClass} = useVuelidateOnFormTab( { config: { bot_token: {required}, chat_id: {required}, api: {}, text: {required}, parse_mode: {required} } }, form, () => { return { config: { bot_token: '', chat_id: '', api: '', text: $gettext( 'Now playing on %{ station }: %{ title } by %{ artist }! Tune in now.', { station: '{{ station.name }}', title: '{{ now_playing.song.title }}', artist: '{{ now_playing.song.artist }}' } ), parse_mode: 'Markdown' } }; } ); const parseModeOptions = computed(() => { return [ { text: $gettext('Markdown'), value: 'Markdown', }, { text: $gettext('HTML'), value: 'HTML', } ]; }); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Telegram.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
869
```vue <template> <div class="row g-3"> <div class="col-md-6"> <type-select-section :title="$gettext('Generic Web Hooks')" :types="buildTypeInfo([ WebhookType.Generic, WebhookType.Email ])" @select="selectType" /> <type-select-section :title="$gettext('Social Media')" :types="buildTypeInfo([ WebhookType.Discord, WebhookType.Telegram, WebhookType.Mastodon ])" @select="selectType" /> </div> <div class="col-md-6"> <type-select-section :title="$gettext('Station Directories')" :types="buildTypeInfo([ WebhookType.TuneIn, WebhookType.RadioDe, WebhookType.RadioReg, WebhookType.GetMeRadio ])" @select="selectType" /> <type-select-section :title="$gettext('Analytics')" :types="buildTypeInfo([ WebhookType.GoogleAnalyticsV4, WebhookType.MatomoAnalytics ])" @select="selectType" /> </div> </div> </template> <script setup lang="ts"> import {WebhookType} from "~/entities/Webhooks"; import TypeSelectSection from "~/components/Stations/Webhooks/Form/TypeSelectSection.vue"; import {get, map} from "lodash"; const props = defineProps({ typeDetails: { type: Object, required: true } }); const buildTypeInfo = (types) => map( types, (type) => { return { ...get(props.typeDetails, type), key: type }; } ); const emit = defineEmits(['select']); const selectType = (type) => { emit('select', type); } </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/TypeSelect.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
411
```vue <template> <tab :label="title" :item-header-class="tabClass" > <form-markup id="mastodon_details"> <template #label> {{ $gettext('Mastodon Account Details') }} </template> <p class="card-text"> {{ $gettext('Steps for configuring a Mastodon application:') }} </p> <ul> <li> {{ $gettext('Visit your Mastodon instance.') }} </li> <li> {{ $gettext('Click the "Preferences" link, then "Development" on the left side menu.') }} </li> <li> {{ $gettext('Click "New Application"') }} </li> <li> {{ $gettext('Enter "AzuraCast" as the application name. You can leave the URL fields unchanged. For "Scopes", only "write:media" and "write:statuses" are required.') }} </li> </ul> <p class="card-text"> {{ $gettext('Once these steps are completed, enter the "Access Token" from the application\'s page into the field below.') }} </p> </form-markup> <div class="row g-3 mb-3"> <form-group-field id="form_config_instance_url" class="col-md-6" :field="v$.config.instance_url" :label="$gettext('Mastodon Instance URL')" :description="$gettext('If your Mastodon username is &quot;@test@example.com&quot;, enter &quot;example.com&quot;.')" /> <form-group-field id="form_config_access_token" class="col-md-6" :field="v$.config.access_token" :label="$gettext('Access Token')" /> <common-rate-limit-fields v-model:form="form" /> </div> <div class="row g-3 mb-3"> <form-group-multi-check id="form_config_visibility" class="col-md-12" :field="v$.config.visibility" :options="visibilityOptions" stacked radio :label="$gettext('Message Visibility')" /> </div> <common-social-post-fields v-model:form="form" /> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import CommonRateLimitFields from "./Common/RateLimitFields.vue"; import CommonSocialPostFields from "./Common/SocialPostFields.vue"; import {computed} from "vue"; import {useTranslate} from "~/vendor/gettext"; import FormMarkup from "~/components/Form/FormMarkup.vue"; import FormGroupMultiCheck from "~/components/Form/FormGroupMultiCheck.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { instance_url: {required}, access_token: {required}, visibility: {required} } }, form, { config: { instance_url: '', access_token: '', visibility: 'public', } } ); const {$gettext} = useTranslate(); const visibilityOptions = computed(() => { return [ { text: $gettext('Public'), value: 'public', }, { text: $gettext('Unlisted'), value: 'unlisted', }, { text: $gettext('Followers Only'), value: 'private', } ]; }); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Mastodon.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
885
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_webhookurl" class="col-md-12" :field="v$.config.webhookurl" :label="$gettext('RadioReg Webhook URL')" :description="$gettext('Found under the settings page for the corresponding RadioReg station.')" /> <form-group-field id="form_config_apikey" class="col-md-6" :field="v$.config.apikey" :label="$gettext('RadioReg Organization API Key')" :description="$gettext('An API token is issued on a per-organization basis and are found on the org. settings page.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { webhookurl: {required}, apikey: {required} } }, form, { config: { webhookurl: '', apikey: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/RadioReg.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
394
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_token" class="col-md-6" :field="v$.config.token" :label="$gettext('API Token')" :description="$gettext('This can be retrieved from the GetMeRadio dashboard.')" /> <form-group-field id="form_config_station_id" class="col-md-6" :field="v$.config.station_id" :label="$gettext('GetMeRadio Station ID')" :description="$gettext('This is a 3-5 digit number.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { token: {required}, station_id: {required} } }, form, { config: { token: '', station_id: '', } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/GetMeRadio.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
373
```vue <template> <section class="card mb-3"> <div class="card-header text-bg-primary"> <h3 class="card-subtitle"> {{ title }} </h3> </div> <div class="list-group list-group-flush"> <a v-for="type in types" :key="type.key" class="list-group-item list-group-item-action" href="#" @click.prevent="selectType(type.key)" > <h6 class="font-weight-bold mb-0"> {{ type.title }} </h6> <p class="card-text small"> {{ type.description }} </p> </a> </div> </section> </template> <script setup lang="ts"> const props = defineProps({ title: { type: String, required: true }, types: { type: Array, required: true } }); const emit = defineEmits([ 'select' ]); const selectType = (type) => { emit('select', type); } </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/TypeSelectSection.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
239
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_broadcastsubdomain" class="col-md-12" :field="v$.config.broadcastsubdomain" :label="$gettext('Radio.de Broadcast Subdomain')" /> <form-group-field id="form_config_apikey" class="col-md-6" :field="v$.config.apikey" :label="$gettext('Radio.de API Key')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { broadcastsubdomain: {required}, apikey: {required} } }, form, { config: { broadcastsubdomain: '', apikey: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/RadioDe.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
348
```vue <template> <tab :label="$gettext('Basic Info')" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_edit_name" class="col-md-12" :field="v$.name" :label="$gettext('Web Hook Name')" :description="$gettext('Choose a name for this webhook that will help you distinguish it from others. This will only be shown on the administration page.')" /> <form-group-multi-check v-if="triggers.length > 0" id="edit_form_triggers" class="col-md-12" :field="v$.triggers" :options="triggerOptions" stacked :label="$gettext('Web Hook Triggers')" :description="$gettext('This web hook will only run when the selected event(s) occur on this specific station.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import FormGroupMultiCheck from "~/components/Form/FormGroupMultiCheck.vue"; import {map} from "lodash"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ form: { type: Object, required: true }, triggers: { type: Array, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { name: {required}, triggers: {} }, form, { name: null, triggers: [], config: {} } ); const triggerOptions = map( props.triggers, (trigger) => { return { value: trigger.key, text: trigger.title, description: trigger.description }; } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/BasicInfo.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
472
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_station_id" class="col-md-6" :field="v$.config.station_id" :label="$gettext('TuneIn Station ID')" :description="$gettext('The station ID will be a numeric string that starts with the letter S.')" /> <form-group-field id="form_config_partner_id" class="col-md-6" :field="v$.config.partner_id" :label="$gettext('TuneIn Partner ID')" /> <form-group-field id="form_config_partner_key" class="col-md-6" :field="v$.config.partner_key" :label="$gettext('TuneIn Partner Key')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { station_id: {required}, partner_id: {required}, partner_key: {required}, } }, form, { config: { station_id: '', partner_id: '', partner_key: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Tunein.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
425
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_api_secret" class="col-md-6" :field="v$.config.api_secret" :label="$gettext('Measurement Protocol API Secret')" :description="$gettext('This can be generated in the &quot;Events&quot; section for a measurement.')" /> <form-group-field id="form_config_measurement_id" class="col-md-6" :field="v$.config.measurement_id" :label="$gettext('Measurement ID')" :description="$gettext('A unique identifier (i.e. &quot;G-A1B2C3D4&quot;) for this measurement stream.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { api_secret: {required}, measurement_id: {required} } }, form, { config: { api_secret: '', measurement_id: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/GoogleAnalyticsV4.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
399
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3 mb-3"> <form-group-field id="form_config_webhook_url" class="col-md-12" :field="v$.config.webhook_url" input-type="url" :label="$gettext('Discord Web Hook URL')" :description="$gettext('This URL is provided within the Discord application.')" /> </div> <common-formatting-info /> <div class="row g-3"> <form-group-field id="form_config_content" class="col-md-6" :field="v$.config.content" input-type="textarea" :label="$gettext('Main Message Content')" /> <form-group-field id="form_config_title" class="col-md-6" :field="v$.config.title" :label="$gettext('Title')" /> <form-group-field id="form_config_description" class="col-md-6" :field="v$.config.description" input-type="textarea" :label="$gettext('Description')" /> <form-group-field id="form_config_url" class="col-md-6" :field="v$.config.url" input-type="url" :label="$gettext('URL')" /> <form-group-field id="form_config_author" class="col-md-6" :field="v$.config.author" :label="$gettext('Author')" /> <form-group-field id="form_config_thumbnail" class="col-md-6" :field="v$.config.thumbnail" input-type="url" :label="$gettext('Thumbnail Image URL')" /> <form-group-field id="form_config_footer" class="col-md-6" :field="v$.config.footer" :label="$gettext('Footer Text')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import CommonFormattingInfo from "./Common/FormattingInfo.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import {useTranslate} from "~/vendor/gettext"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {$gettext} = useTranslate(); const {v$, tabClass} = useVuelidateOnFormTab( { config: { webhook_url: {required}, content: {}, title: {}, description: {}, url: {}, author: {}, thumbnail: {}, footer: {}, } }, form, () => { return { config: { webhook_url: '', content: $gettext( 'Now playing on %{ station }:', {'station': '{{ station.name }}'} ), title: '{{ now_playing.song.title }}', description: '{{ now_playing.song.artist }}', url: '{{ station.listen_url }}', author: '{{ live.streamer_name }}', thumbnail: '{{ now_playing.song.art }}', footer: $gettext('Powered by AzuraCast'), } } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Discord.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
797
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3 mb-3"> <form-group-field id="form_config_to" class="col-md-12" :field="v$.config.to" :label="$gettext('Message Recipient(s)')" :description="$gettext('E-mail addresses can be separated by commas.')" /> </div> <common-formatting-info /> <div class="row g-3"> <form-group-field id="form_config_subject" class="col-md-12" :field="v$.config.subject" :label="$gettext('Message Subject')" /> <form-group-field id="form_config_message" class="col-md-12" :field="v$.config.message" :label="$gettext('Message Body')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import CommonFormattingInfo from "./Common/FormattingInfo.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { to: {required}, subject: {required}, message: {required} } }, form, { config: { to: '', subject: '', message: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Email.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
437
```vue <template> <tab :label="title" :item-header-class="tabClass" > <div class="row g-3"> <form-group-field id="form_config_matomo_url" class="col-md-12" :field="v$.config.matomo_url" input-type="url" :label="$gettext('Matomo Installation Base URL')" :description="$gettext('The full base URL of your Matomo installation.')" /> <form-group-field id="form_config_site_id" class="col-md-6" :field="v$.config.site_id" :label="$gettext('Matomo Site ID')" :description="$gettext('The numeric site ID for this site.')" /> <form-group-field id="form_config_token" class="col-md-6" :field="v$.config.token" :label="$gettext('Matomo API Token')" :description="$gettext('Optionally supply an API token to allow IP address overriding.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { matomo_url: {required}, site_id: {required}, token: {}, } }, form, { config: { matomo_url: '', site_id: '', token: '' } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/MatomoAnalytics.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
456
```vue <template> <tab :label="title" :item-header-class="tabClass" > <form-markup id="webhook_details"> <template #label> {{ $gettext('Web Hook Details') }} </template> <p class="card-text"> {{ $gettext('Web hooks automatically send a HTTP POST request to the URL you specify to notify it any time one of the triggers you specify occurs on your station.') }} </p> <p class="card-text"> {{ $gettext('The body of the POST message is the exact same as the NowPlaying API response for your station.') }} </p> <ul> <li> <a href="path_to_url" target="_blank" > {{ $gettext('NowPlaying API Response') }} </a> </li> </ul> <p class="card-text"> {{ $gettext('In order to process quickly, web hooks have a short timeout, so the responding service should be optimized to handle the request in under 2 seconds.') }} </p> </form-markup> <div class="row g-3"> <form-group-field id="form_config_webhook_url" class="col-md-12" :field="v$.config.webhook_url" input-type="url" :label="$gettext('Web Hook URL')" :description="$gettext('The URL that will receive the POST messages any time an event is triggered.')" /> <form-group-field id="form_config_basic_auth_username" class="col-md-6" :field="v$.config.basic_auth_username" :label="$gettext('Optional: HTTP Basic Authentication Username')" :description="$gettext('If your web hook requires HTTP basic authentication, provide the username here.')" /> <form-group-field id="form_config_basic_auth_password" class="col-md-6" :field="v$.config.basic_auth_password" :label="$gettext('Optional: HTTP Basic Authentication Password')" :description="$gettext('If your web hook requires HTTP basic authentication, provide the password here.')" /> <form-group-field id="form_config_timeout" class="col-md-6" :field="v$.config.timeout" input-type="number" :input-attrs="{ min: '0.0', max: '600.0', step: '0.1' }" :label="$gettext('Optional: Request Timeout (Seconds)')" :description="$gettext('The number of seconds to wait for a response from the remote server before cancelling the request.')" /> </div> </tab> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import FormMarkup from "~/components/Form/FormMarkup.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {required} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; const props = defineProps({ title: { type: String, required: true }, form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$, tabClass} = useVuelidateOnFormTab( { config: { webhook_url: {required}, basic_auth_username: {}, basic_auth_password: {}, timeout: {}, } }, form, { config: { webhook_url: '', basic_auth_username: '', basic_auth_password: '', timeout: '5', } } ); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Generic.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
831
```vue <template> <form-group-select id="form_config_rate_limit" class="col-md-12" :field="v$.config.rate_limit" :options="rateLimitOptions" :label="$gettext('Only Post Once Every...')" /> </template> <script setup lang="ts"> import {useTranslate} from "~/vendor/gettext"; import FormGroupSelect from "~/components/Form/FormGroupSelect.vue"; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; const props = defineProps({ form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {v$} = useVuelidateOnFormTab( { config: { rate_limit: {}, } }, form, { config: { rate_limit: 0 } } ); const {$gettext, interpolate} = useTranslate(); const langSeconds = $gettext('%{ seconds } seconds'); const langMinutes = $gettext('%{ minutes } minutes'); const langHours = $gettext('%{ hours } hours'); const rateLimitOptions = [ { text: $gettext('No Limit'), value: 0, }, { text: interpolate(langSeconds, {seconds: 15}), value: 15, }, { text: interpolate(langSeconds, {seconds: 30}), value: 30, }, { text: interpolate(langSeconds, {seconds: 60}), value: 60, }, { text: interpolate(langMinutes, {minutes: 2}), value: 120, }, { text: interpolate(langMinutes, {minutes: 5}), value: 300, }, { text: interpolate(langMinutes, {minutes: 10}), value: 600, }, { text: interpolate(langMinutes, {minutes: 15}), value: 900, }, { text: interpolate(langMinutes, {minutes: 30}), value: 1800, }, { text: interpolate(langMinutes, {minutes: 60}), value: 3600, }, { text: interpolate(langHours, {hours: 2}), value: 7200, }, { text: interpolate(langHours, {hours: 3}), value: 10800, }, { text: interpolate(langHours, {hours: 6}), value: 21600, }, { text: interpolate(langHours, {hours: 12}), value: 43200, } ]; </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Common/RateLimitFields.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
604
```vue <template> <common-formatting-info /> <div class="row g-3"> <form-group-field v-if="hasTrigger('song_changed')" id="form_config_message" class="col-md-12" :field="v$.config.message" input-type="textarea" :label="$gettext('Message Body on Song Change')" /> <form-group-field v-if="hasTrigger('song_changed_live')" id="form_config_message_song_changed_live" class="col-md-12" :field="v$.config.message_song_changed_live" input-type="textarea" :label="$gettext('Message Body on Song Change with Streamer/DJ Connected')" /> <form-group-field v-if="hasTrigger('live_connect')" id="form_config_message_live_connect" class="col-md-12" :field="v$.config.message_live_connect" input-type="textarea" :label="$gettext('Message Body on Streamer/DJ Connect')" /> <form-group-field v-if="hasTrigger('live_disconnect')" id="form_config_message_live_disconnect" class="col-md-12" :field="v$.config.message_live_disconnect" input-type="textarea" :label="$gettext('Message Body on Streamer/DJ Disconnect')" /> <form-group-field v-if="hasTrigger('station_offline')" id="form_config_message_station_offline" class="col-md-12" :field="v$.config.message_station_offline" input-type="textarea" :label="$gettext('Message Body on Station Offline')" /> <form-group-field v-if="hasTrigger('station_online')" id="form_config_message_station_online" class="col-md-12" :field="v$.config.message_station_online" input-type="textarea" :label="$gettext('Message Body on Station Online')" /> </div> </template> <script setup lang="ts"> import FormGroupField from "~/components/Form/FormGroupField.vue"; import CommonFormattingInfo from "./FormattingInfo.vue"; import {includes} from 'lodash'; import {useVModel} from "@vueuse/core"; import {useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {useTranslate} from "~/vendor/gettext"; const props = defineProps({ form: { type: Object, required: true } }); const emit = defineEmits(['update:form']); const form = useVModel(props, 'form', emit); const {$gettext} = useTranslate(); const {v$} = useVuelidateOnFormTab( { config: { message: {}, message_song_changed_live: {}, message_live_connect: {}, message_live_disconnect: {}, message_station_offline: {}, message_station_online: {} } }, form, () => { return { config: { message: $gettext( 'Now playing on %{ station }: %{ title } by %{ artist }! Tune in now: %{ url }', { station: '{{ station.name }}', title: '{{ now_playing.song.title }}', artist: '{{ now_playing.song.artist }}', url: '{{ station.public_player_url }}' } ), message_song_changed_live: $gettext( 'Now playing on %{ station }: %{ title } by %{ artist } with your host, %{ dj }! Tune in now: %{ url }', { station: '{{ station.name }}', title: '{{ now_playing.song.title }}', artist: '{{ now_playing.song.artist }}', dj: '{{ live.streamer_name }}', url: '{{ station.public_player_url }}' } ), message_live_connect: $gettext( '%{ dj } is now live on %{ station }! Tune in now: %{ url }', { dj: '{{ live.streamer_name }}', station: '{{ station.name }}', url: '{{ station.public_player_url }}' } ), message_live_disconnect: $gettext( 'Thanks for listening to %{ station }!', { station: '{{ station.name }}', } ), message_station_offline: $gettext( '%{ station } is going offline for now.', { station: '{{ station.name }}' } ), message_station_online: $gettext( '%{ station } is back online! Tune in now: %{ url }', { station: '{{ station.name }}', url: '{{ station.public_player_url }}' } ) } } } ); const hasTrigger = (trigger) => { return includes(props.form.triggers, trigger); }; </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Common/SocialPostFields.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,014
```vue <template> <form-markup id="customization_tips"> <template #label> {{ $gettext('Message Customization Tips') }} </template> <p class="card-text"> {{ $gettext('Variables are in the form of: ') }} <code v-pre>{{ var.name }}</code> </p> <p class="card-text"> {{ $gettext('All values in the NowPlaying API response are available for use. Any empty fields are ignored.') }} <br> <a :href="nowPlayingUrl" target="_blank" > {{ $gettext('NowPlaying API Response') }} </a> </p> </form-markup> </template> <script setup lang="ts"> import FormMarkup from "~/components/Form/FormMarkup.vue"; import {inject} from "vue"; const nowPlayingUrl = inject<string>('nowPlayingUrl'); </script> ```
/content/code_sandbox/frontend/components/Stations/Webhooks/Form/Common/FormattingInfo.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
200
```vue <template> <svg class="icon" xmlns="path_to_url" :viewBox="icon.viewBox" fill="currentColor" focusable="false" aria-hidden="true" v-html="icon.contents" /> </template> <script setup lang="ts"> import {Icon} from "~/components/Common/icons.ts"; const props = defineProps<{ icon: Icon }>(); </script> ```
/content/code_sandbox/frontend/components/Common/Icon.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
91
```vue <template> <nav class="d-flex"> <ul class="pagination mb-0"> <pagination-item v-if="hasFirst" :page="1" :active="page === 1" @click="setPage" /> <pagination-item v-if="hasFirstEllipsis" label="..." disabled /> <pagination-item v-for="pageNum in pagesInRange" :key="pageNum" :page="pageNum" :active="page === pageNum" @click="setPage" /> <pagination-item v-if="hasLastEllipsis" label="..." disabled /> <pagination-item v-if="hasLast" :page="pageCount" :active="page === pageCount" @click="setPage" /> </ul> <div v-if="showInput" class="input-group input-group-sm ms-2" > <input v-model="inputPage" type="number" :min="1" :max="pageCount" step="1" class="form-control rounded-start-2" :aria-label="$gettext('Page')" style="max-width: 60px;" @keydown.enter.prevent="goToPage" > <button class="btn btn-outline-secondary rounded-end-2" type="button" @click="goToPage" > {{ $gettext('Go') }} </button> </div> </nav> </template> <script setup lang="ts"> import {computed, ref, toRef, watch} from "vue"; import PaginationItem from "~/components/Common/PaginationItem.vue"; import {clamp} from "lodash"; const props = defineProps({ total: { type: Number, required: true }, perPage: { type: Number, required: true, }, currentPage: { type: Number, default: 1 }, pageSpace: { type: Number, default: 1 } }); const emit = defineEmits(['update:currentPage', 'change']); const pageCount = computed(() => Math.max( 1, Math.ceil(props.total / props.perPage), )); const inputPage = ref(1); const setPage = (newPage: number) => { newPage = clamp(newPage, 1, pageCount.value); page.value = newPage; inputPage.value = newPage; }; watch(toRef(props, 'currentPage'), (newPage: number) => { setPage(newPage); }); const page = computed({ get() { return props.currentPage; }, set(newValue) { emit('update:currentPage', newValue); emit('change', newValue); } }); const hasFirst = computed( () => page.value >= (props.pageSpace + 2) ); const hasFirstEllipsis = computed( () => page.value >= (props.pageSpace + 4) ); const hasLast = computed( () => page.value <= (pageCount.value - (props.pageSpace + 1)) ); const hasLastEllipsis = computed( () => page.value < (pageCount.value - (props.pageSpace + 2)) ); const pagesInRange = computed(() => { let left = Math.max(1, page.value - props.pageSpace) if (left - 1 === 2) { left-- // Do not show the ellipsis if there is only one to hide } let right = Math.min(page.value + props.pageSpace, pageCount.value) if (pageCount.value - right === 2) { right++ // Do not show the ellipsis if there is only one to hide } const pages = [] for (let i = left; i <= right; i++) { pages.push(i) } return pages }); const showInput = computed(() => { return pageCount.value > 10; }); const goToPage = () => { setPage(inputPage.value); }; </script> ```
/content/code_sandbox/frontend/components/Common/Pagination.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
875
```vue <template> <modal :id="id" ref="$modal" :size="size" :title="title" :busy="loading" @shown="onShown" @hidden="onHidden" > <template #default="slotProps"> <div v-if="error != null" class="alert alert-danger" > {{ error }} </div> <form class="form vue-form" @submit.prevent="doSubmit" > <slot name="default" v-bind="slotProps" /> <invisible-submit-button /> </form> </template> <template #modal-footer="slotProps"> <slot name="modal-footer" v-bind="slotProps" > <button class="btn btn-secondary" type="button" @click="hide" > {{ $gettext('Close') }} </button> <button class="btn" :class="(disableSaveButton) ? 'btn-danger' : 'btn-primary'" type="submit" @click="doSubmit" > <slot name="save-button-name"> {{ $gettext('Save Changes') }} </slot> </button> </slot> </template> <template v-for="(_, slot) of useSlotsExcept(['default', 'modal-footer'])" #[slot]="scope" > <slot :name="slot" v-bind="scope" /> </template> </modal> </template> <script setup lang="ts"> import InvisibleSubmitButton from "~/components/Common/InvisibleSubmitButton.vue"; import {ref} from "vue"; import useSlotsExcept from "~/functions/useSlotsExcept"; import Modal from "~/components/Common/Modal.vue"; import {ModalTemplateRef, useHasModal} from "~/functions/useHasModal.ts"; const props = defineProps({ title: { type: String, required: true }, size: { type: String, default: 'lg' }, centered: { type: Boolean, default: false }, id: { type: String, default: 'edit-modal' }, loading: { type: Boolean, default: false }, disableSaveButton: { type: Boolean, default: false }, noEnforceFocus: { type: Boolean, default: false, }, error: { type: String, default: null } }); const emit = defineEmits(['submit', 'shown', 'hidden']); const doSubmit = () => { emit('submit'); }; const onShown = () => { emit('shown'); }; const onHidden = () => { emit('hidden'); }; const $modal = ref<ModalTemplateRef>(null); const {show, hide} = useHasModal($modal); defineExpose({ show, hide }); </script> ```
/content/code_sandbox/frontend/components/Common/ModalForm.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
647
```vue <template> <button type="button" :title="langTitle" :aria-label="langTitle" class="btn p-0" @click="toggle" > <icon :class="iconClass" :icon="iconText" /> </button> </template> <script setup lang="ts"> import Icon from "./Icon.vue"; import {computed} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {IconPlayCircle, IconStopCircle} from "~/components/Common/icons"; import getUrlWithoutQuery from "~/functions/getUrlWithoutQuery.ts"; import {usePlayerStore} from "~/functions/usePlayerStore.ts"; const props = defineProps({ url: { type: String, required: true }, isStream: { type: Boolean, default: false }, isHls: { type: Boolean, default: false }, iconClass: { type: String, default: null } }); const {isPlaying, current, toggle: storeToggle} = usePlayerStore(); const isThisPlaying = computed(() => { if (!isPlaying.value) { return false; } const playingUrl = getUrlWithoutQuery(current.value?.url); const thisUrl = getUrlWithoutQuery(props.url); return playingUrl === thisUrl; }); const {$gettext} = useTranslate(); const langTitle = computed(() => { return isThisPlaying.value ? $gettext('Stop') : $gettext('Play'); }); const iconText = computed(() => { return isThisPlaying.value ? IconStopCircle : IconPlayCircle; }); const toggle = () => { storeToggle({ url: props.url, isStream: props.isStream, isHls: props.isHls }); }; defineExpose({ toggle }) </script> ```
/content/code_sandbox/frontend/components/Common/PlayButton.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
407
```vue <template> <ul class="navdrawer-nav"> <li v-for="category in menu" :key="category.key" class="nav-item" > <router-link v-if="isRouteLink(category)" :class="getLinkClass(category)" :to="category.url" class="nav-link" > <icon class="navdrawer-nav-icon" :icon="category.icon" /> <span class="might-overflow">{{ category.label }}</span> </router-link> <a v-else v-bind="getCategoryLink(category)" class="nav-link" :class="getLinkClass(category)" > <icon class="navdrawer-nav-icon" :icon="category.icon" /> <span class="might-overflow">{{ category.label }}</span> <icon v-if="category.external" class="sm ms-2" :icon="IconOpenInNew" :aria-label="$gettext('External')" /> </a> <div v-if="category.items" :id="'sidebar-submenu-'+category.key" class="collapse pb-2" :class="(isActiveItem(category)) ? 'show' : ''" > <ul class="navdrawer-nav"> <li v-for="item in category.items" :key="item.key" class="nav-item" > <router-link v-if="isRouteLink(item)" :to="item.url" class="nav-link ps-4 py-2" :class="getLinkClass(item)" :title="item.title" > <span class="might-overflow">{{ item.label }}</span> </router-link> <a v-else class="nav-link ps-4 py-2" :class="item.class" :href="item.url" :target="(item.external) ? '_blank' : ''" :title="item.title" > <span class="might-overflow">{{ item.label }}</span> <icon v-if="item.external" class="sm ms-2" :icon="IconOpenInNew" :aria-label="$gettext('External')" /> </a> </li> </ul> </div> </li> </ul> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import {useRoute} from "vue-router"; import {some} from "lodash"; import {IconOpenInNew} from "~/components/Common/icons.ts"; const props = defineProps({ menu: { type: Object, required: true }, }); const currentRoute = useRoute(); const isRouteLink = (item) => { return (typeof (item.url) !== 'undefined') && (typeof (item.url) !== 'string'); }; const isActiveItem = (item) => { if (item.items && some(item.items, isActiveItem)) { return true; } return isRouteLink(item) && !('params' in item.url) && item.url.name === currentRoute.name; }; const getLinkClass = (item) => { return [ item.class ?? null, isActiveItem(item) ? 'active' : '' ]; } const getCategoryLink = (item) => { const linkAttrs: { [key: string]: any } = {}; if (item.items) { linkAttrs['data-bs-toggle'] = 'collapse'; linkAttrs.href = '#sidebar-submenu-' + item.key; } else { linkAttrs.href = item.url; } if (item.external) { linkAttrs.target = '_blank'; } if (item.title) { linkAttrs.title = item.title; } return linkAttrs; } </script> <style lang="scss"> @import "~/scss/_mixins.scss"; .might-overflow { @include might-overflow(); } </style> ```
/content/code_sandbox/frontend/components/Common/SidebarMenu.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
871
```vue <template> <loading :loading="isLoading"> <form-group-checkbox id="modal_scroll_to_bottom" v-model="scrollToBottom" :label="$gettext('Automatically Scroll to Bottom')" /> <textarea id="log-view-contents" ref="$textarea" class="form-control log-viewer" spellcheck="false" readonly :value="logs" /> </loading> </template> <script setup lang="ts"> import {nextTick, ref, toRef, watch} from "vue"; import {useAxios} from "~/vendor/axios"; import {tryOnScopeDispose} from "@vueuse/core"; import Loading from "~/components/Common/Loading.vue"; import FormGroupCheckbox from "~/components/Form/FormGroupCheckbox.vue"; const props = defineProps({ logUrl: { type: String, required: true, } }); const isLoading = ref(false); const logs = ref(''); const currentLogPosition = ref(null); const scrollToBottom = ref(true); const {axios} = useAxios(); const $textarea = ref<HTMLTextAreaElement | null>(null); let updateInterval = null; const stop = () => { if (updateInterval) { clearInterval(updateInterval); } }; tryOnScopeDispose(stop); const updateLogs = () => { axios({ method: 'GET', url: props.logUrl, params: { position: currentLogPosition.value } }).then((resp) => { if (resp.data.contents !== '') { logs.value = logs.value + resp.data.contents + "\n"; if (scrollToBottom.value && $textarea.value) { nextTick(() => { $textarea.value.scrollTop = $textarea.value?.scrollHeight; }); } } currentLogPosition.value = resp.data.position; if (resp.data.eof) { stop(); } }).finally(() => { isLoading.value = false; }); }; watch(toRef(props, 'logUrl'), (newLogUrl) => { isLoading.value = true; logs.value = ''; currentLogPosition.value = 0; stop(); if (null !== newLogUrl) { updateInterval = setInterval(updateLogs, 2500); updateLogs(); } }, {immediate: true}); const getContents = () => { return logs.value; }; defineExpose({ getContents }); </script> ```
/content/code_sandbox/frontend/components/Common/StreamingLogView.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
514
```vue <template> <modal id="logs_modal" ref="$modal" size="xl" :title="$gettext('Log Viewer')" no-enforce-focus @hidden="clearContents" > <template v-if="logUrl"> <streaming-log-view v-if="isStreaming" ref="$logView" :log-url="logUrl" /> <fixed-log-view v-else ref="$logView" :log-url="logUrl" /> </template> <template #modal-footer> <button class="btn btn-secondary" type="button" @click="hide" > {{ $gettext('Close') }} </button> <button class="btn btn-primary btn_copy" type="button" @click.prevent="doCopy" > {{ $gettext('Copy to Clipboard') }} </button> </template> </modal> </template> <script setup lang="ts"> import StreamingLogView from "~/components/Common/StreamingLogView.vue"; import {ref} from "vue"; import {useClipboard} from "@vueuse/core"; import Modal from "~/components/Common/Modal.vue"; import FixedLogView from "~/components/Common/FixedLogView.vue"; import {ModalTemplateRef, useHasModal} from "~/functions/useHasModal.ts"; const logUrl = ref(''); const isStreaming = ref(true); const $modal = ref<ModalTemplateRef>(null); const {show: showModal, hide} = useHasModal($modal); const $logView = ref<InstanceType<typeof StreamingLogView | typeof FixedLogView> | null>(null); const show = (newLogUrl, newIsStreaming = true) => { logUrl.value = newLogUrl; isStreaming.value = newIsStreaming; showModal(); }; const clipboard = useClipboard(); const doCopy = () => { clipboard.copy($logView.value?.getContents()); }; const clearContents = () => { logUrl.value = ''; } defineExpose({ show }) </script> ```
/content/code_sandbox/frontend/components/Common/StreamingLogModal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
446
```vue <template> <vue-easy-lightbox :visible="visible" :imgs="imgs" @hide="hide" /> </template> <script setup lang="ts"> import VueEasyLightbox from "vue-easy-lightbox"; import {ref} from "vue"; const visible = ref(false); const imgs = ref([]); const show = (imageOrImages) => { imgs.value = imageOrImages; visible.value = true; } const hide = () => { visible.value = false; } defineExpose({ show, hide }); </script> ```
/content/code_sandbox/frontend/components/Common/Lightbox.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
124
```vue <template> <div :id="id" class="datatable-wrapper" > <div v-if="showToolbar" class="datatable-toolbar-top card-body" > <div class="row align-items-center"> <div v-if="showPagination" class="col-xl-6 col-lg-5 col-md-12 col-sm-12" > <pagination v-model:current-page="currentPage" :total="totalRows" :per-page="perPage" @change="onPageChange" /> </div> <div v-else class="col-xl-6 col-lg-5 col-md-12 col-sm-12" > &nbsp; </div> <div class="col-xl-6 col-lg-7 col-md-12 col-sm-12 d-flex my-2" > <div class="flex-fill"> <div class="input-group"> <span class="input-group-text"> <icon :icon="IconSearch" /> </span> <input v-model="searchPhrase" class="form-control" type="search" :placeholder="$gettext('Search')" > </div> </div> <div class="flex-shrink-1 ps-3"> <div class="btn-group actions"> <button type="button" data-bs-tooltip class="btn btn-secondary" data-bs-placement="left" :title="$gettext('Refresh rows')" @click="onClickRefresh" > <icon :icon="IconRefresh" /> </button> <div v-if="paginated" class="dropdown btn-group" role="group" > <button type="button" data-bs-tooltip class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-placement="left" :title="$gettext('Items per page')" > <span> {{ perPageLabel }} </span> <span class="caret" /> </button> <ul class="dropdown-menu"> <li v-for="pageOption in pageOptions" :key="pageOption" > <button type="button" class="dropdown-item" :class="(pageOption === perPage) ? 'active' : ''" @click="settings.perPage = pageOption" > {{ getPerPageLabel(pageOption) }} </button> </li> </ul> </div> <div v-if="selectFields" class="dropdown btn-group" role="group" > <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-placement="left" :title="$gettext('Display fields')" > <icon :icon="IconFilterList" /> <span class="caret" /> </button> <div class="dropdown-menu"> <div class="px-3 py-1"> <form-multi-check id="field_select" v-model="visibleFieldKeys" :options="selectableFieldOptions" stacked /> </div> </div> </div> </div> </div> </div> </div> </div> <div class="datatable-main" :class="[ responsiveClass ]" > <table class="table align-middle table-striped table-hover" :class="[ (selectable) ? 'table-selectable' : '' ]" > <caption v-if="slots.caption"> <slot name="caption" /> </caption> <thead> <tr> <th v-if="selectable" class="checkbox" > <label class="form-check"> <form-checkbox autocomplete="off" :model-value="isAllChecked" @update:model-value="checkAll" /> <span class="visually-hidden"> <template v-if="isAllChecked"> {{ $gettext('Unselect All Rows') }} </template> <template v-else> {{ $gettext('Select All Rows') }} </template> </span> </label> </th> <th v-for="(column) in visibleFields" :key="column.key+'header'" :class="[ column.class, (column.sortable) ? 'sortable' : '' ]" @click.stop="sort(column)" > <slot :name="'header('+column.key+')'" v-bind="column" > <div class="d-flex align-items-center"> {{ column.label }} <template v-if="column.sortable && sortField?.key === column.key"> <icon :icon="(sortOrder === 'asc') ? IconArrowDropDown : IconArrowDropUp" /> </template> </div> </slot> </th> </tr> </thead> <tbody> <template v-if="isLoading && hideOnLoading"> <tr> <td :colspan="columnCount" class="text-center p-5" > <div class="spinner-border" role="status" > <span class="visually-hidden">{{ $gettext('Loading') }}</span> </div> </td> </tr> </template> <template v-else-if="visibleItems.length === 0"> <tr> <td :colspan="columnCount"> <slot name="empty"> {{ $gettext('No records.') }} </slot> </td> </tr> </template> <template v-for="(row, index) in visibleItems" v-else :key="index" > <tr :class="[ isActiveDetailRow(row) ? 'table-active' : '' ]" > <td v-if="selectable" class="checkbox" > <label class="form-check"> <form-checkbox autocomplete="off" :model-value="isRowChecked(row)" @update:model-value="checkRow(row)" /> <span class="visually-hidden"> <template v-if="isRowChecked(row)"> {{ $gettext('Unselect Row') }} </template> <template v-else> {{ $gettext('Select Row') }} </template> </span> </label> </td> <td v-for="column in visibleFields" :key="column.key+':'+index" :class="column.class" > <slot :name="'cell('+column.key+')'" :column="column" :item="row" :is-active="isActiveDetailRow(row)" :toggle-details="() => toggleDetails(row)" > {{ getColumnValue(column, row) }} </slot> </td> </tr> <tr v-if="isActiveDetailRow(row)" :key="index+':detail'" class="table-active" > <td :colspan="columnCount"> <slot name="detail" :item="row" :index="index" /> </td> </tr> </template> </tbody> </table> </div> <div v-if="showToolbar" class="datatable-toolbar-bottom card-body" > <pagination v-if="showPagination" v-model:current-page="currentPage" :total="totalRows" :per-page="perPage" @change="onPageChange" /> </div> </div> </template> <script setup lang="ts" generic="Row extends object"> import {filter, forEach, get, includes, indexOf, isEmpty, map, reverse, slice, some} from 'lodash'; import Icon from './Icon.vue'; import {computed, onMounted, ref, shallowRef, toRaw, toRef, useSlots, watch} from "vue"; import {watchDebounced} from "@vueuse/core"; import {useAxios} from "~/vendor/axios"; import FormMultiCheck from "~/components/Form/FormMultiCheck.vue"; import FormCheckbox from "~/components/Form/FormCheckbox.vue"; import Pagination from "~/components/Common/Pagination.vue"; import useOptionalStorage from "~/functions/useOptionalStorage"; import {IconArrowDropDown, IconArrowDropUp, IconFilterList, IconRefresh, IconSearch} from "~/components/Common/icons"; import {useAzuraCast} from "~/vendor/azuracast.ts"; export interface DataTableProps { id?: string, fields: DataTableField[], apiUrl?: string, // URL to fetch for server-side data items?: Row[], // Array of items for client-side data responsive?: boolean | string, // Make table responsive (boolean or CSS class for specific responsiveness width) paginated?: boolean, // Enable pagination. loading?: boolean, // Pass to override the "loading" property for this table. hideOnLoading?: boolean, // Replace the table contents with a loading animation when data is being retrieved. showToolbar?: boolean, // Show the header "Toolbar" with search, refresh, per-page, etc. pageOptions?: number[], defaultPerPage?: number, selectable?: boolean, // Allow selecting individual rows with checkboxes at the side of each row detailed?: boolean, // Allow showing "Detail" panel for selected rows. selectFields?: boolean, // Allow selecting which columns are visible. handleClientSide?: boolean, // Handle searching, sorting and pagination client-side without API calls. requestConfig?(config: object): object, // Custom server-side request configuration (pre-request) requestProcess?(rawData: object[]): Row[], // Custom server-side request result processing (post-request) } const props = withDefaults(defineProps<DataTableProps>(), { id: null, apiUrl: null, items: null, responsive: () => true, paginated: false, loading: false, hideOnLoading: true, showToolbar: true, pageOptions: () => [10, 25, 50, 100, 250, 500, 0], defaultPerPage: 10, selectable: false, detailed: false, selectFields: false, handleClientSide: false, requestConfig: undefined, requestProcess: undefined }); const slots = useSlots(); const emit = defineEmits([ 'refresh-clicked', 'refreshed', 'row-selected', 'filtered', 'data-loaded' ]); const selectedRows = shallowRef<Row[]>([]); watch(selectedRows, (newRows: Row[]) => { emit('row-selected', newRows); }); const searchPhrase = ref<string>(''); const currentPage = ref<number>(1); const flushCache = ref<boolean>(false); const sortField = ref<DataTableField | null>(null); const sortOrder = ref<string | null>(null); const isLoading = ref<boolean>(false); watch(toRef(props, 'loading'), (newLoading: boolean) => { isLoading.value = newLoading; }); const visibleItems = shallowRef<Row[]>([]); const totalRows = ref(0); const activeDetailsRow = shallowRef<Row>(null); export interface DataTableField { key: string, label: string, isRowHeader?: boolean, sortable?: boolean, selectable?: boolean, visible?: boolean, class?: string | Array<any>, formatter?(column: any, key: string, row: Row): string, sorter?(row: Row): string } const allFields = computed<DataTableField[]>(() => { return map(props.fields, (field: DataTableField) => { return { label: '', isRowHeader: false, sortable: false, selectable: false, visible: true, class: null, formatter: null, sorter: (row: Row): string => get(row, field.key), ...field }; }); }); const selectableFields = computed<DataTableField[]>(() => { return filter({...allFields.value}, (field) => { return field.selectable; }); }); const selectableFieldOptions = computed(() => map(selectableFields.value, (field) => { return { value: field.key, text: field.label }; })); const defaultSelectableFields = computed(() => { return filter({...selectableFields.value}, (field) => { return field.visible; }); }); const settings = useOptionalStorage( 'datatable_' + props.id + '_settings', { sortBy: null, sortDesc: false, perPage: props.defaultPerPage, visibleFieldKeys: map(defaultSelectableFields.value, (field) => field.key), }, { mergeDefaults: true } ); const visibleFieldKeys = computed({ get: () => { const settingsKeys = toRaw(settings.value.visibleFieldKeys); if (!isEmpty(settingsKeys)) { return settingsKeys; } return map(defaultSelectableFields.value, (field) => field.key); }, set: (newValue) => { if (isEmpty(newValue)) { newValue = map(defaultSelectableFields.value, (field) => field.key); } settings.value.visibleFieldKeys = newValue; } }); const perPage = computed<number>(() => { if (!props.paginated) { return -1; } return settings.value?.perPage ?? props.defaultPerPage; }); const visibleFields = computed<DataTableField[]>(() => { const fields = allFields.value.slice(); if (!props.selectFields) { return fields; } const visibleFieldsKeysValue = visibleFieldKeys.value; return filter(fields, (field) => { if (!field.selectable) { return true; } return includes(visibleFieldsKeysValue, field.key); }); }); const getPerPageLabel = (num): string => { return (num === 0) ? 'All' : num.toString(); }; const perPageLabel = computed<string>(() => { return getPerPageLabel(perPage.value); }); const showPagination = computed<boolean>(() => { return props.paginated && perPage.value !== 0; }); const {localeShort} = useAzuraCast(); const refreshClientSide = () => { // Handle filtration client-side. let itemsOnPage = filter(toRaw(props.items), (item) => Object.entries(item).filter((item) => { const [key, val] = item; if (!val || key[0] === '_') { return false; } const itemValue = typeof val === 'object' ? JSON.stringify(Object.values(val)) : typeof val === 'string' ? val : val.toString(); return itemValue.toLowerCase().includes(searchPhrase.value.toLowerCase()) }).length > 0 ); totalRows.value = itemsOnPage.length; // Handle sorting client-side. if (sortField.value) { const collator = new Intl.Collator(localeShort, {numeric: true, sensitivity: 'base'}); itemsOnPage = itemsOnPage.sort( (a, b) => collator.compare( sortField.value.sorter(a), sortField.value.sorter(b) ) ); if (sortOrder.value === 'desc') { itemsOnPage = reverse(itemsOnPage); } } // Handle pagination client-side. if (props.paginated && perPage.value > 0) { itemsOnPage = slice( itemsOnPage, (currentPage.value - 1) * perPage.value, currentPage.value * perPage.value ); } visibleItems.value = itemsOnPage; emit('refreshed'); }; watch(toRef(props, 'items'), () => { if (props.handleClientSide) { refreshClientSide(); } }, { immediate: true }); const {axios} = useAxios(); const refreshServerSide = () => { const queryParams: { [key: string]: any } = { internal: true }; if (props.handleClientSide) { queryParams.rowCount = 0; } else { if (props.paginated) { queryParams.rowCount = perPage.value; queryParams.current = (perPage.value !== 0) ? currentPage.value : 1; } else { queryParams.rowCount = 0; } if (flushCache.value) { queryParams.flushCache = true; } if (searchPhrase.value !== '') { queryParams.searchPhrase = searchPhrase.value; } if (null !== sortField.value) { queryParams.sort = sortField.value.key; queryParams.sortOrder = (sortOrder.value === 'desc') ? 'DESC' : 'ASC'; } } let requestConfig = {params: queryParams}; if (typeof props.requestConfig === 'function') { requestConfig = props.requestConfig(requestConfig); } isLoading.value = true; return axios.get(props.apiUrl, requestConfig).then((resp) => { totalRows.value = resp.data.total; let rows = resp.data.rows; if (typeof props.requestProcess === 'function') { rows = props.requestProcess(rows); } emit('data-loaded', rows); visibleItems.value = rows; }).catch((err) => { totalRows.value = 0; console.error(err.response.data.message); }).finally(() => { isLoading.value = false; flushCache.value = false; emit('refreshed'); }); } const refresh = () => { selectedRows.value = []; activeDetailsRow.value = null; if (props.handleClientSide) { refreshClientSide(); } else { refreshServerSide(); } }; const onPageChange = (p) => { currentPage.value = p; refresh(); } const relist = () => { flushCache.value = true; refresh(); }; const onClickRefresh = (e) => { emit('refresh-clicked', e); if (e.shiftKey) { relist(); } else { refresh(); } }; const navigate = () => { searchPhrase.value = ''; currentPage.value = 1; relist(); }; const setFilter = (newTerm) => { searchPhrase.value = newTerm; }; watch(perPage, () => { currentPage.value = 1; relist(); }); watchDebounced(searchPhrase, (newSearchPhrase) => { currentPage.value = 1; relist(); emit('filtered', newSearchPhrase); }, { debounce: 500, maxWait: 1000 }); onMounted(refresh); const isAllChecked = computed<boolean>(() => { if (visibleItems.value.length === 0) { return false; } return !some(visibleItems.value, (currentVisibleRow) => { return indexOf(selectedRows.value, currentVisibleRow) < 0; }); }); const isRowChecked = (row: Row) => { return indexOf(selectedRows.value, row) >= 0; }; const columnCount = computed(() => { let count = visibleFields.value.length; count += props.selectable ? 1 : 0; return count }); const sort = (column: DataTableField) => { if (!column.sortable) { return; } if (sortField.value?.key === column.key && sortOrder.value === 'desc') { sortOrder.value = null; sortField.value = null; } else { sortOrder.value = (sortField.value?.key === column.key) ? 'desc' : 'asc'; sortField.value = column; } refresh(); }; const checkRow = (row: Row) => { const newSelectedRows = selectedRows.value.slice(); if (isRowChecked(row)) { const index = indexOf(newSelectedRows, row); if (index >= 0) { newSelectedRows.splice(index, 1); } } else { newSelectedRows.push(row); } selectedRows.value = newSelectedRows; } const checkAll = () => { const newSelectedRows = []; if (!isAllChecked.value) { forEach(visibleItems.value, (currentRow) => { newSelectedRows.push(currentRow); }); } selectedRows.value = newSelectedRows; }; const isActiveDetailRow = (row: Row) => { return activeDetailsRow.value === row; }; const toggleDetails = (row: Row) => { activeDetailsRow.value = isActiveDetailRow(row) ? null : row; }; const responsiveClass = computed(() => { if (typeof props.responsive === 'string') { return props.responsive; } return (props.responsive ? 'table-responsive' : ''); }); const getColumnValue = (field: DataTableField, row: Row): string => { const columnValue = get(row, field.key, null); return (field.formatter) ? field.formatter(columnValue, field.key, row) : columnValue; } defineExpose({ refresh, relist, navigate, setFilter, toggleDetails }); </script> ```
/content/code_sandbox/frontend/components/Common/DataTable.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
4,610
```vue <template> <Teleport to="body"> <div v-bind="$attrs" ref="$modal" class="modal fade" tabindex="-1" :aria-label="title" :class="'modal-'+size" aria-hidden="true" > <div class="modal-dialog"> <div v-if="isActive" class="modal-content" > <div v-if="slots['modal-header'] || title" class="modal-header" > <h1 v-if="title" class="modal-title fs-5" > {{ title }} </h1> <slot name="modal-header" /> <button type="button" class="btn-close" :aria-label="$gettext('Close')" @click.prevent="hide" /> </div> <div class="modal-body"> <loading :loading="busy"> <slot name="default" /> </loading> </div> <div v-if="slots['modal-footer']" class="modal-footer" > <slot name="modal-footer" /> </div> </div> </div> </div> </Teleport> </template> <script setup lang="ts"> import Modal from 'bootstrap/js/src/modal'; import {onMounted, ref, useSlots, watch} from 'vue'; import Loading from "~/components/Common/Loading.vue"; import {useEventListener} from "@vueuse/core"; const slots = useSlots(); const props = defineProps({ active: { type: Boolean, default: false }, busy: { type: Boolean, default: false }, size: { type: String, default: 'md' }, title: { type: String, default: null } }); const emit = defineEmits([ 'shown', 'hidden', 'update:active' ]); const isActive = ref(props.active); watch(isActive, (newActive) => { emit('update:active', newActive); }); let bsModal = null; const $modal = ref<HTMLDivElement | null>(null); onMounted(() => { bsModal = new Modal($modal.value); }); useEventListener( $modal, 'hide.bs.modal', () => { isActive.value = false; } ); useEventListener( $modal, 'show.bs.modal', () => { isActive.value = true; } ); useEventListener( $modal, 'hidden.bs.modal', () => { emit('hidden'); } ); useEventListener( $modal, 'shown.bs.modal', () => { emit('shown'); } ); const show = () => { bsModal?.show(); }; const hide = () => { bsModal?.hide(); }; defineExpose({ show, hide }); </script> ```
/content/code_sandbox/frontend/components/Common/Modal.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
630
```vue <template> <audio v-if="isPlaying" ref="$audio" :title="title" /> </template> <script setup lang="ts"> import getLogarithmicVolume from '~/functions/getLogarithmicVolume'; import Hls from 'hls.js'; import {computed, nextTick, onMounted, onScopeDispose, ref, toRef, watch} from "vue"; import {usePlayerStore} from "~/functions/usePlayerStore.ts"; import {watchThrottled} from "@vueuse/core"; const props = defineProps({ title: { type: String, default: null }, volume: { type: Number, default: 55 }, isMuted: { type: Boolean, default: false } }); const emit = defineEmits([ 'update:duration', 'update:currentTime', 'update:progress' ]); const $audio = ref(null); const hls = ref(null); const duration = ref(0); const currentTime = ref(0); const {isPlaying, current, stop: storeStop} = usePlayerStore(); const bc = ref<BroadcastChannel | null>(null); watch(toRef(props, 'volume'), (newVol) => { if ($audio.value !== null) { $audio.value.volume = getLogarithmicVolume(newVol); } }); watch(toRef(props, 'isMuted'), (newMuted) => { if ($audio.value !== null) { $audio.value.muted = newMuted; } }); const stop = () => { if ($audio.value !== null) { $audio.value.pause(); $audio.value.src = ''; } if (hls.value !== null) { hls.value.destroy(); hls.value = null; } duration.value = 0; currentTime.value = 0; isPlaying.value = false; }; const play = () => { if (isPlaying.value) { stop(); nextTick(() => { play(); }); return; } isPlaying.value = true; nextTick(() => { // Handle audio errors. $audio.value.onerror = (e) => { if (e.target.error.code === e.target.error.MEDIA_ERR_NETWORK && $audio.value.src !== '') { console.log('Network interrupted stream. Automatically reconnecting shortly...'); setTimeout(() => { play(); }, 5000); } }; $audio.value.onended = () => { stop(); }; $audio.value.ontimeupdate = () => { const audioDuration = $audio.value?.duration ?? 0; duration.value = (audioDuration !== Infinity && !isNaN(audioDuration)) ? audioDuration : 0; currentTime.value = $audio.value?.currentTime ?? null; }; $audio.value.volume = getLogarithmicVolume(props.volume); $audio.value.muted = props.isMuted; if (current.value.isHls) { // HLS playback support if (Hls.isSupported()) { hls.value = new Hls(); hls.value.loadSource(current.value.url); hls.value.attachMedia($audio.value); } else if ($audio.value.canPlayType('application/vnd.apple.mpegurl')) { $audio.value.src = current.value.url; } else { console.log('Your browser does not support HLS.'); } } else { // Standard streams $audio.value.src = current.value.url; // Firefox caches the downloaded stream, this causes playback issues. // Giving the browser a new url on each start bypasses the old cache/buffer if (navigator.userAgent.includes("Firefox")) { $audio.value.src += "?refresh=" + Date.now(); } } $audio.value.load(); $audio.value.play(); if (bc.value) { bc.value.postMessage('played'); } }); }; watch(current, (newCurrent) => { if (newCurrent.url === null) { stop(); } else { play(); } }); watchThrottled( duration, (newValue) => { emit('update:duration', newValue); }, {throttle: 500} ); watchThrottled( currentTime, (newValue) => { emit('update:currentTime', newValue); }, {throttle: 500} ); const progress = computed(() => { return (duration.value !== 0) ? +((currentTime.value / duration.value) * 100).toFixed(2) : 0; }); watchThrottled( progress, (newValue) => { emit('update:progress', newValue); }, {throttle: 500} ); const setProgress = (progress: number) => { if ($audio.value !== null) { $audio.value.currentTime = (progress / 100) * duration.value; } }; onMounted(() => { // Allow pausing from the mobile metadata update. if ('mediaSession' in navigator) { navigator.mediaSession.setActionHandler('pause', () => { storeStop(); }); } if ('BroadcastChannel' in window) { bc.value = new BroadcastChannel('audio_player'); bc.value.addEventListener('message', () => { storeStop(); }, {passive: true}); } }); onScopeDispose(() => { if (bc.value) { bc.value.close() } }); defineExpose({ play, stop, setProgress }); </script> ```
/content/code_sandbox/frontend/components/Common/AudioPlayer.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,182
```vue <template> <div v-bind="$attrs" class="align-items-center justify-content-center p-4" :class="(loading) ? 'd-flex' : 'd-none'" > <div class="spinner-border me-3" role="status" aria-hidden="true" /> <strong>Loading...</strong> </div> <div v-if="!lazy || !loading" v-show="!loading" style="display: contents" > <slot name="default" /> </div> </template> <script setup lang="ts"> const props = defineProps({ loading: { type: Boolean, default: false }, lazy: { type: Boolean, default: false } }); </script> ```
/content/code_sandbox/frontend/components/Common/Loading.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
175
```vue <template> <div class="card-body alert alert-info d-flex flex-md-row flex-column align-items-center" role="alert" aria-live="off" > <div class="flex-shrink-0 me-2"> <icon :icon="IconInfo" /> </div> <div class="flex-fill"> <slot /> </div> <div v-if="slots.action" class="flex-shrink-0 ms-md-3 mt-3 mt-md-0" > <slot name="action" /> </div> </div> </template> <script setup lang="ts"> import Icon from './Icon.vue'; import {IconInfo} from "~/components/Common/icons"; const slots = defineSlots(); </script> ```
/content/code_sandbox/frontend/components/Common/InfoCard.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
169
```vue <template> <div class="toast align-items-center toast-notification mb-3" :class="'text-bg-'+variant" role="alert" aria-live="assertive" aria-atomic="true" > <template v-if="title"> <div v-if="title" class="toast-header" > <strong class="me-auto"> {{ title }} </strong> <button type="button" class="btn-close" data-bs-dismiss="toast" :aria-label="$gettext('Close')" /> </div> <div class="toast-body"> <slot> {{ message }} </slot> </div> </template> <template v-else> <div class="d-flex"> <div class="toast-body"> <slot> {{ message }} </slot> </div> <button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" :aria-label="$gettext('Close')" /> </div> </template> </div> </template> <script setup lang="ts"> const props = defineProps({ title: { type: String, default: null }, message: { type: String, required: true }, variant: { type: String, default: 'info' } }) </script> ```
/content/code_sandbox/frontend/components/Common/Toast.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
315
```vue <template> <button type="button" class="btn" :aria-label="muteLang" @click="toggleMute" > <icon :icon="muteIcon" /> </button> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import {computed, toRef, watch} from "vue"; import {useTranslate} from "~/vendor/gettext"; import {IconVolumeDown, IconVolumeOff, IconVolumeUp} from "~/components/Common/icons"; const props = defineProps({ volume: { type: Number, required: true }, isMuted: { type: Boolean, required: true } }); const emit = defineEmits(['toggleMute']); watch(toRef(props, 'volume'), (newVol) => { const newMuted = (newVol === 0); if (props.isMuted !== newMuted) { emit('toggleMute'); } }); const {$gettext} = useTranslate(); const toggleMute = () => { emit('toggleMute'); }; const muteLang = computed(() => { return (props.isMuted) ? $gettext('Unmute') : $gettext('Mute') }); const muteIcon = computed(() => { if (props.isMuted) { return IconVolumeOff; } if (props.volume < 60) { return IconVolumeDown; } return IconVolumeUp; }); </script> ```
/content/code_sandbox/frontend/components/Common/MuteButton.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
325
```vue <template> <full-calendar ref="calendar" :options="calendarOptions" /> </template> <script setup lang="ts"> import FullCalendar from '@fullcalendar/vue3'; import allLocales from '@fullcalendar/core/locales-all'; import luxon3Plugin from '@fullcalendar/luxon3'; import timeGridPlugin from '@fullcalendar/timegrid'; import {shallowRef} from "vue"; import {useAzuraCast} from "~/vendor/azuracast"; const props = defineProps({ timezone: { type: String, required: true }, scheduleUrl: { type: String, required: true } }); const emit = defineEmits(['click']); const onEventClick = (arg) => { emit('click', arg.event); }; const {localeShort, timeConfig} = useAzuraCast(); const calendarOptions = shallowRef({ locale: localeShort, locales: allLocales, plugins: [luxon3Plugin, timeGridPlugin], initialView: 'timeGridWeek', timeZone: props.timezone, nowIndicator: true, defaultTimedEventDuration: '00:20', headerToolbar: false, footerToolbar: false, height: 'auto', events: props.scheduleUrl, eventClick: onEventClick, views: { timeGridWeek: { slotLabelFormat: { ...timeConfig, hour: 'numeric', minute: '2-digit', omitZeroMinute: true, meridiem: 'short' } } } }); </script> ```
/content/code_sandbox/frontend/components/Common/ScheduleView.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
346
```vue <template> <li class="page-item" :class="[ (active) ? 'active' : '', (disabled) ? 'disabled' : '' ]" > <a v-if="!disabled" class="page-link" href="#" @click.prevent="onClick" > {{ label ?? page }} </a> <span v-else class="page-link" > {{ label ?? page }} </span> </li> </template> <script setup lang="ts"> const props = defineProps({ page: { type: Number, default: 1 }, label: { type: String, default: null }, active: { type: Boolean, default: false }, disabled: { type: Boolean, default: false } }); const emit = defineEmits(['click']); const onClick = () => { emit('click', props.page); } </script> ```
/content/code_sandbox/frontend/components/Common/PaginationItem.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
223
```vue <template> <div class="waveform-controls"> <div class="row"> <div class="col-md-12"> <div id="waveform_container"> <div id="waveform-timeline" /> <div id="waveform" /> </div> </div> </div> <div class="row mt-3 align-items-center"> <div class="col-md-7"> <div class="d-flex"> <div class="flex-shrink-0"> <label for="waveform-zoom"> {{ $gettext('Waveform Zoom') }} </label> </div> <div class="flex-fill mx-3"> <input id="waveform-zoom" v-model.number="zoom" type="range" min="0" max="256" class="w-100" > </div> </div> </div> <div class="col-md-5"> <div class="inline-volume-controls d-flex align-items-center"> <div class="flex-shrink-0"> <button type="button" class="btn btn-sm btn-outline-inverse" :title="$gettext('Mute')" @click="volume = 0" > <icon :icon="IconVolumeOff" /> </button> </div> <div class="flex-fill mx-1"> <input v-model.number="volume" type="range" :title="$gettext('Volume')" class="player-volume-range form-range w-100" min="0" max="100" step="1" > </div> <div class="flex-shrink-0"> <button type="button" class="btn btn-sm btn-outline-inverse" :title="$gettext('Full Volume')" @click="volume = 100" > <icon :icon="IconVolumeUp" /> </button> </div> </div> </div> </div> </div> </template> <script setup lang="ts"> import WS from 'wavesurfer.js'; import timeline from 'wavesurfer.js/dist/plugins/timeline.js'; import regions from 'wavesurfer.js/dist/plugins/regions.js'; import getLogarithmicVolume from '~/functions/getLogarithmicVolume'; import Icon from './Icon.vue'; import {onMounted, onUnmounted, ref, watch} from "vue"; import {useAxios} from "~/vendor/axios"; import usePlayerVolume from "~/functions/usePlayerVolume"; import {IconVolumeOff, IconVolumeUp} from "~/components/Common/icons"; const props = defineProps({ audioUrl: { type: String, required: true }, waveformUrl: { type: String, required: true }, waveformCacheUrl: { type: String, default: null } }); const emit = defineEmits(['ready']); let wavesurfer = null; let wsRegions = null; const volume = usePlayerVolume(); const zoom = ref(0); watch(zoom, (val) => { wavesurfer?.zoom(val); }); watch(volume, (val) => { wavesurfer?.setVolume(getLogarithmicVolume(val)); }); const isExternalJson = ref(false); const {axiosSilent} = useAxios(); const cacheWaveformRemotely = () => { if (props.waveformCacheUrl === null) { return; } const decodedData = wavesurfer?.getDecodedData() ?? null; const peaks = wavesurfer?.exportPeaks() ?? null; if (decodedData === null || peaks === null) { return; } const dataToCache = { source: 'wavesurfer', channels: decodedData.numberOfChannels, sample_rate: decodedData.sampleRate, length: decodedData.length, data: peaks }; axiosSilent.post(props.waveformCacheUrl, dataToCache); }; onMounted(() => { wavesurfer = WS.create({ container: '#waveform_container', waveColor: '#2196f3', progressColor: '#4081CF', }); wavesurfer.registerPlugin(timeline.create({ primaryColor: '#222', secondaryColor: '#888', primaryFontColor: '#222', secondaryFontColor: '#888' })); wsRegions = wavesurfer.registerPlugin(regions.create({ regions: [] })); wavesurfer.on('ready', () => { wavesurfer.setVolume(getLogarithmicVolume(volume.value)); if (!isExternalJson.value) { cacheWaveformRemotely(); } emit('ready'); }); axiosSilent.get(props.waveformUrl).then((resp) => { const waveformJson = resp?.data?.data ?? null; if (waveformJson) { isExternalJson.value = true; wavesurfer.load(props.audioUrl, waveformJson); } else { isExternalJson.value = false; wavesurfer.load(props.audioUrl); } }).catch(() => { isExternalJson.value = false; wavesurfer.load(props.audioUrl); }); }); onUnmounted(() => { wavesurfer = null; }); const play = () => { wavesurfer?.play(); }; const stop = () => { wavesurfer?.pause(); }; const getCurrentTime = () => { return wavesurfer?.getCurrentTime(); }; const getDuration = () => { return wavesurfer?.getDuration(); } const addRegion = (start, end, color) => { wsRegions?.addRegion( { start: start, end: end, resize: false, drag: false, color: color } ); }; const clearRegions = () => { wsRegions?.clearRegions(); } defineExpose({ play, stop, getCurrentTime, getDuration, addRegion, clearRegions }) </script> <style lang="scss"> #waveform_container { border: 1px solid var(--bs-tertiary-bg); border-radius: 4px; } </style> ```
/content/code_sandbox/frontend/components/Common/Waveform.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,345
```vue <template> <div class="list-group list-group-flush"> <a v-for="log in logs" :key="log.key" class="list-group-item list-group-item-action log-item" href="#" @click.prevent="viewLog(log.links.self, log.tail)" > <span class="log-name">{{ log.name }}</span><br> <small class="text-secondary">{{ log.path }}</small> </a> </div> </template> <script setup lang="ts"> import {useAsyncState} from "@vueuse/core"; import {useAxios} from "~/vendor/axios"; const props = defineProps({ url: { type: String, required: true }, }); const emit = defineEmits(['view']); const {axios} = useAxios(); const {state: logs} = useAsyncState( () => axios.get(props.url).then((r) => r.data.logs), [] ); const viewLog = (url, isStreaming) => { emit('view', url, isStreaming); }; </script> ```
/content/code_sandbox/frontend/components/Common/LogList.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
235
```vue <template> <section class="card" role="region" :aria-labelledby="headerId" > <div class="card-header text-bg-primary"> <slot :id="headerId" name="header" > <h2 :id="headerId" class="card-title" > {{ title }} </h2> </slot> </div> <info-card v-if="slots.info"> <slot name="info" /> </info-card> <div v-if="slots.actions" class="card-body buttons" > <slot name="actions" /> </div> <slot /> <div v-if="slots.footer_actions" class="card-body buttons" > <slot name="footer_actions" /> </div> </section> </template> <script setup lang="ts"> import InfoCard from "~/components/Common/InfoCard.vue"; const props = defineProps({ title: { type: String, default: null }, headerId: { type: String, default: "card_hdr" } }) const slots = defineSlots(); </script> ```
/content/code_sandbox/frontend/components/Common/CardPage.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
263
```vue <template> <nav class="nav nav-default" :class="navTabsClass" role="tablist" aria-orientation="horizontal" > <div v-for="(childItem) in state.tabs" :key="childItem.computedId" class="nav-item" > <button :id="`${childItem.computedId}-tab`" class="nav-link" :class="[ (activeId === childItem.computedId) ? 'active' : '', childItem.itemHeaderClass ]" role="tab" :aria-controls="`${childItem.computedId}-content`" type="button" :aria-selected="(activeId === childItem.computedId) ? 'true' : 'false'" @click="selectTab(childItem.computedId)" > {{ childItem.label }} </button> </div> </nav> <section class="nav-content" :class="contentClass" > <slot /> </section> </template> <script setup lang="ts"> import {onMounted, ref} from "vue"; import {useTabParent} from "~/functions/tabs.ts"; const props = defineProps({ modelValue: { type: String, default: null }, navTabsClass: { type: [String, Function, Array], default: () => 'nav-tabs' }, contentClass: { type: [String, Function, Array], default: () => 'mt-3' }, destroyOnHide: { type: Boolean, default: false } }); const emit = defineEmits(['update:modelValue']); const activeId = ref(props.modelValue); const state = useTabParent(props); const selectTab = (computedId: string): void => { state.active = computedId; activeId.value = computedId; emit('update:modelValue', computedId); } onMounted(() => { if (!state.tabs.length) { return; } selectTab(state.tabs[0].computedId); }); </script> ```
/content/code_sandbox/frontend/components/Common/Tabs.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
462
```vue <template> <a v-if="src" v-lightbox :href="src" class="album-art" target="_blank" data-fancybox="gallery" :aria-label="$gettext('Enlarge Album Art')" :title="$gettext('Enlarge Album Art')" > <img class="album_art" :src="src" loading="lazy" alt="" > </a> </template> <script setup lang="ts"> import {computed} from "vue"; import {useLightbox} from "~/vendor/lightbox"; const props = defineProps({ src: { type: String, required: true }, width: { type: Number, default: 40 } }); const widthPx = computed(() => { return props.width + 'px'; }); // Use lightbox if available; if not, just ignore. const {vLightbox} = useLightbox(); </script> <style scoped> img.album_art { width: v-bind(widthPx); height: auto; border-radius: 5px; } </style> ```
/content/code_sandbox/frontend/components/Common/AlbumArt.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
241
```vue <template> <input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;" tabindex="-1" aria-hidden="true" > </template> ```
/content/code_sandbox/frontend/components/Common/InvisibleSubmitButton.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
55
```vue <template> <div class="card-body alert-danger d-flex align-items-center" role="alert" > <div class="flex-shrink-0 me-2"> <icon :icon="IconError" /> </div> <div class="flex-fill"> <slot /> </div> </div> </template> <script setup lang="ts"> import Icon from './Icon.vue'; import {IconError} from "~/components/Common/icons";</script> ```
/content/code_sandbox/frontend/components/Common/ErrorCard.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
106
```vue <template> <button type="button" class="btn btn-primary" @click="emit('click')" > <icon :icon="IconAdd" /> <span>{{ text }}</span> </button> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import {IconAdd} from "~/components/Common/icons.ts"; const props = defineProps({ text: { type: String, required: true } }); const emit = defineEmits(['click']); </script> ```
/content/code_sandbox/frontend/components/Common/AddButton.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
118
```vue <template> <loading :loading="isLoading"> <div style="height: 300px; resize: vertical; overflow: auto !important;"> <code-mirror id="log-view-contents" v-model="logs" readonly basic :dark="isDark" /> </div> </loading> </template> <script setup lang="ts"> import {ref, toRef, watch} from "vue"; import {useAxios} from "~/vendor/axios"; import Loading from "~/components/Common/Loading.vue"; import CodeMirror from "vue-codemirror6"; import useTheme from "~/functions/theme"; const props = defineProps({ logUrl: { type: String, required: true, } }); const isLoading = ref(false); const logs = ref(''); const {isDark} = useTheme(); const {axios} = useAxios(); watch(toRef(props, 'logUrl'), (newLogUrl) => { isLoading.value = true; logs.value = ''; if (null !== newLogUrl) { axios({ method: 'GET', url: props.logUrl }).then((resp) => { if (resp.data.contents !== '') { logs.value = resp.data.contents; } }).finally(() => { isLoading.value = false; }); } }, {immediate: true}); const getContents = () => { return logs.value; }; defineExpose({ getContents }); </script> ```
/content/code_sandbox/frontend/components/Common/FixedLogView.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
319
```vue <template> <input v-bind="$attrs" v-model="timeCode" class="form-control" type="time" pattern="[0-9]{2}:[0-9]{2}" placeholder="13:45" > </template> <script setup lang="ts"> import {computed} from "vue"; import {isEmpty, padStart} from 'lodash'; const props = defineProps({ modelValue: { type: String, default: null } }); const emit = defineEmits(['update:modelValue']); const parseTimeCode = (timeCode) => { if (timeCode !== '' && timeCode !== null) { timeCode = padStart(timeCode, 4, '0'); return timeCode.substring(0, 2) + ':' + timeCode.substring(2); } return null; } const convertToTimeCode = (time) => { if (isEmpty(time)) { return null; } const timeParts = time.split(':'); return (100 * parseInt(timeParts[0], 10)) + parseInt(timeParts[1], 10); } const timeCode = computed({ get: () => { return parseTimeCode(props.modelValue); }, set: (newValue) => { emit('update:modelValue', convertToTimeCode(newValue)); } }); </script> ```
/content/code_sandbox/frontend/components/Common/TimeCode.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
295
```vue <template> <div v-if="isActive || !isLazy" v-show="isActive" :id="`${computedId}-content`" > <slot /> </div> </template> <script setup lang="ts"> import {useTabChild} from "~/functions/tabs.ts"; const props = defineProps({ id: { type: [String, Number], default: null }, label: { type: String, required: true }, itemHeaderClass: { type: [String, Function, Array], default: () => null } }); const {computedId, isActive, isLazy} = useTabChild(props); </script> ```
/content/code_sandbox/frontend/components/Common/Tab.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
153
```vue <template> <a v-if="'' !== serviceUrl" :href="serviceUrl" class="avatar" target="_blank" :title="langAvatar" :aria-label="$gettext('Manage Avatar')" > <img :src="url" :style="{ width: width+'px', height: 'auto' }" alt="" > </a> </template> <script setup lang="ts"> import {useTranslate} from "~/vendor/gettext"; import {computed} from "vue"; const props = defineProps({ url: { type: String, required: true }, service: { type: String, default: null }, serviceUrl: { type: String, default: null }, width: { type: Number, default: 64 } }); const {$gettext} = useTranslate(); const langAvatar = computed(() => { return $gettext( 'Avatars are retrieved based on your e-mail address from the %{ service } service. Click to manage your %{ service } settings.', { service: props.service ?? '' } ); }); </script> ```
/content/code_sandbox/frontend/components/Common/Avatar.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
256
```vue <template> <div class="flow-upload"> <div class="upload-progress"> <template v-for="(file, key) in files.value" :key="key" > <div v-if="file.isVisible" :id="'file_upload_' + file.uniqueIdentifier" class="uploading-file pt-1" :class="{ 'text-success': file.isCompleted, 'text-danger': file.error }" > <h6 class="fileuploadname m-0"> {{ file.name }} </h6> <div v-if="!file.isCompleted" class="progress h-20 my-1" > <div class="progress-bar h-20" role="progressbar" :style="{width: file.progressPercent+'%'}" :aria-valuenow="file.progressPercent" aria-valuemin="0" aria-valuemax="100" /> </div> <div v-if="file.error" class="upload-status" > {{ file.error }} </div> <div class="size"> {{ file.size }} </div> </div> </template> </div> <div ref="$fileDropTarget" class="file-drop-target" > {{ $gettext('Drag file(s) here to upload or') }} <button ref="$fileBrowseTarget" type="button" class="file-upload btn btn-primary text-center ms-1" > <icon :icon="IconUpload" /> <span> {{ $gettext('Select File') }} </span> </button> <small class="file-name" /> <input type="file" :accept="validMimeTypesList" :multiple="allowMultiple" style="visibility: hidden; position: absolute;" > </div> </div> </template> <script setup lang="ts"> import formatFileSize from '~/functions/formatFileSize'; import Icon from './Icon.vue'; import {defaultsDeep, forEach, toInteger} from 'lodash'; import {computed, onMounted, onUnmounted, reactive, ref} from "vue"; import Flow from "@flowjs/flow.js"; import {useAzuraCast} from "~/vendor/azuracast"; import {useTranslate} from "~/vendor/gettext"; import {IconUpload} from "~/components/Common/icons"; const props = defineProps({ targetUrl: { type: String, required: true }, allowMultiple: { type: Boolean, default: false }, validMimeTypes: { type: Array, default() { return ['*']; } }, flowConfiguration: { type: Object, default() { return {}; } } }); interface FlowFile { uniqueIdentifier: string, isVisible: boolean, name: string, isCompleted: boolean, progressPercent: number, error?: string, size: string } interface OriginalFlowFile { uniqueIdentifier: string, name: string, size: number, progress(): number } const emit = defineEmits(['complete', 'success', 'error']); const validMimeTypesList = computed(() => { return props.validMimeTypes.join(', '); }); let flow = null; const files = reactive<{ value: { [key: string]: FlowFile }, push(file: OriginalFlowFile): void, get(file: OriginalFlowFile): FlowFile, hideAll(): void, reset(): void }>({ value: {}, push(file: OriginalFlowFile): void { this.value[file.uniqueIdentifier] = { name: file.name, uniqueIdentifier: file.uniqueIdentifier, size: formatFileSize(file.size), isVisible: true, isCompleted: false, progressPercent: 0, error: null }; }, get(file: OriginalFlowFile): FlowFile { return this.value[file.uniqueIdentifier] ?? {}; }, hideAll() { forEach(this.value, (file: FlowFile) => { file.isVisible = false; }); }, reset() { this.value = {}; } }); const $fileBrowseTarget = ref<HTMLButtonElement | null>(null); const $fileDropTarget = ref<HTMLDivElement | null>(null); const {apiCsrf} = useAzuraCast(); const {$gettext} = useTranslate(); onMounted(() => { const defaultConfig = { target: () => { return props.targetUrl }, singleFile: !props.allowMultiple, headers: { 'Accept': 'application/json', 'X-API-CSRF': apiCsrf }, withCredentials: true, allowDuplicateUploads: true, fileParameterName: 'file_data', uploadMethod: 'POST', testMethod: 'GET', method: 'multipart', maxChunkRetries: 3, testChunks: false }; const config = defaultsDeep({}, props.flowConfiguration, defaultConfig); flow = new Flow(config); flow.assignBrowse($fileBrowseTarget.value); flow.assignDrop($fileDropTarget.value); flow.on('fileAdded', (file: OriginalFlowFile) => { files.push(file); return true; }); flow.on('filesSubmitted', () => { flow.upload(); }); flow.on('fileProgress', (file: OriginalFlowFile) => { files.get(file).progressPercent = toInteger(file.progress() * 100); }); flow.on('fileSuccess', (file: OriginalFlowFile, message) => { files.get(file).isCompleted = true; const messageJson = JSON.parse(message); emit('success', file, messageJson); }); flow.on('error', (message, file: OriginalFlowFile, chunk) => { console.error(message, file, chunk); let messageText = $gettext('Could not upload file.'); try { if (typeof message !== 'undefined') { const messageJson = JSON.parse(message); if (typeof messageJson.message !== 'undefined') { messageText = messageJson.message; if (messageText.indexOf(': ') > -1) { messageText = messageText.split(': ')[1]; } } } } catch (e) { // Noop } files.get(file).error = messageText; emit('error', file, messageText); }); flow.on('complete', () => { setTimeout(() => { files.hideAll(); }, 2000); emit('complete'); }); }); onUnmounted(() => { flow = null; files.reset(); }); </script> <style lang="scss"> div.flow-upload { div.upload-progress { padding: 4px 0; & > div { padding: 3px 0; } .error { color: #a00; } .progress { margin-bottom: 5px; .progress-bar { border-bottom-width: 10px; &::after { height: 10px; } } } } div.file-drop-target { padding: 25px 0; text-align: center; input { display: inline; } } } </style> ```
/content/code_sandbox/frontend/components/Common/FlowUpload.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,586
```vue <template> <vue-date-picker v-model="dateRange" :dark="isDark" range :partial-range="false" :preset-dates="ranges" :min-date="minDate" :max-date="maxDate" :locale="localeWithDashes" :select-text="$gettext('Select')" :cancel-text="$gettext('Cancel')" :now-button-label="$gettext('Now')" :timezone="tz" :clearable="false" > <template #dp-input="{ value }"> <button type="button" class="btn btn-dark dropdown-toggle" > <icon :icon="IconDateRange" /> <span> {{ value }} </span> </button> </template> </vue-date-picker> </template> <script setup lang="ts"> import VueDatePicker from '@vuepic/vue-datepicker'; import Icon from "./Icon.vue"; import useTheme from "~/functions/theme"; import {useTranslate} from "~/vendor/gettext"; import {computed} from "vue"; import {useAzuraCast} from "~/vendor/azuracast"; import {useLuxon} from "~/vendor/luxon"; import {IconDateRange} from "~/components/Common/icons"; defineOptions({ inheritAttrs: false }); const props = defineProps({ tz: { type: String, default: null }, minDate: { type: [String, Date], default() { return null } }, maxDate: { type: [String, Date], default() { return null } }, timePicker: { type: Boolean, default: false, }, modelValue: { type: Object, required: true } }); const emit = defineEmits(['update:modelValue']); const {isDark} = useTheme(); const {localeWithDashes} = useAzuraCast(); const {DateTime} = useLuxon(); const dateRange = computed({ get() { return [ props.modelValue?.startDate ?? null, props.modelValue?.endDate ?? null, ] }, set(newValue) { const newRange = { startDate: newValue[0], endDate: newValue[1] }; emit('update:modelValue', newRange); } }); const {$gettext} = useTranslate(); const ranges = computed(() => { const nowTz = DateTime.now().setZone(props.tz); const nowAtMidnightDate = nowTz.endOf('day').toJSDate(); return [ { label: $gettext('Last 24 Hours'), value: [ nowTz.minus({days: 1}).toJSDate(), nowTz.toJSDate() ] }, { label: $gettext('Today'), value: [ nowTz.minus({days: 1}).startOf('day').toJSDate(), nowAtMidnightDate ] }, { label: $gettext('Yesterday'), value: [ nowTz.minus({days: 2}).startOf('day').toJSDate(), nowTz.minus({days: 1}).endOf('day').toJSDate() ] }, { label: $gettext('Last 7 Days'), value: [ nowTz.minus({days: 7}).startOf('day').toJSDate(), nowAtMidnightDate ] }, { label: $gettext('Last 14 Days'), value: [ nowTz.minus({days: 14}).startOf('day').toJSDate(), nowAtMidnightDate ] }, { label: $gettext('Last 30 Days'), value: [ nowTz.minus({days: 30}).startOf('day').toJSDate(), nowAtMidnightDate ] }, { label: $gettext('This Month'), value: [ nowTz.startOf('month').startOf('day').toJSDate(), nowTz.endOf('month').endOf('day').toJSDate() ] }, { label: $gettext('Last Month'), value: [ nowTz.minus({months: 1}).startOf('month').startOf('day').toJSDate(), nowTz.minus({months: 1}).endOf('month').endOf('day').toJSDate() ] } ]; }); </script> ```
/content/code_sandbox/frontend/components/Common/DateRangeDropdown.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
988
```vue <template> <div :id="id" class="datatable-wrapper" > <div v-if="showToolbar" class="datatable-toolbar-top card-body" > <pagination v-model:current-page="currentPage" :total="totalRows" :per-page="perPage" @change="onPageChange" /> </div> <div class="grid-main card-body"> <template v-if="isLoading && hideOnLoading"> <div class="spinner-border" role="status" > <span class="visually-hidden">{{ $gettext('Loading') }}</span> </div> </template> <template v-else-if="visibleItems.length === 0"> <slot name="empty"> {{ $gettext('No records.') }} </slot> </template> <div v-else class="row view-group" > <div v-for="(row, index) in visibleItems" :key="index" class="item col-sm-6 col-lg-4" > <slot name="item" :item="row" /> </div> </div> </div> <div v-if="showToolbar" class="datatable-toolbar-bottom card-body" > <pagination v-if="showPagination" v-model:current-page="currentPage" :total="totalRows" :per-page="perPage" @change="onPageChange" /> </div> </div> </template> <script setup lang="ts" generic="Row extends object"> import Pagination from "~/components/Common/Pagination.vue"; import {useAxios} from "~/vendor/axios.ts"; import {computed, onMounted, ref, shallowRef, toRef, watch} from "vue"; import useOptionalStorage from "~/functions/useOptionalStorage.ts"; export interface GridLayoutProps { id?: string, apiUrl?: string, // URL to fetch for server-side data paginated?: boolean, // Enable pagination. loading?: boolean, // Pass to override the "loading" property for this grid. hideOnLoading?: boolean, // Replace the contents with a loading animation when data is being retrieved. showToolbar?: boolean, // Show the header "Toolbar" with search, refresh, per-page, etc. pageOptions?: number[], defaultPerPage?: number, } const props = withDefaults(defineProps<GridLayoutProps>(), { id: null, apiUrl: null, paginated: false, loading: false, hideOnLoading: true, showToolbar: true, pageOptions: () => [10, 25, 50, 100, 250, 500, 0], defaultPerPage: 10, }); const emit = defineEmits([ 'refreshed', 'data-loaded' ]); const currentPage = ref<number>(1); const flushCache = ref<boolean>(false); const isLoading = ref<boolean>(false); watch(toRef(props, 'loading'), (newLoading: boolean) => { isLoading.value = newLoading; }); const visibleItems = shallowRef<Row[]>([]); const totalRows = ref(0); const settings = useOptionalStorage( 'grid_' + props.id + '_settings', { perPage: props.defaultPerPage, }, { mergeDefaults: true } ); const perPage = computed<number>(() => { if (!props.paginated) { return -1; } return settings.value?.perPage ?? props.defaultPerPage; }); const showPagination = computed<boolean>(() => { return props.paginated && perPage.value !== 0; }); const {axios} = useAxios(); const refresh = () => { const queryParams: { [key: string]: any } = { internal: true }; if (props.paginated) { queryParams.rowCount = perPage.value; queryParams.current = (perPage.value !== 0) ? currentPage.value : 1; } else { queryParams.rowCount = 0; } if (flushCache.value) { queryParams.flushCache = true; } isLoading.value = true; return axios.get(props.apiUrl, {params: queryParams}).then((resp) => { totalRows.value = resp.data.total; const rows = resp.data.rows; emit('data-loaded', rows); visibleItems.value = rows; }).catch((err) => { totalRows.value = 0; console.error(err.response.data.message); }).finally(() => { isLoading.value = false; flushCache.value = false; emit('refreshed'); }); } const onPageChange = (p) => { currentPage.value = p; refresh(); } const relist = () => { flushCache.value = true; refresh(); }; watch(perPage, () => { currentPage.value = 1; relist(); }); onMounted(refresh); defineExpose({ refresh, relist, }); </script> ```
/content/code_sandbox/frontend/components/Common/GridLayout.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,080
```vue <template> <code-mirror v-model="textValue" basic :lang="lang" :dark="isDark" /> </template> <script setup lang="ts"> import CodeMirror from "vue-codemirror6"; import {useVModel} from "@vueuse/core"; import {computed} from "vue"; import {css} from "@codemirror/lang-css"; import {javascript} from "@codemirror/lang-javascript"; import {html} from "@codemirror/lang-html"; import {liquidsoap} from "codemirror-lang-liquidsoap"; import useTheme from "~/functions/theme"; const props = defineProps<{ modelValue: string | null, mode: string }>(); const emit = defineEmits(['update:modelValue']); const textValue = useVModel(props, 'modelValue', emit); const lang = computed(() => { switch (props.mode) { case 'css': return css(); case 'javascript': return javascript(); case 'html': return html(); case 'liquidsoap': return liquidsoap(); default: return null; } }); const {isDark} = useTheme(); </script> ```
/content/code_sandbox/frontend/components/Common/CodemirrorTextarea.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
256
```vue <template> <button ref="btn" type="button" class="btn btn-copy btn-link btn-xs" :aria-label="$gettext('Copy to Clipboard')" @click.prevent="doCopy" > <icon class="sm" :icon="IconCopy" /> <span v-if="!hideText">{{ copyText }}</span> </button> </template> <script setup lang="ts"> import Icon from "~/components/Common/Icon.vue"; import {refAutoReset, useClipboard} from "@vueuse/core"; import {useTranslate} from "~/vendor/gettext"; import {IconCopy} from "~/components/Common/icons"; const props = defineProps({ text: { type: String, required: true, }, hideText: { type: Boolean, default: false } }); const {$gettext} = useTranslate(); const copyText = refAutoReset( $gettext('Copy to Clipboard'), 1000 ); const clipboard = useClipboard({legacy: true}); const doCopy = () => { clipboard.copy(props.text); copyText.value = $gettext('Copied!'); }; </script> ```
/content/code_sandbox/frontend/components/Common/CopyToClipboardButton.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
251
```vue <template> <template v-for="(row, index) in alt" :key="'chart_alt_'+index" > <p>{{ row.label }}</p> <dl> <template v-for="(valrow, valindex) in row.values" :key="'chart_alt_'+index+'_val_'+valindex" > <dt> <template v-if="valrow.type === 'time'"> <time :data-original="valrow.original">{{ valrow.label }}</time> </template> <template v-else> {{ valrow.label }} </template> </dt> <dd> {{ valrow.value }} </dd> </template> </dl> </template> </template> <script setup lang="ts"> const props = defineProps({ alt: { type: Array, default: () => { return []; } } }); </script> ```
/content/code_sandbox/frontend/components/Common/Charts/ChartAltValues.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
204
```vue <template> <canvas ref="$canvas"> <slot> <chart-alt-values v-if="alt.length > 0" :alt="alt" /> </slot> </canvas> </template> <script setup lang="ts"> import {useTranslate} from "~/vendor/gettext"; import {ref} from "vue"; import ChartAltValues from "~/components/Common/Charts/ChartAltValues.vue"; import useChart, {chartProps, ChartTemplateRef} from "~/functions/useChart"; const props = defineProps({ ...chartProps, labels: { type: Array, default: () => { return []; } } }); const $canvas = ref<ChartTemplateRef>(null); const {$gettext} = useTranslate(); useChart( props, $canvas, { type: 'bar', options: { aspectRatio: props.aspectRatio, scales: { x: { scaleLabel: { display: true, labelString: $gettext('Hour') } }, y: { scaleLabel: { display: true, labelString: $gettext('Listeners') }, ticks: { min: 0 } } } } } ); </script> ```
/content/code_sandbox/frontend/components/Common/Charts/HourChart.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
273
```vue <template> <form-group v-bind="$attrs" :id="id" > <template v-if="label || slots.label" #label="slotProps" > <form-label :is-required="isRequired" :advanced="advanced" > <slot name="label" v-bind="slotProps" > {{ label }} </slot> </form-label> </template> <template #default> <form-multi-check :id="id" v-model="radioField" :name="name || id" :options="bitrateOptions" radio stacked > <template v-for="(_, slot) of useSlotsExcept(['default', 'label', 'description'])" #[slot]="scope" > <slot :name="slot" v-bind="scope" /> </template> <template #label(custom)> {{ $gettext('Custom') }} <input :id="id+'_custom'" v-model="customField" class="form-control form-control-sm" type="number" min="1" max="4096" step="1" > </template> </form-multi-check> </template> <template v-if="description || slots.description" #description="slotProps" > <slot v-bind="slotProps" name="description" > {{ description }} </slot> </template> </form-group> </template> <script setup lang="ts"> import {formFieldProps, useFormField} from "~/components/Form/useFormField"; import {computed, ComputedRef, useSlots} from "vue"; import {includes, map} from "lodash"; import useSlotsExcept from "~/functions/useSlotsExcept.ts"; import FormMultiCheck from "~/components/Form/FormMultiCheck.vue"; import FormLabel from "~/components/Form/FormLabel.vue"; import FormGroup from "~/components/Form/FormGroup.vue"; const props = defineProps({ ...formFieldProps, id: { type: String, required: true }, name: { type: String, default: null, }, label: { type: String, default: null }, description: { type: String, default: null }, advanced: { type: Boolean, default: false } }); const slots = useSlots(); const emit = defineEmits(['update:modelValue']); const {model} = useFormField(props, emit); const radioBitrates = [ 32, 48, 64, 96, 128, 192, 256, 320 ]; const customField: ComputedRef<number | null> = computed({ get() { return includes(radioBitrates, model.value) ? '' : model.value; }, set(newValue) { model.value = newValue; } }); const radioField: ComputedRef<number | string | null> = computed({ get() { return includes(radioBitrates, model.value) ? model.value : 'custom'; }, set(newValue) { if (newValue !== 'custom') { model.value = newValue; } } }); const bitrateOptions = map( radioBitrates, (val) => { return { value: val, text: val }; } ); bitrateOptions.push({ value: 'custom', text: 'Custom' }); </script> ```
/content/code_sandbox/frontend/components/Common/BitrateOptions.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
767
```vue <template> <canvas ref="$canvas"> <slot> <chart-alt-values v-if="alt.length > 0" :alt="alt" /> </slot> </canvas> </template> <script setup lang="ts"> import {ref} from "vue"; import ChartAltValues from "~/components/Common/Charts/ChartAltValues.vue"; import useChart, {chartProps, ChartTemplateRef} from "~/functions/useChart"; const props = defineProps({ ...chartProps, labels: { type: Array, default: () => { return []; } } }); const $canvas = ref<ChartTemplateRef>(null); useChart( props, $canvas, { type: 'pie', options: { aspectRatio: props.aspectRatio, } } ); </script> ```
/content/code_sandbox/frontend/components/Common/Charts/PieChart.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
182
```vue <template> <small class="badge rounded-pill ms-2" :class="badgeClass" >{{ badgeText }}</small> </template> <script setup lang="ts"> import {computed} from "vue"; import {useGettext} from "vue3-gettext"; const props = defineProps({ enabled: { type: Boolean, required: true } }); const badgeClass = computed(() => { return (props.enabled) ? 'text-bg-success' : 'text-bg-danger'; }); const {$gettext} = useGettext(); const badgeText = computed(() => { return (props.enabled) ? $gettext('Enabled') : $gettext('Disabled'); }); </script> ```
/content/code_sandbox/frontend/components/Common/Badges/EnabledBadge.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
156
```vue <template> <canvas ref="$canvas"> <slot> <chart-alt-values v-if="alt.length > 0" :alt="alt" /> </slot> </canvas> </template> <script setup lang="ts"> import {computed, ref} from "vue"; import {useTranslate} from "~/vendor/gettext"; import ChartAltValues from "~/components/Common/Charts/ChartAltValues.vue"; import useChart, {chartProps, ChartTemplateRef} from "~/functions/useChart"; import {useLuxon} from "~/vendor/luxon"; const props = defineProps({ ...chartProps, tz: { type: String, default: 'UTC' } }); const $canvas = ref<ChartTemplateRef>(null); const {$gettext} = useTranslate(); const {DateTime} = useLuxon(); useChart( props, $canvas, computed(() => ({ type: 'line', options: { aspectRatio: props.aspectRatio, datasets: { line: { spanGaps: true, showLine: true } }, plugins: { zoom: { // Container for pan options pan: { enabled: true, mode: 'x' } } }, scales: { x: { type: 'time', distribution: 'linear', display: true, min: DateTime.local({zone: props.tz}).minus({days: 30}).toJSDate(), max: DateTime.local({zone: props.tz}).toJSDate(), adapters: { date: { setZone: true, zone: props.tz } }, time: { unit: 'day', tooltipFormat: DateTime.DATE_SHORT, }, ticks: { source: 'data', autoSkip: true } }, y: { display: true, scaleLabel: { display: true, labelString: $gettext('Listeners') }, ticks: { min: 0 } } }, tooltips: { intersect: false, mode: 'index', callbacks: { label: function (tooltipItem, myData) { let label = myData.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } label += parseFloat(tooltipItem.value).toFixed(2); return label; } } } } })) ); </script> ```
/content/code_sandbox/frontend/components/Common/Charts/TimeSeriesChart.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
542
```vue <template> <small class="badge rounded-pill ms-2" :class="badgeClass" >{{ badgeText }}</small> </template> <script setup lang="ts"> import {computed} from "vue"; import {useGettext} from "vue3-gettext"; const props = defineProps({ running: { type: Boolean, required: true } }); const badgeClass = computed(() => { return (props.running) ? 'text-bg-success' : 'text-bg-danger'; }); const {$gettext} = useGettext(); const badgeText = computed(() => { return (props.running) ? $gettext('Running') : $gettext('Not Running'); }); </script> ```
/content/code_sandbox/frontend/components/Common/Badges/RunningBadge.vue
vue
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
157
```php <?php declare(strict_types=1); use App\AppFactory; error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); ini_set('display_errors', '1'); require dirname(__DIR__) . '/vendor/autoload.php'; $app = AppFactory::createApp(); $app->run(); ```
/content/code_sandbox/web/index.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
61
```yaml openapi: 3.0.0 info: title: AzuraCast description: 'AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more.' license: name: 'Apache 2.0' url: 'path_to_url version: 0.20.2 servers: - url: 'path_to_url description: 'AzuraCast Public Demo Server' paths: /admin/custom_fields: get: tags: - 'Administration: Custom Fields' description: 'List all current custom fields in the system.' operationId: getCustomFields responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/CustomField' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Administration: Custom Fields' description: 'Create a new custom field.' operationId: addCustomField requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomField' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/CustomField' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/admin/custom_field/{id}': get: tags: - 'Administration: Custom Fields' description: 'Retrieve details for a single custom field.' operationId: getCustomField parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/CustomField' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Custom Fields' description: 'Update details of a single custom field.' operationId: editCustomField parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomField' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Administration: Custom Fields' description: 'Delete a single custom field.' operationId: deleteCustomField parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/permissions: get: tags: - 'Administration: Roles' description: 'Return a list of all available permissions.' operationId: getPermissions responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/roles: get: tags: - 'Administration: Roles' description: 'List all current roles in the system.' operationId: getRoles responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Role' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Administration: Roles' description: 'Create a new role.' operationId: addRole requestBody: content: application/json: schema: $ref: '#/components/schemas/Role' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Role' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/admin/role/{id}': get: tags: - 'Administration: Roles' description: 'Retrieve details for a single current role.' operationId: getRole parameters: - name: id in: path description: 'Role ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Role' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Roles' description: 'Update details of a single role.' operationId: editRole parameters: - name: id in: path description: 'Role ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/Role' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Administration: Roles' description: 'Delete a single role.' operationId: deleteRole parameters: - name: id in: path description: 'Role ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/server/stats: get: tags: - 'Administration: CPU stats' description: 'Return a list of all CPU usage stats.' operationId: getServerStats responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/settings: get: tags: - 'Administration: Settings' description: 'List the current values of all editable system settings.' operationId: getSettings responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Settings' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Settings' description: 'Update settings to modify any settings provided.' operationId: editSettings requestBody: content: application/json: schema: $ref: '#/components/schemas/Settings' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/stations: get: tags: - 'Administration: Stations' description: 'List all current stations in the system.' operationId: adminGetStations responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Station' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Administration: Stations' description: 'Create a new station.' operationId: adminAddStation requestBody: content: application/json: schema: $ref: '#/components/schemas/Station' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Station' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/admin/station/{id}': get: tags: - 'Administration: Stations' description: 'Retrieve details for a single station.' operationId: adminGetStation parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Station' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Stations' description: 'Update details of a single station.' operationId: adminEditStation parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/Station' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Administration: Stations' description: 'Delete a single station.' operationId: adminDeleteStation parameters: - name: id in: path description: ID required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/storage_locations: get: tags: - 'Administration: Storage Locations' description: 'List all current storage locations in the system.' operationId: getStorageLocations responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_Admin_StorageLocation' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Administration: Storage Locations' description: 'Create a new storage location.' operationId: addStorageLocation requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_Admin_StorageLocation' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Admin_StorageLocation' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/admin/storage_location/{id}': get: tags: - 'Administration: Storage Locations' description: 'Retrieve details for a single storage location.' operationId: getStorageLocation parameters: - name: id in: path description: 'User ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Admin_StorageLocation' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Storage Locations' description: 'Update details of a single storage location.' operationId: editStorageLocation parameters: - name: id in: path description: 'Storage Location ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_Admin_StorageLocation' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Administration: Storage Locations' description: 'Delete a single storage location.' operationId: deleteStorageLocation parameters: - name: id in: path description: 'Storage Location ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /admin/users: get: tags: - 'Administration: Users' description: 'List all current users in the system.' operationId: getUsers responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/User' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Administration: Users' description: 'Create a new user.' operationId: addUser requestBody: content: application/json: schema: $ref: '#/components/schemas/User' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/User' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/admin/user/{id}': get: tags: - 'Administration: Users' description: 'Retrieve details for a single current user.' operationId: getUser parameters: - name: id in: path description: 'User ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/User' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Administration: Users' description: 'Update details of a single user.' operationId: editUser parameters: - name: id in: path description: 'User ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/User' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Administration: Users' description: 'Delete a single user.' operationId: deleteUser parameters: - name: id in: path description: 'User ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /status: get: tags: - Miscellaneous description: 'Returns an affirmative response if the API is active.' operationId: getStatus responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_SystemStatus' /time: get: tags: - Miscellaneous description: "Returns the time (with formatting) in GMT and the user's local time zone, if logged in." operationId: getTime responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Time' /internal/relays: get: tags: - 'Administration: Relays' description: "Returns all necessary information to relay all 'relayable' stations." operationId: internalGetRelayDetails responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_Admin_Relay' /nowplaying: get: tags: - 'Now Playing' description: "Returns a full summary of all stations' current state." operationId: getAllNowPlaying responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_NowPlaying' '/nowplaying/{station_id}': get: tags: - 'Now Playing' description: "Returns a full summary of the specified station's current state." operationId: getStationNowPlaying parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_NowPlaying' '404': $ref: '#/components/responses/RecordNotFound' '/station/{station_id}/art/{media_id}': get: tags: - 'Stations: Media' description: 'Returns the album art for a song, or a generic image.' operationId: getMediaArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: media_id in: path description: 'The station media unique ID' required: true schema: type: string responses: '200': description: 'The requested album artwork' '404': description: 'Image not found; generic filler image.' post: tags: - 'Stations: Media' description: 'Sets the album art for a track.' operationId: postMediaArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: media_id in: path description: 'Media ID' required: true schema: anyOf: - type: integer format: int64 - type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Media' description: 'Removes the album art for a track.' operationId: deleteMediaArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: media_id in: path description: 'Media ID' required: true schema: anyOf: - type: integer format: int64 - type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/fallback': get: tags: - 'Stations: General' description: 'Get the custom fallback track for a station.' operationId: getStationFallback parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: General' description: 'Update the custom fallback track for the station.' operationId: postStationFallback parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: General' description: 'Removes the custom fallback track for a station.' operationId: deleteStationFallback parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/files': get: tags: - 'Stations: Media' description: 'List all current uploaded files.' operationId: getFiles parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_StationMedia' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Media' description: 'Upload a new file.' operationId: addFile parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_UploadFile' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationMedia' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/file/{id}': get: tags: - 'Stations: Media' description: 'Retrieve details for a single file.' operationId: getFile parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Media ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationMedia' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Media' description: 'Update details of a single file.' operationId: editFile parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Media ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_StationMedia' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Media' description: 'Delete a single file.' operationId: deleteFile parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Media ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/history': get: tags: - 'Stations: History' description: 'Return song playback history items for a given station.' operationId: getStationHistory parameters: - $ref: '#/components/parameters/StationIdRequired' - name: start in: query description: 'The start date for records, in PHP-supported date/time format. (path_to_url required: false schema: type: string - name: end in: query description: 'The end date for records, in PHP-supported date/time format. (path_to_url required: false schema: type: string responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_DetailedSongHistory' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/hls_streams': get: tags: - 'Stations: HLS Streams' description: 'List all current HLS streams.' operationId: getHlsStreams parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: HLS Streams' description: 'Create a new HLS stream.' operationId: addHlsStream parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/StationMount' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/hls_stream/{id}': get: tags: - 'Stations: HLS Streams' description: 'Retrieve details for a single HLS stream.' operationId: getHlsStream parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'HLS Stream ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: HLS Streams' description: 'Update details of a single HLS stream.' operationId: editHlsStream parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'HLS Stream ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/StationMount' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: HLS Streams' description: 'Delete a single HLS stream.' operationId: deleteHlsStream parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'HLS Stream ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] /stations: get: tags: - 'Stations: General' description: 'Returns a list of stations.' operationId: getStations responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_NowPlaying_Station' '/station/{station_id}': get: tags: - 'Stations: General' description: 'Return information about a single station.' operationId: getStation parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_NowPlaying_Station' '404': $ref: '#/components/responses/RecordNotFound' '/station/{station_id}/listeners': get: tags: - 'Stations: Listeners' description: 'Return detailed information about current listeners.' operationId: getStationListeners parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_Listener' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/mount/{id}/intro': get: tags: - 'Stations: Mount Points' description: 'Get the intro track for a mount point.' operationId: getMountIntro parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Mount Point ID' required: true schema: type: integer format: int64 responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Mount Points' description: 'Update the intro track for a mount point.' operationId: postMountIntro parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Mount Point ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Mount Points' description: 'Removes the intro track for a mount point.' operationId: deleteMountIntro parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Mount Point ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/mounts': get: tags: - 'Stations: Mount Points' description: 'List all current mount points.' operationId: getStationMounts parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Mount Points' description: 'Create a new mount point.' operationId: addMount parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/StationMount' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/mount/{id}': get: tags: - 'Stations: Mount Points' description: 'Retrieve details for a single mount point.' operationId: getMount parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Streamer ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationMount' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Mount Points' description: 'Update details of a single mount point.' operationId: editMount parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Streamer ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/StationMount' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Mount Points' description: 'Delete a single mount point.' operationId: deleteMount parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'StationMount ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/playlists': get: tags: - 'Stations: Playlists' description: 'List all current playlists.' operationId: getPlaylists parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/StationPlaylist' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Playlists' description: 'Create a new playlist.' operationId: addPlaylist parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/StationPlaylist' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationPlaylist' '403': $ref: '#/components/responses/AccessDenied' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/playlist/{id}': get: tags: - 'Stations: Playlists' description: 'Retrieve details for a single playlist.' operationId: getPlaylist parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Playlist ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationPlaylist' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Playlists' description: 'Update details of a single playlist.' operationId: editPlaylist parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Playlist ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/StationPlaylist' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Playlists' description: 'Delete a single playlist relay.' operationId: deletePlaylist parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Playlist ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcast/{podcast_id}/episodes': get: tags: - 'Stations: Podcasts' description: 'List all current episodes for a given podcast ID.' operationId: getEpisodes parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_PodcastEpisode' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Podcasts' description: 'Create a new podcast episode.' operationId: addEpisode parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_PodcastEpisode' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_PodcastEpisode' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcast/{podcast_id}/episode/{id}': get: tags: - 'Stations: Podcasts' description: 'Retrieve details for a single podcast episode.' operationId: getEpisode parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_PodcastEpisode' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Podcasts' description: 'Update details of a single podcast episode.' operationId: editEpisode parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: id in: path description: 'Podcast Episode ID' required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_PodcastEpisode' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Podcasts' description: 'Delete a single podcast episode.' operationId: deleteEpisode parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcast/{podcast_id}/art': get: tags: - 'Stations: Podcasts' description: 'Gets the album art for a podcast.' operationId: getPodcastArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Podcasts' description: 'Sets the album art for a podcast.' operationId: postPodcastArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Podcasts' description: 'Removes the album art for a podcast.' operationId: deletePodcastArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcast/{podcast_id}/episode/{episode_id}/art': get: tags: - 'Stations: Podcasts' description: 'Gets the album art for a podcast episode.' operationId: getPodcastEpisodeArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Podcasts' description: 'Sets the album art for a podcast episode.' operationId: postPodcastEpisodeArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Podcasts' description: 'Removes the album art for a podcast episode.' operationId: deletePodcastEpisodeArt parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Status' '404': description: 'Record not found' content: application/json: schema: $ref: '#/components/schemas/Api_Error' '403': description: 'Access denied' content: application/json: schema: $ref: '#/components/schemas/Api_Error' security: - ApiKey: [] '/station/{station_id}/podcast/{podcast_id}/episode/{episode_id}/media': get: tags: - 'Stations: Podcasts' description: 'Gets the media for a podcast episode.' operationId: getPodcastEpisodeMedia parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Podcasts' description: 'Sets the media for a podcast episode.' operationId: postPodcastEpisodeMedia parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Podcasts' description: 'Removes the media for a podcast episode.' operationId: deletePodcastEpisodeMedia parameters: - $ref: '#/components/parameters/StationIdRequired' - name: podcast_id in: path description: 'Podcast ID' required: true schema: type: string - name: episode_id in: path description: 'Podcast Episode ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcasts': get: tags: - 'Stations: Podcasts' description: 'List all current podcasts.' operationId: getPodcasts parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_Podcast' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Podcasts' description: 'Create a new podcast.' operationId: addPodcast parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_Podcast' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Podcast' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/podcast/{id}': get: tags: - 'Stations: Podcasts' description: 'Retrieve details for a single podcast.' operationId: getPodcast parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Podcast' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Podcasts' description: 'Update details of a single podcast.' operationId: editPodcast parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Podcast ID' required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_Podcast' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Podcasts' description: 'Delete a single podcast.' operationId: deletePodcast parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Podcast ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/queue': get: tags: - 'Stations: Queue' description: 'Return information about the upcoming song playback queue.' operationId: getQueue parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_StationQueueDetailed' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/queue/{id}': get: tags: - 'Stations: Queue' description: 'Retrieve details of a single queued item.' operationId: getQueueItem parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Queue Item ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationQueueDetailed' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Queue' description: 'Delete a single queued item.' operationId: deleteQueueItem parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Queue Item ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/remotes': get: tags: - 'Stations: Remote Relays' description: 'List all current remote relays.' operationId: getRelays parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_StationRemote' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Remote Relays' description: 'Create a new remote relay.' operationId: addRelay parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_StationRemote' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationRemote' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/remote/{id}': get: tags: - 'Stations: Remote Relays' description: 'Retrieve details for a single remote relay.' operationId: getRelay parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Remote Relay ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationRemote' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Remote Relays' description: 'Update details of a single remote relay.' operationId: editRelay parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Remote Relay ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/Api_StationRemote' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Remote Relays' description: 'Delete a single remote relay.' operationId: deleteRelay parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Remote Relay ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/requests': get: tags: - 'Stations: Song Requests' description: 'Return a list of requestable songs.' operationId: getRequestableSongs parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_StationRequest' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' '/station/{station_id}/request/{request_id}': post: tags: - 'Stations: Song Requests' description: 'Submit a song request.' operationId: submitSongRequest parameters: - $ref: '#/components/parameters/StationIdRequired' - name: request_id in: path description: 'The requestable song ID' required: true schema: type: string responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' '/station/{station_id}/schedule': get: tags: - 'Stations: Schedules' description: 'Return upcoming and currently ongoing schedule entries.' operationId: getSchedule parameters: - $ref: '#/components/parameters/StationIdRequired' - name: now in: query description: 'The date/time to compare schedule items to. Defaults to the current date and time.' required: false schema: type: string - name: rows in: query description: 'The number of upcoming/ongoing schedule entries to return. Defaults to 5.' required: false schema: type: integer responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/Api_StationSchedule' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' '/station/{station_id}/status': get: tags: - 'Stations: Service Control' description: 'Retrieve the current status of all serivces associated with the radio broadcast.' operationId: getServiceStatus parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Api_StationServiceStatus' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/restart': post: tags: - 'Stations: Service Control' description: 'Restart all services associated with the radio broadcast.' operationId: restartServices parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/frontend/{action}': post: tags: - 'Stations: Service Control' description: 'Perform service control actions on the radio frontend (Icecast, Shoutcast, etc.)' operationId: doFrontendServiceAction parameters: - $ref: '#/components/parameters/StationIdRequired' - name: action in: path description: 'The action to perform (start, stop, restart)' required: true schema: type: string default: restart responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/backend/{action}': post: tags: - 'Stations: Service Control' description: 'Perform service control actions on the radio backend (Liquidsoap)' operationId: doBackendServiceAction parameters: - $ref: '#/components/parameters/StationIdRequired' - name: action in: path description: 'The action to perform (for all: start, stop, restart, skip, disconnect)' required: true schema: type: string default: restart responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/sftp-users': get: tags: - 'Stations: SFTP Users' description: 'List all current SFTP users.' operationId: getSftpUsers parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/SftpUser' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: SFTP Users' description: 'Create a new SFTP user.' operationId: addSftpUser parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/SftpUser' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/SftpUser' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/sftp-user/{id}': get: tags: - 'Stations: SFTP Users' description: 'Retrieve details for a single SFTP user.' operationId: getSftpUser parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'SFTP User ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/SftpUser' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: SFTP Users' description: 'Update details of a single SFTP user.' operationId: editSftpUser parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Remote Relay ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/SftpUser' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: SFTP Users' description: 'Delete a single remote relay.' operationId: deleteSftpUser parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Remote Relay ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/stereo-tool-configuration': get: tags: - 'Stations: Broadcasting' description: 'Get the Stereo Tool configuration file for a station.' operationId: getStereoToolConfiguration parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Broadcasting' description: 'Update the Stereo Tool configuration file for a station.' operationId: postStereoToolConfiguration parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Broadcasting' description: 'Removes the Stereo Tool configuration file for a station.' operationId: deleteStereoToolConfiguration parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/streamers': get: tags: - 'Stations: Streamers/DJs' description: 'List all current Streamer/DJ accounts for the specified station.' operationId: getStreamers parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/StationStreamer' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Streamers/DJs' description: 'Create a new Streamer/DJ account.' operationId: addStreamer parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/StationStreamer' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationStreamer' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/streamer/{id}': get: tags: - 'Stations: Streamers/DJs' description: 'Retrieve details for a single Streamer/DJ account.' operationId: getStreamer parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Streamer ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationStreamer' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Streamers/DJs' description: 'Update details of a single Streamer/DJ account.' operationId: editStreamer parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Streamer ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/StationStreamer' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Streamers/DJs' description: 'Delete a single Streamer/DJ account.' operationId: deleteStreamer parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'StationStreamer ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/webhooks': get: tags: - 'Stations: Web Hooks' description: 'List all current web hooks.' operationId: getWebhooks parameters: - $ref: '#/components/parameters/StationIdRequired' responses: '200': description: Success content: application/json: schema: type: array items: $ref: '#/components/schemas/StationWebhook' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] post: tags: - 'Stations: Web Hooks' description: 'Create a new web hook.' operationId: addWebhook parameters: - $ref: '#/components/parameters/StationIdRequired' requestBody: content: application/json: schema: $ref: '#/components/schemas/StationWebhook' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationWebhook' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] '/station/{station_id}/webhook/{id}': get: tags: - 'Stations: Web Hooks' description: 'Retrieve details for a single web hook.' operationId: getWebhook parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Web Hook ID' required: true schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/StationWebhook' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] put: tags: - 'Stations: Web Hooks' description: 'Update details of a single web hook.' operationId: editWebhook parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Web Hook ID' required: true schema: type: integer format: int64 requestBody: content: application/json: schema: $ref: '#/components/schemas/StationWebhook' responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] delete: tags: - 'Stations: Web Hooks' description: 'Delete a single web hook relay.' operationId: deleteWebhook parameters: - $ref: '#/components/parameters/StationIdRequired' - name: id in: path description: 'Web Hook ID' required: true schema: type: integer format: int64 responses: '200': $ref: '#/components/responses/Success' '403': $ref: '#/components/responses/AccessDenied' '404': $ref: '#/components/responses/RecordNotFound' '500': $ref: '#/components/responses/GenericError' security: - ApiKey: [] components: schemas: Api_Admin_Relay: properties: id: description: 'Station ID' type: integer example: 1 name: description: 'Station name' type: string example: 'AzuraTest Radio' nullable: true shortcode: description: 'Station "short code", used for URL and folder paths' type: string example: azuratest_radio nullable: true description: description: 'Station description' type: string example: 'An AzuraCast station!' nullable: true url: description: 'Station homepage URL' type: string example: 'path_to_url nullable: true genre: description: 'The genre of the station' type: string example: Variety nullable: true type: description: 'Which broadcasting software (frontend) the station uses' type: string example: shoutcast2 nullable: true port: description: 'The port used by this station to serve its broadcasts.' type: integer example: 8000 nullable: true relay_pw: description: 'The relay password for the frontend (if applicable).' type: string example: p4ssw0rd admin_pw: description: 'The administrator password for the frontend (if applicable).' type: string example: p4ssw0rd mounts: type: array items: $ref: '#/components/schemas/Api_NowPlaying_StationMount' type: object Api_Admin_StorageLocation: type: object allOf: - $ref: '#/components/schemas/HasLinks' - properties: id: type: integer example: 1 type: description: 'The type of storage location.' type: string example: station_media adapter: description: 'The storage adapter to use for this location.' type: string example: local path: description: 'The local path, if the local adapter is used, or path prefix for S3/remote adapters.' type: string example: /var/azuracast/stations/azuratest_radio/media nullable: true s3CredentialKey: description: 'The credential key for S3 adapters.' type: string example: your-key-here nullable: true s3CredentialSecret: description: 'The credential secret for S3 adapters.' type: string example: your-secret-here nullable: true s3Region: description: 'The region for S3 adapters.' type: string example: your-region nullable: true s3Version: description: 'The API version for S3 adapters.' type: string example: latest nullable: true s3Bucket: description: 'The S3 bucket name for S3 adapters.' type: string example: your-bucket-name nullable: true s3Endpoint: description: 'The optional custom S3 endpoint S3 adapters.' type: string example: 'path_to_url nullable: true dropboxAppKey: description: 'The optional Dropbox App Key.' type: string example: '' nullable: true dropboxAppSecret: description: 'The optional Dropbox App Secret.' type: string example: '' nullable: true dropboxAuthToken: description: 'The optional Dropbox Auth Token.' type: string example: '' nullable: true sftpHost: description: 'The host for SFTP adapters' type: string example: 127.0.0.1 nullable: true sftpUsername: description: 'The username for SFTP adapters' type: string example: root nullable: true sftpPassword: description: 'The password for SFTP adapters' type: string example: abc123 nullable: true sftpPort: description: 'The port for SFTP adapters' type: integer example: 20 nullable: true sftpPrivateKey: description: 'The private key for SFTP adapters' type: string nullable: true sftpPrivateKeyPassPhrase: description: 'The private key pass phrase for SFTP adapters' type: string nullable: true storageQuota: type: string example: '50 GB' nullable: true storageQuotaBytes: type: string example: '120000' nullable: true storageUsed: type: string example: '1 GB' nullable: true storageUsedBytes: type: string example: '60000' nullable: true storageAvailable: type: string example: '1 GB' nullable: true storageAvailableBytes: type: string example: '120000' nullable: true storageUsedPercent: type: integer example: '75' nullable: true isFull: type: boolean example: 'true' uri: description: 'The URI associated with the storage location.' type: string example: /var/azuracast/www stations: description: 'The stations using this storage location, if any.' type: array items: type: string example: 'AzuraTest Radio' nullable: true type: object Api_DetailedSongHistory: type: object allOf: - $ref: '#/components/schemas/Api_NowPlaying_SongHistory' - properties: listeners_start: description: 'Number of listeners when the song playback started.' type: integer example: 94 listeners_end: description: 'Number of listeners when song playback ended.' type: integer example: 105 delta_total: description: "The sum total change of listeners between the song's start and ending." type: integer example: 11 is_visible: description: 'Whether the entry is visible on public playlists.' type: boolean example: true type: object Api_Error: properties: code: description: 'The numeric code of the error.' type: integer example: 500 type: description: 'The programmatic class of error.' type: string example: NotLoggedInException message: description: 'The text description of the error.' type: string example: 'Error description.' formatted_message: description: 'The HTML-formatted text description of the error.' type: string example: '<b>Error description.</b><br>Detailed error text.' nullable: true extra_data: description: 'Stack traces and other supplemental data.' type: array items: { } success: description: 'Used for API calls that expect an \Entity\Api\Status type response.' type: boolean example: false type: object Api_FileList: type: object allOf: - $ref: '#/components/schemas/HasLinks' - properties: path: type: string path_short: type: string text: type: string type: $ref: '#/components/schemas/FileTypes' timestamp: type: integer size: type: integer nullable: true media: nullable: true oneOf: - $ref: '#/components/schemas/Api_StationMedia' dir: nullable: true oneOf: - $ref: '#/components/schemas/Api_FileListDir' type: object Api_FileListDir: properties: playlists: type: array items: { } type: object Api_Listener: properties: ip: description: "The listener's IP address" type: string example: 127.0.0.1 user_agent: description: "The listener's HTTP User-Agent" type: string example: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36' hash: description: 'A unique identifier for this listener/user agent (used for unique calculations).' type: string example: '' mount_is_local: description: 'Whether the user is connected to a local mount point or a remote one.' type: boolean example: false mount_name: description: 'The display name of the mount point.' type: string example: /radio.mp3 connected_on: description: 'UNIX timestamp that the user first connected.' type: integer example: 1609480800 connected_until: description: 'UNIX timestamp that the user disconnected (or the latest timestamp if they are still connected).' type: integer example: 1609480800 connected_time: description: 'Number of seconds that the user has been connected.' type: integer example: 30 device: $ref: '#/components/schemas/Api_ListenerDevice' location: $ref: '#/components/schemas/Api_ListenerLocation' type: object Api_ListenerDevice: properties: is_browser: description: 'If the listener device is likely a browser.' type: boolean example: true is_mobile: description: 'If the listener device is likely a mobile device.' type: boolean example: true is_bot: description: 'If the listener device is likely a crawler.' type: boolean example: true client: description: 'Summary of the listener client.' type: string example: 'Firefox 121.0, Windows' nullable: true browser_family: description: 'Summary of the listener browser family.' type: string example: Firefox nullable: true os_family: description: 'Summary of the listener OS family.' type: string example: Windows nullable: true type: object Api_ListenerLocation: properties: city: description: 'The approximate city of the listener.' type: string example: Austin nullable: true region: description: 'The approximate region/state of the listener.' type: string example: Texas nullable: true country: description: 'The approximate country of the listener.' type: string example: 'United States' nullable: true description: description: 'A description of the location.' type: string example: 'Austin, Texas, US' lat: description: Latitude. type: number format: float example: '30.000000' nullable: true lon: description: Latitude. type: number format: float example: '-97.000000' nullable: true type: object Api_NewRecord: type: object allOf: - $ref: '#/components/schemas/Api_Status' - properties: links: type: array items: type: string example: 'path_to_url type: object Api_NowPlaying_CurrentSong: type: object allOf: - $ref: '#/components/schemas/Api_NowPlaying_SongHistory' - properties: elapsed: description: "Elapsed time of the song's playback since it started." type: integer example: 25 remaining: description: 'Remaining time in the song, in seconds.' type: integer example: 155 type: object Api_NowPlaying_Listeners: properties: total: description: 'Total non-unique current listeners' type: integer example: 20 unique: description: 'Total unique current listeners' type: integer example: 15 current: description: 'Total non-unique current listeners (Legacy field, may be retired in the future.)' type: integer example: 20 type: object Api_NowPlaying_Live: properties: is_live: description: 'Whether the stream is known to currently have a live DJ.' type: boolean example: false streamer_name: description: 'The current active streamer/DJ, if one is available.' type: string example: 'DJ Jazzy Jeff' broadcast_start: description: 'The start timestamp of the current broadcast, if one is available.' type: integer example: '1591548318' nullable: true art: description: 'URL to the streamer artwork (if available).' example: 'path_to_url nullable: true type: object Api_NowPlaying: properties: station: $ref: '#/components/schemas/Api_NowPlaying_Station' listeners: $ref: '#/components/schemas/Api_NowPlaying_Listeners' live: $ref: '#/components/schemas/Api_NowPlaying_Live' now_playing: nullable: true oneOf: - $ref: '#/components/schemas/Api_NowPlaying_CurrentSong' playing_next: nullable: true oneOf: - $ref: '#/components/schemas/Api_NowPlaying_StationQueue' song_history: type: array items: $ref: '#/components/schemas/Api_NowPlaying_SongHistory' is_online: description: 'Whether the stream is currently online.' type: boolean example: true cache: description: 'Debugging information about where the now playing data comes from.' type: string enum: - hit - database - station nullable: true type: object Api_NowPlaying_SongHistory: properties: sh_id: description: 'Song history unique identifier' type: integer played_at: description: 'UNIX timestamp when playback started.' type: integer example: 1609480800 duration: description: 'Duration of the song in seconds' type: integer example: 180 playlist: description: 'Indicates the playlist that the song was played from, if available, or empty string if not.' type: string example: 'Top 100' nullable: true streamer: description: 'Indicates the current streamer that was connected, if available, or empty string if not.' type: string example: 'Test DJ' nullable: true is_request: description: 'Indicates whether the song is a listener request.' type: boolean song: $ref: '#/components/schemas/Api_Song' type: object Api_NowPlaying_Station: properties: id: description: 'Station ID' type: integer example: 1 name: description: 'Station name' type: string example: 'AzuraTest Radio' shortcode: description: 'Station "short code", used for URL and folder paths' type: string example: azuratest_radio description: description: 'Station description' type: string example: 'An AzuraCast station!' frontend: description: 'Which broadcasting software (frontend) the station uses' type: string example: shoutcast2 backend: description: 'Which AutoDJ software (backend) the station uses' type: string example: liquidsoap timezone: description: "The station's IANA time zone" type: string example: America/Chicago listen_url: description: 'The full URL to listen to the default mount of the station' example: 'path_to_url url: description: 'The public URL of the station.' type: string example: 'path_to_url nullable: true public_player_url: description: 'The public player URL for the station.' example: 'path_to_url playlist_pls_url: description: 'The playlist download URL in PLS format.' example: 'path_to_url playlist_m3u_url: description: 'The playlist download URL in M3U format.' example: 'path_to_url is_public: description: 'If the station is public (i.e. should be shown in listings of all stations)' type: boolean example: true mounts: type: array items: $ref: '#/components/schemas/Api_NowPlaying_StationMount' remotes: type: array items: $ref: '#/components/schemas/Api_NowPlaying_StationRemote' hls_enabled: description: 'If the station has HLS streaming enabled.' type: boolean example: true hls_is_default: description: 'If the HLS stream should be the default one for the station.' type: boolean example: true hls_url: description: 'The full URL to listen to the HLS stream for the station.' example: 'path_to_url nullable: true hls_listeners: description: 'HLS Listeners' type: integer example: 1 type: object Api_NowPlaying_StationMount: type: object allOf: - $ref: '#/components/schemas/Api_NowPlaying_StationRemote' - properties: path: description: 'The relative path that corresponds to this mount point' type: string example: /radio.mp3 is_default: description: 'If the mount is the default mount for the parent station' type: boolean example: true type: object Api_NowPlaying_StationQueue: properties: cued_at: description: 'UNIX timestamp when the AutoDJ is expected to queue the song for playback.' type: integer example: 1609480800 played_at: description: 'UNIX timestamp when playback is expected to start.' type: integer example: 1609480800 duration: description: 'Duration of the song in seconds' type: integer example: 180 playlist: description: 'Indicates the playlist that the song was played from, if available, or empty string if not.' type: string example: 'Top 100' nullable: true is_request: description: 'Indicates whether the song is a listener request.' type: boolean song: $ref: '#/components/schemas/Api_Song' type: object Api_NowPlaying_StationRemote: properties: id: description: 'Mount/Remote ID number.' type: integer example: 1 name: description: 'Mount point name/URL' type: string example: /radio.mp3 url: description: 'Full listening URL specific to this mount' example: 'path_to_url bitrate: description: 'Bitrate (kbps) of the broadcasted audio (if known)' type: integer example: 128 nullable: true format: description: 'Audio encoding format of broadcasted audio (if known)' type: string example: mp3 nullable: true listeners: $ref: '#/components/schemas/Api_NowPlaying_Listeners' type: object Api_Podcast: type: object allOf: - $ref: '#/components/schemas/HasLinks' - properties: id: type: string storage_location_id: type: integer source: type: string playlist_id: type: integer nullable: true playlist_auto_publish: type: boolean title: type: string link: type: string nullable: true description: type: string description_short: type: string is_enabled: type: boolean branding_config: description: 'An array containing podcast-specific branding configuration' type: array items: { } language: type: string language_name: type: string author: type: string email: type: string has_custom_art: type: boolean art: type: string art_updated_at: type: integer is_published: type: boolean episodes: type: integer categories: type: array items: $ref: '#/components/schemas/Api_PodcastCategory' type: object Api_PodcastCategory: properties: category: type: string text: type: string title: type: string subtitle: type: string nullable: true type: object Api_PodcastEpisode: type: object allOf: - $ref: '#/components/schemas/HasLinks' - properties: id: type: string title: type: string link: type: string nullable: true description: type: string description_short: type: string explicit: type: boolean season_number: type: integer nullable: true episode_number: type: integer nullable: true created_at: type: integer publish_at: type: integer is_published: type: boolean has_media: type: boolean playlist_media_id: type: string nullable: true playlist_media: nullable: true oneOf: - $ref: '#/components/schemas/Api_Song' media: nullable: true oneOf: - $ref: '#/components/schemas/Api_PodcastMedia' has_custom_art: type: boolean art: type: string nullable: true art_updated_at: type: integer type: object Api_PodcastMedia: properties: id: type: string nullable: true original_name: type: string nullable: true length: type: number format: float length_text: type: string nullable: true path: type: string nullable: true type: object Api_Song: type: object allOf: - $ref: '#/components/schemas/Api_HasSongFields' - properties: id: description: "The song's 32-character unique identifier hash" type: string example: 9f33bbc912c19603e51be8e0987d076b art: description: 'URL to the album artwork (if available).' example: 'path_to_url custom_fields: type: array items: type: string example: custom_field_value type: object Api_StationMedia: type: object allOf: - $ref: '#/components/schemas/Api_HasSongFields' - $ref: '#/components/schemas/HasLinks' - properties: id: description: "The media's identifier." type: integer example: 1 unique_id: description: 'A unique identifier associated with this record.' type: string example: 69b536afc7ebbf16457b8645 song_id: description: "The media file's 32-character unique song identifier hash" type: string example: 9f33bbc912c19603e51be8e0987d076b art: description: 'URL to the album art.' type: string example: 'path_to_url path: description: 'The relative path of the media file.' type: string example: test.mp3 mtime: description: 'The UNIX timestamp when the database was last modified.' type: integer example: 1609480800 uploaded_at: description: 'The UNIX timestamp when the item was first imported into the database.' type: integer example: 1609480800 art_updated_at: description: 'The latest time (UNIX timestamp) when album art was updated.' type: integer example: 1609480800 length: description: 'The song duration in seconds.' type: number format: float example: 240 length_text: description: 'The formatted song duration (in mm:ss format)' type: string example: '4:00' custom_fields: type: array items: type: string example: custom_field_value extra_metadata: type: array items: { } playlists: type: array items: { } type: object Api_StationOnDemand: properties: track_id: description: 'Track ID unique identifier' type: string example: 1 download_url: description: 'URL to download/play track.' type: string example: /api/station/1/ondemand/download/1 media: $ref: '#/components/schemas/Api_Song' playlist: type: string type: object Api_StationPlaylistQueue: properties: spm_id: description: 'ID of the StationPlaylistMedia record associating this track with the playlist' type: integer example: 1 nullable: true media_id: description: 'ID of the StationPlaylistMedia record associating this track with the playlist' type: integer example: 1 song_id: description: "The song's 32-character unique identifier hash" type: string example: 9f33bbc912c19603e51be8e0987d076b artist: description: 'The song artist.' type: string example: 'Chet Porter' title: description: 'The song title.' type: string example: 'Aluko River' type: object Api_StationQueueDetailed: type: object allOf: - $ref: '#/components/schemas/Api_NowPlaying_StationQueue' - $ref: '#/components/schemas/HasLinks' - properties: sent_to_autodj: description: 'Indicates whether the song has been sent to the AutoDJ.' type: boolean is_played: description: 'Indicates whether the song has already been marked as played.' type: boolean autodj_custom_uri: description: 'Custom AutoDJ playback URI, if it exists.' type: string example: '' nullable: true log: description: 'Log entries on how the specific queue item was picked by the AutoDJ.' type: array items: { } nullable: true type: object Api_StationRemote: type: object allOf: - $ref: '#/components/schemas/HasLinks' - properties: id: type: integer nullable: true display_name: type: string example: '128kbps MP3' nullable: true is_visible_on_public_pages: type: boolean example: true type: type: string example: icecast is_editable: type: boolean example: 'true' enable_autodj: type: boolean example: false autodj_format: type: string example: mp3 nullable: true autodj_bitrate: type: integer example: 128 nullable: true custom_listen_url: type: string example: 'path_to_url nullable: true url: type: string example: 'path_to_url mount: type: string example: /stream.mp3 nullable: true admin_password: type: string example: password nullable: true source_port: type: integer example: 8000 nullable: true source_mount: type: string example: / nullable: true source_username: type: string example: source nullable: true source_password: type: string example: password nullable: true is_public: type: boolean example: false listeners_unique: description: 'The most recent number of unique listeners.' type: integer example: 10 listeners_total: description: 'The most recent number of total (non-unique) listeners.' type: integer example: 12 type: object Api_StationRequest: properties: request_id: description: 'Requestable ID unique identifier' type: string example: 1 request_url: description: 'URL to directly submit request' type: string example: /api/station/1/request/1 song: $ref: '#/components/schemas/Api_Song' type: object Api_StationSchedule: properties: id: description: 'Unique identifier for this schedule entry.' type: integer example: 1 type: description: 'The type of this schedule entry.' type: string enum: - playlist - streamer example: playlist name: description: "Either the playlist or streamer's display name." type: string example: 'Example Schedule Entry' title: description: 'The name of the event.' type: string example: 'Example Schedule Entry' description: description: 'The full name of the type and name combined.' type: string example: 'Playlist: Example Schedule Entry' start_timestamp: description: 'The start time of the schedule entry, in UNIX format.' type: integer example: 1609480800 start: description: 'The start time of the schedule entry, in ISO 8601 format.' type: string example: '020-02-19T03:00:00-06:00' end_timestamp: description: 'The end time of the schedule entry, in UNIX format.' type: integer example: 1609480800 end: description: 'The start time of the schedule entry, in ISO 8601 format.' type: string example: '020-02-19T05:00:00-06:00' is_now: description: 'Whether the event is currently ongoing.' type: boolean example: true type: object Api_StationServiceStatus: properties: backend_running: type: boolean example: true frontend_running: type: boolean example: true station_has_started: type: boolean example: true station_needs_restart: type: boolean example: true type: object Api_Status: properties: success: type: boolean example: true message: type: string example: 'Changes saved successfully.' formatted_message: type: string example: '<b>Changes saved successfully.</b>' type: object Api_SystemStatus: properties: online: description: 'Whether the service is online or not (should always be true)' type: boolean example: true timestamp: description: 'The current UNIX timestamp' type: integer example: 1609480800 type: object Api_Time: properties: timestamp: description: 'The current UNIX timestamp' type: integer example: 1497652397 utc_datetime: type: string example: '2017-06-16 10:33:17' utc_date: type: string example: 'June 16, 2017' utc_time: type: string example: '10:33pm' utc_json: type: string example: '2012-12-25T16:30:00.000000Z' type: object HasLinks: properties: links: type: object additionalProperties: type: string type: object Api_HasSongFields: properties: text: description: 'The song title, usually "Artist - Title"' type: string example: 'Chet Porter - Aluko River' artist: description: 'The song artist.' type: string example: 'Chet Porter' nullable: true title: description: 'The song title.' type: string example: 'Aluko River' nullable: true album: description: 'The song album.' type: string example: 'Moving Castle' nullable: true genre: description: 'The song genre.' type: string example: Rock nullable: true isrc: description: 'The International Standard Recording Code (ISRC) of the file.' type: string example: US28E1600021 nullable: true lyrics: description: 'Lyrics to the song.' type: string example: '' nullable: true type: object Api_UploadFile: properties: path: description: 'The destination path of the uploaded file.' type: string example: relative/path/to/file.mp3 file: description: 'The base64-encoded contents of the file to upload.' type: string example: '' type: object CustomField: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: type: string short_name: description: 'The programmatic name for the field. Can be auto-generated from the full name.' type: string auto_assign: description: 'An ID3v2 field to automatically assign to this value, if it exists in the media file.' type: string nullable: true type: object FileTypes: type: string enum: - directory - media - cover_art - unprocessable_file - other Relay: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: base_url: type: string example: 'path_to_url name: type: string example: Relay nullable: true is_visible_on_public_pages: type: boolean example: true created_at: type: integer example: 1609480800 updated_at: type: integer example: 1609480800 type: object Role: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: type: string example: 'Super Administrator' permissions: description: RolePermission> type: array items: { } type: object Settings: properties: app_unique_identifier: type: string base_url: description: 'Site Base URL' type: string example: 'path_to_url nullable: true instance_name: description: 'AzuraCast Instance Name' type: string example: 'My AzuraCast Instance' nullable: true prefer_browser_url: description: 'Prefer Browser URL (If Available)' type: boolean example: 'false' use_radio_proxy: description: 'Use Web Proxy for Radio' type: boolean example: 'false' history_keep_days: description: 'Days of Playback History to Keep' type: integer always_use_ssl: description: 'Always Use HTTPS' type: boolean example: 'false' api_access_control: description: "API 'Access-Control-Allow-Origin' header" type: string example: '*' nullable: true enable_static_nowplaying: description: 'Whether to use high-performance static JSON for Now Playing data updates.' type: boolean example: 'false' analytics: description: 'Listener Analytics Collection' nullable: true check_for_updates: description: 'Check for Updates and Announcements' type: boolean example: 'true' update_results: description: 'Results of the latest update check.' type: array items: { } example: '' nullable: true update_last_run: description: 'The UNIX timestamp when updates were last checked.' type: integer example: 1609480800 public_theme: description: 'Base Theme for Public Pages' example: light nullable: true hide_album_art: description: 'Hide Album Art on Public Pages' type: boolean example: 'false' homepage_redirect_url: description: 'Homepage Redirect URL' type: string example: 'path_to_url nullable: true default_album_art_url: description: 'Default Album Art URL' type: string example: 'path_to_url nullable: true use_external_album_art_when_processing_media: description: 'Attempt to fetch album art from external sources when processing media.' type: boolean example: 'false' use_external_album_art_in_apis: description: 'Attempt to fetch album art from external sources in API requests.' type: boolean example: 'false' last_fm_api_key: description: 'An API key to connect to Last.fm services, if provided.' type: string example: SAMPLE-API-KEY nullable: true hide_product_name: description: 'Hide AzuraCast Branding on Public Pages' type: boolean example: 'false' public_custom_css: description: 'Custom CSS for Public Pages' type: string example: '' nullable: true public_custom_js: description: 'Custom JS for Public Pages' type: string example: '' nullable: true internal_custom_css: description: 'Custom CSS for Internal Pages' type: string example: '' nullable: true backup_enabled: description: 'Whether backup is enabled.' type: boolean example: 'false' backup_time_code: description: 'The timecode (i.e. 400 for 4:00AM) when automated backups should run.' type: string example: 400 nullable: true backup_exclude_media: description: 'Whether to exclude media in automated backups.' type: boolean example: 'false' backup_keep_copies: description: 'Number of backups to keep, or infinite if zero/null.' type: integer example: 2 backup_storage_location: description: 'The storage location ID for automated backups.' type: integer example: 1 nullable: true backup_format: description: 'The output format for the automated backup.' type: string example: zip nullable: true backup_last_run: description: 'The UNIX timestamp when automated backup was last run.' type: integer example: 1609480800 backup_last_output: description: 'The output of the latest automated backup task.' type: string example: '' nullable: true setup_complete_time: description: 'The UNIX timestamp when setup was last completed.' type: integer example: 1609480800 sync_disabled: description: 'Temporarily disable all sync tasks.' type: boolean example: 'false' sync_last_run: description: 'The last run timestamp for the unified sync task.' type: integer example: 1609480800 external_ip: description: "This installation's external IP." type: string example: 192.168.1.1 nullable: true geolite_license_key: description: 'The license key for the Maxmind Geolite download.' type: string example: '' nullable: true geolite_last_run: description: 'The UNIX timestamp when the Maxmind Geolite was last downloaded.' type: integer example: 1609480800 enable_advanced_features: description: "Whether to enable 'advanced' functionality in the system that is intended for power users." type: boolean example: false mail_enabled: description: 'Enable e-mail delivery across the application.' type: boolean example: 'true' mail_sender_name: description: 'The name of the sender of system e-mails.' type: string example: AzuraCast nullable: true mail_sender_email: description: 'The e-mail address of the sender of system e-mails.' type: string example: example@example.com nullable: true mail_smtp_host: description: 'The host to send outbound SMTP mail.' type: string example: smtp.example.com nullable: true mail_smtp_port: description: 'The port for sending outbound SMTP mail.' type: integer example: 465 mail_smtp_username: description: 'The username when connecting to SMTP mail.' type: string example: username nullable: true mail_smtp_password: description: 'The password when connecting to SMTP mail.' type: string example: password nullable: true mail_smtp_secure: description: 'Whether to use a secure (TLS) connection when sending SMTP mail.' type: boolean example: 'true' avatar_service: description: 'The external avatar service to use when fetching avatars.' type: string example: libravatar nullable: true avatar_default_url: description: 'The default avatar URL.' type: string example: '' nullable: true acme_email: description: 'ACME (LetsEncrypt) e-mail address.' type: string example: '' nullable: true acme_domains: description: 'ACME (LetsEncrypt) domain name(s).' type: string example: '' nullable: true ip_source: description: 'IP Address Source' nullable: true type: object SftpUser: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: username: type: string password: type: string publicKeys: type: string nullable: true type: object Station: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: description: 'The full display name of the station.' type: string example: 'AzuraTest Radio' short_name: description: 'The URL-friendly name for the station, typically auto-generated from the full station name.' type: string example: azuratest_radio is_enabled: description: "If set to 'false', prevents the station from broadcasting but leaves it in the database." type: boolean example: true frontend_type: description: 'The frontend adapter (icecast,shoutcast,remote,etc)' example: icecast frontend_config: description: 'An array containing station-specific frontend configuration' type: object backend_type: description: 'The backend adapter (liquidsoap,etc)' example: liquidsoap backend_config: description: 'An array containing station-specific backend configuration' type: object description: type: string example: 'A sample radio station.' nullable: true url: type: string example: 'path_to_url nullable: true genre: type: string example: Various nullable: true radio_base_dir: type: string example: /var/azuracast/stations/azuratest_radio nullable: true enable_requests: description: 'Whether listeners can request songs to play on this station.' type: boolean example: true request_delay: type: integer example: 5 nullable: true request_threshold: type: integer example: 15 nullable: true disconnect_deactivate_streamer: type: integer example: 0 nullable: true enable_streamers: description: 'Whether streamers are allowed to broadcast to this station at all.' type: boolean example: false is_streamer_live: description: 'Whether a streamer is currently active on the station.' type: boolean example: false enable_public_page: description: 'Whether this station is visible as a public page and in a now-playing API response.' type: boolean example: true enable_on_demand: description: "Whether this station has a public 'on-demand' streaming and download page." type: boolean example: true enable_on_demand_download: description: "Whether the 'on-demand' page offers download capability." type: boolean example: true enable_hls: description: 'Whether HLS streaming is enabled.' type: boolean example: true api_history_items: description: "The number of 'last played' history items to show for a station in API responses." type: integer example: 5 timezone: description: 'The time zone that station operations should take place in.' type: string example: UTC nullable: true branding_config: description: 'An array containing station-specific branding configuration' type: object type: object StationHlsStream: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: type: string example: aac_lofi format: example: aac nullable: true bitrate: type: integer example: 128 nullable: true type: object StationMount: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: type: string example: /radio.mp3 display_name: type: string example: '128kbps MP3' nullable: true is_visible_on_public_pages: type: boolean example: true is_default: type: boolean example: false is_public: type: boolean example: false fallback_mount: type: string example: /error.mp3 nullable: true relay_url: type: string example: 'path_to_url nullable: true authhash: type: string example: '' nullable: true max_listener_duration: type: integer example: 43200 enable_autodj: type: boolean example: true autodj_format: example: mp3 nullable: true autodj_bitrate: type: integer example: 128 nullable: true custom_listen_url: type: string example: 'path_to_url nullable: true frontend_config: type: array items: { } listeners_unique: description: 'The most recent number of unique listeners.' type: integer example: 10 listeners_total: description: 'The most recent number of total (non-unique) listeners.' type: integer example: 12 type: object StationPlaylist: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: type: string example: 'Test Playlist' type: example: default source: example: songs order: example: shuffle remote_url: type: string example: 'path_to_url nullable: true remote_type: example: stream nullable: true remote_buffer: description: 'The total time (in seconds) that Liquidsoap should buffer remote URL streams.' type: integer example: 0 is_enabled: type: boolean example: true is_jingle: description: 'If yes, do not send jingle metadata to AutoDJ or trigger web hooks.' type: boolean example: false play_per_songs: type: integer example: 5 play_per_minutes: type: integer example: 120 play_per_hour_minute: type: integer example: 15 weight: type: integer example: 3 include_in_requests: type: boolean example: true include_in_on_demand: description: "Whether this playlist's media is included in 'on demand' download/streaming if enabled." type: boolean example: true backend_options: type: string example: 'interrupt,loop_once,single_track,merge' nullable: true avoid_duplicates: type: boolean example: true schedule_items: description: StationSchedule> type: array items: { } podcasts: description: Podcast> type: array items: { } type: object StationSchedule: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: start_time: type: integer example: 900 end_time: type: integer example: 2200 days: description: 'Array of ISO-8601 days (1 for Monday, 7 for Sunday)' type: string example: '0,1,2,3' nullable: true loop_once: type: boolean example: false type: object StationStreamer: description: 'Station streamers (DJ accounts) allowed to broadcast to a station.' type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: streamer_username: type: string example: dj_test streamer_password: type: string example: '' display_name: type: string example: 'Test DJ' nullable: true comments: type: string example: 'This is a test DJ account.' nullable: true is_active: type: boolean example: true enforce_schedule: type: boolean example: false reactivate_at: type: integer example: 1609480800 nullable: true schedule_items: description: StationSchedule> type: array items: { } type: object StationStreamerBroadcast: description: 'Each individual broadcast associated with a streamer.' type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' StationWebhook: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: name: description: 'The nickname of the webhook connector.' type: string example: 'Twitter Post' nullable: true type: description: 'The type of webhook connector to use.' example: twitter is_enabled: type: boolean example: true triggers: description: 'List of events that should trigger the webhook notification.' type: array items: { } config: description: 'Detailed webhook configuration (if applicable)' type: array items: { } metadata: description: 'Internal details used by the webhook to preserve state.' type: array items: { } type: object HasAutoIncrementId: properties: id: type: integer nullable: true type: object HasSongFields: properties: song_id: type: string text: type: string nullable: true artist: type: string nullable: true title: type: string nullable: true type: object HasUniqueId: properties: id: type: string nullable: true type: object User: type: object allOf: - $ref: '#/components/schemas/HasAutoIncrementId' - properties: email: type: string example: demo@azuracast.com new_password: type: string example: '' nullable: true name: type: string example: 'Demo Account' nullable: true locale: type: string example: en_US nullable: true show_24_hour_time: type: boolean example: true nullable: true two_factor_secret: type: string example: A1B2C3D4 nullable: true created_at: type: integer example: 1609480800 updated_at: type: integer example: 1609480800 roles: description: Role> type: array items: { } type: object responses: Success: description: Success content: application/json: schema: $ref: '#/components/schemas/Api_Status' AccessDenied: description: 'Access denied.' content: application/json: schema: $ref: '#/components/schemas/Api_Error' RecordNotFound: description: 'Record not found.' content: application/json: schema: $ref: '#/components/schemas/Api_Error' GenericError: description: 'A generic exception has occurred.' content: application/json: schema: $ref: '#/components/schemas/Api_Error' parameters: StationIdRequired: name: station_id in: path required: true schema: anyOf: - type: integer format: int64 - type: string format: string securitySchemes: ApiKey: type: apiKey name: X-API-Key in: header tags: - name: 'Now Playing' description: 'Endpoints that provide full summaries of the current state of stations.' - name: 'Stations: General' - name: 'Stations: Broadcasting' - name: 'Stations: Song Requests' - name: 'Stations: Service Control' - name: 'Stations: History' - name: 'Stations: HLS Streams' - name: 'Stations: Listeners' - name: 'Stations: Schedules' - name: 'Stations: Media' - name: 'Stations: Mount Points' - name: 'Stations: Playlists' - name: 'Stations: Podcasts' - name: 'Stations: Queue' - name: 'Stations: Remote Relays' - name: 'Stations: SFTP Users' - name: 'Stations: Streamers/DJs' - name: 'Stations: Web Hooks' - name: 'Administration: Custom Fields' - name: 'Administration: Users' - name: 'Administration: Relays' - name: 'Administration: Roles' - name: 'Administration: Settings' - name: 'Administration: Stations' - name: 'Administration: Storage Locations' - name: Miscellaneous - name: 'Administration: CPU stats' description: 'Administration: CPU stats' externalDocs: description: 'AzuraCast on GitHub' url: 'path_to_url ```
/content/code_sandbox/web/static/openapi.yml
yaml
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
32,909
```php <?php /** * PHPStan Bootstrap File */ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); ini_set('display_errors', 1); require dirname(__DIR__) . '/vendor/autoload.php'; $tempDir = sys_get_temp_dir(); $app = App\AppFactory::createApp([ App\Environment::TEMP_DIR => $tempDir, App\Environment::UPLOADS_DIR => $tempDir, ]); $di = $app->getContainer(); return $di->get(Doctrine\ORM\EntityManagerInterface::class); ```
/content/code_sandbox/util/phpstan-doctrine.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
111
```shell #!/usr/bin/env bash # Ensure we're in the same directory as this script. cd "$( dirname "${BASH_SOURCE[0]}" )" || exit cd .. COMMIT_LONG=$(git log --pretty=%H -n1 HEAD) COMMIT_DATE=$(git log -n1 --pretty=%ci HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD | head -n 1) printf "COMMIT_LONG=\"%s\"\n" "$COMMIT_LONG" > .gitinfo printf "COMMIT_DATE=\"%s\"\n" "$COMMIT_DATE" >> .gitinfo printf "BRANCH=\"%s\"\n" "$BRANCH" >> .gitinfo ```
/content/code_sandbox/util/write_git_info.sh
shell
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
139