Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from AzuraCast:main #67

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ FROM golang:1.23-bookworm AS go-dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl git

RUN go install github.com/jwilder/dockerize@v0.9.1
RUN go install github.com/jwilder/dockerize@v0.9.2

RUN go install github.com/aptible/supercronic@v0.2.33

RUN go install github.com/centrifugal/centrifugo/v5@v5.4.9
RUN go install github.com/centrifugal/centrifugo/v6@v6.0.0

RUN strip /go/bin/*

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"vlucas/phpdotenv": "^5.3",
"voku/portable-utf8": "^6.0",
"wikimedia/composer-merge-plugin": "dev-master",
"zircote/swagger-php": "^4.9.2"
"zircote/swagger-php": "^5"
},
"replace": {
"symfony/polyfill-iconv": "1.99",
Expand Down
218 changes: 116 additions & 102 deletions composer.lock

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions frontend/components/Admin/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,33 @@ const {state: stats, isLoading} = useAutoRefreshingAsyncState<AdminStats>(
{
cpu: {
total: {
name: 'Total',
steal: 0,
io_wait: 0,
usage: 0
name: "Total",
usage: "",
idle: "",
io_wait: "",
steal: "",
},
cores: [],
load: [0, 0, 0]
},
memory: {
bytes: {
total: "0",
free: "0",
buffers: "0",
cached: "0",
sReclaimable: "0",
shmem: "0",
used: "0",
cached: "0"
},
readable: {
total: "",
free: "",
buffers: "",
cached: "",
sReclaimable: "",
shmem: "",
used: "",
cached: ""
}
},
swap: {
Expand Down
2 changes: 0 additions & 2 deletions frontend/components/Admin/Stations/Form/BackendForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,8 @@ import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/use
import {decimal, numeric, required} from "@vuelidate/validators";
import {useAzuraCast} from "~/vendor/azuracast";
import Tab from "~/components/Common/Tab.vue";
import {Station} from "~/entities/ApiInterfaces.ts";

interface StationBackendFormProps extends FormTabProps {
station: Station,
isStereoToolInstalled: boolean
}

Expand Down
7 changes: 1 addition & 6 deletions frontend/components/Admin/Stations/Form/HlsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,8 @@ import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/use
import {numeric} from "@vuelidate/validators";
import {useAzuraCast} from "~/vendor/azuracast";
import Tab from "~/components/Common/Tab.vue";
import {Station} from "~/entities/ApiInterfaces.ts";

interface StationHlsFormProps extends FormTabProps {
station: Station,
}

const props = defineProps<StationHlsFormProps>();
const props = defineProps<FormTabProps>();
const emit = defineEmits<FormTabEmits>();

const {enableAdvancedFeatures} = useAzuraCast();
Expand Down
7 changes: 1 addition & 6 deletions frontend/components/Admin/Stations/Form/RequestsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@ import {computed} from "vue";
import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab";
import {numeric} from "@vuelidate/validators";
import Tab from "~/components/Common/Tab.vue";
import {Station} from "~/entities/ApiInterfaces.ts";

interface StationRequestsFormProps extends FormTabProps {
station: Station,
}

const props = defineProps<StationRequestsFormProps>();
const props = defineProps<FormTabProps>();
const emit = defineEmits<FormTabEmits>();

const {form, v$, tabClass} = useVuelidateOnFormTab(
Expand Down
7 changes: 1 addition & 6 deletions frontend/components/Admin/Stations/Form/StreamersForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,8 @@ import {numeric} from "@vuelidate/validators";
import {useAzuraCast} from "~/vendor/azuracast";
import Tab from "~/components/Common/Tab.vue";
import BitrateOptions from "~/components/Common/BitrateOptions.vue";
import {Station} from "~/entities/ApiInterfaces.ts";

interface StationStreamersFormProps extends FormTabProps {
station: Station,
}

const props = defineProps<StationStreamersFormProps>();
const props = defineProps<FormTabProps>();
const emit = defineEmits<FormTabEmits>();

const {enableAdvancedFeatures} = useAzuraCast();
Expand Down
30 changes: 8 additions & 22 deletions frontend/components/Admin/Stations/StationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,19 @@

<admin-stations-backend-form
v-model:form="form"
:station="station"
:is-stereo-tool-installed="isStereoToolInstalled"
/>

<admin-stations-hls-form
v-model:form="form"
:station="station"
/>

<admin-stations-requests-form
v-model:form="form"
:station="station"
/>

<admin-stations-streamers-form
v-model:form="form"
:station="station"
/>

<admin-stations-admin-form
Expand Down Expand Up @@ -94,7 +90,6 @@ import {useNotify} from "~/functions/useNotify";
import {useAxios} from "~/vendor/axios";
import mergeExisting from "~/functions/mergeExisting";
import {useVuelidateOnForm} from "~/functions/useVuelidateOnForm";
import {useResettableRef} from "~/functions/useResettableRef";
import Loading from '~/components/Common/Loading.vue';
import Tabs from "~/components/Common/Tabs.vue";
import {GlobalPermission, userAllowed} from "~/acl";
Expand All @@ -120,7 +115,12 @@ const props = withDefaults(
}
);

const emit = defineEmits(['error', 'submitted', 'loadingUpdate', 'validUpdate']);
const emit = defineEmits<{
(e: 'error', error: string): void,
(e: 'submitted'): void,
(e: 'loadingUpdate', loading: boolean): void,
(e: 'validUpdate', valid: boolean): void
}>();

const showAdminTab = userAllowed(GlobalPermission.Stations);

Expand All @@ -142,35 +142,21 @@ watch(isLoading, (newValue) => {

const error = ref(null);

const blankStation = {
stereo_tool_configuration_file_path: null,
links: {
stereo_tool_configuration: null
}
};

const {record: station, reset: resetStation} = useResettableRef(blankStation);

const clear = () => {
resetForm();
resetStation();

isLoading.value = false;
error.value = null;
};

const populateForm = (data) => {
form.value = mergeExisting(form.value, data);
};

const {notifySuccess} = useNotify();
const {axios} = useAxios();

const doLoad = () => {
isLoading.value = true;

axios.get(props.editUrl).then((resp) => {
populateForm(resp.data);
axios.get(props.editUrl).then(({data}) => {
form.value = mergeExisting(form.value, data);
}).catch((err) => {
emit('error', err);
}).finally(() => {
Expand Down
12 changes: 10 additions & 2 deletions frontend/components/Admin/Updates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,22 @@ import {getApiUrl} from "~/router";
import {IconInfo, IconSync, IconUpdate, IconUpload} from "~/components/Common/icons";
import {useDialog} from "~/functions/useDialog.ts";

interface UpdateInfo {
needs_release_update?: boolean,
needs_rolling_update?: boolean,
}

const props = withDefaults(
defineProps<{
releaseChannel: string,
initialUpdateInfo?: object,
initialUpdateInfo?: UpdateInfo,
enableWebUpdates: boolean,
}>(),
{
initialUpdateInfo: () => ({})
initialUpdateInfo: () => ({
needs_release_update: false,
needs_rolling_update: false,
})
}
);

Expand Down
17 changes: 10 additions & 7 deletions frontend/components/Common/BitrateOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@
</form-group>
</template>

<script setup lang="ts" generic="T = string | number">
<script setup lang="ts">
import {FormFieldEmits, FormFieldProps, useFormField} from "~/components/Form/useFormField";
import {computed, useSlots, WritableComputedRef} from "vue";
import {includes, map} from "lodash";
import useSlotsExcept from "~/functions/useSlotsExcept.ts";
import FormMultiCheck from "~/components/Form/FormMultiCheck.vue";
import FormLabel, {FormLabelParentProps} from "~/components/Form/FormLabel.vue";
import FormGroup from "~/components/Form/FormGroup.vue";
import {SimpleFormOptionInput} from "~/functions/objectToFormOptions.ts";

type T = number | null

interface BitrateOptionsProps extends FormFieldProps<T>, FormLabelParentProps {
id: string,
Expand All @@ -99,20 +102,20 @@ const radioBitrates = [
32, 48, 64, 96, 128, 192, 256, 320
].filter((bitrate) => props.maxBitrate === 0 || bitrate <= props.maxBitrate);

const customField: WritableComputedRef<number | null> = computed({
const customField: WritableComputedRef<T> = computed({
get() {
return includes(radioBitrates, model.value)
? ''
return includes(radioBitrates, Number(model.value))
? null
: model.value;
},
set(newValue) {
model.value = newValue;
}
});

const radioField: WritableComputedRef<number | string | null> = computed({
const radioField: WritableComputedRef<"custom" | T> = computed({
get() {
return includes(radioBitrates, model.value)
return includes(radioBitrates, Number(model.value))
? model.value
: 'custom';
},
Expand All @@ -123,7 +126,7 @@ const radioField: WritableComputedRef<number | string | null> = computed({
}
});

const bitrateOptions = map(
const bitrateOptions: SimpleFormOptionInput = map(
radioBitrates,
(val: number) => {
return {
Expand Down
6 changes: 5 additions & 1 deletion frontend/components/Common/DateRangeDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ const dateRange = computed({
const {$gettext} = useTranslate();

const ranges = computed(() => {
const nowTz = DateTime.now().setZone(props.options?.timezone ?? "UTC");
const tz: string = (props.options && "timezone" in props.options)
? (typeof props.options.timezone === "string" ? props.options.timezone : props.options.timezone.timezone)
: 'UTC';

const nowTz = DateTime.now().setZone(tz);
const nowAtMidnightDate = nowTz.endOf('day').toJSDate();

return [
Expand Down
8 changes: 3 additions & 5 deletions frontend/components/Common/Toast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@
</template>

<script setup lang="ts">
import {ToastProps} from "~/functions/useNotify.ts";

const props = withDefaults(
defineProps<{
message: string,
title?: string,
variant?: string,
}>(),
defineProps<ToastProps>(),
{
variant: 'info',
}
Expand Down
7 changes: 4 additions & 3 deletions frontend/components/Form/FormGroupCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@
</form-group>
</template>

<script setup lang="ts" generic="T = boolean | null">
<script setup lang="ts">
import VuelidateError from "./VuelidateError.vue";
import FormLabel, {FormLabelParentProps} from "~/components/Form/FormLabel.vue";
import FormGroup from "~/components/Form/FormGroup.vue";
import {FormFieldEmits, FormFieldProps, useFormField} from "~/components/Form/useFormField";
import {useSlots} from "vue";
import FormCheckbox from "~/components/Form/FormCheckbox.vue";

type T = boolean | null

interface FormGroupCheckboxProps extends FormFieldProps<T>, FormLabelParentProps {
id: string,
name?: string,
Expand All @@ -73,8 +75,7 @@ const props = withDefaults(
name: null,
label: null,
description: null,
inputAttrs: () => {
}
inputAttrs: () => ({})
}
);

Expand Down
24 changes: 11 additions & 13 deletions frontend/components/Form/FormGroupField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,14 @@
</form-group>
</template>

<script setup lang="ts" generic="T extends any = ModelFormField">
<script setup lang="ts">
import VuelidateError from "./VuelidateError.vue";
import {computed, ComputedRef, nextTick, onMounted, reactive, Reactive, ref} from "vue";
import {computed, nextTick, onMounted, reactive, Reactive, ref, WritableComputedRef} from "vue";
import FormGroup from "~/components/Form/FormGroup.vue";
import FormLabel, {FormLabelParentProps} from "~/components/Form/FormLabel.vue";
import {
FormFieldEmits,
FormFieldProps,
ModelFormField,
useFormField,
VuelidateField
} from "~/components/Form/useFormField";
import {FormFieldEmits, FormFieldProps, useFormField, VuelidateField} from "~/components/Form/useFormField";

type T = string | number | null;

interface FormGroupFieldProps extends FormFieldProps<T>, FormLabelParentProps {
id: string,
Expand All @@ -106,7 +102,7 @@ interface FormGroupFieldProps extends FormFieldProps<T>, FormLabelParentProps {
}

interface FilteredModelObject {
$model: T
$model: WritableComputedRef<T>
}

const props = withDefaults(
Expand All @@ -127,8 +123,10 @@ const slots = defineSlots<{
default?: (props: {
id: string,
field?: VuelidateField<T>,
model: FilteredModelObject,
fieldClass: ComputedRef<string | null>
model: {
$model: T
},
fieldClass: string | null
}) => any,
description?: () => any,
}>();
Expand All @@ -150,7 +148,7 @@ const model = computed({
parentModel.value = null;
} else {
if (props.inputTrim && null !== newValue) {
newValue = newValue.replace(/^\s+|\s+$/gm, '');
newValue = String(newValue).replace(/^\s+|\s+$/gm, '');
}

if (isNumeric.value) {
Expand Down
Loading
Loading