cleanup unused fields, update packages

This commit is contained in:
jb-alvarado 2024-06-12 09:17:44 +02:00
parent f9edcc9a74
commit e8532ba8d0
22 changed files with 3446 additions and 1459 deletions

View File

@ -5,7 +5,7 @@
<button class="btn btn-sm btn-primary" @click="addChannel()">{{ $t('config.addChannel') }}</button> <button class="btn btn-sm btn-primary" @click="addChannel()">{{ $t('config.addChannel') }}</button>
</div> </div>
<form <form
v-if="configStore.configGui && configStore.configGui[configStore.configID]" v-if="configStore.configChannel && configStore.configChannel[configStore.configID]"
class="w-full" class="w-full"
@submit.prevent="onSubmitGui" @submit.prevent="onSubmitGui"
> >
@ -14,7 +14,7 @@
<span class="label-text">{{ $t('config.name') }}</span> <span class="label-text">{{ $t('config.name') }}</span>
</div> </div>
<input <input
v-model="configStore.configGui[configStore.configID].name" v-model="configStore.configChannel[configStore.configID].name"
type="text" type="text"
placeholder="Type here" placeholder="Type here"
class="input input-bordered w-full" class="input input-bordered w-full"
@ -26,18 +26,7 @@
<span class="label-text">{{ $t('config.previewUrl') }}</span> <span class="label-text">{{ $t('config.previewUrl') }}</span>
</div> </div>
<input <input
v-model="configStore.configGui[configStore.configID].preview_url" v-model="configStore.configChannel[configStore.configID].preview_url"
type="text"
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ $t('config.configPath') }}</span>
</div>
<input
v-model="configStore.configGui[configStore.configID].config_path"
type="text" type="text"
class="input input-bordered w-full" class="input input-bordered w-full"
/> />
@ -48,28 +37,16 @@
<span class="label-text">{{ $t('config.extensions') }}</span> <span class="label-text">{{ $t('config.extensions') }}</span>
</div> </div>
<input <input
v-model="configStore.configGui[configStore.configID].extra_extensions" v-model="configStore.configChannel[configStore.configID].extra_extensions"
type="text" type="text"
class="input input-bordered w-full" class="input input-bordered w-full"
/> />
</label> </label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ $t('config.service') }}</span>
</div>
<input
v-model="configStore.configGui[configStore.configID].service"
type="text"
class="input input-bordered w-full !bg-base-100"
disabled
/>
</label>
<div class="join my-4"> <div class="join my-4">
<button class="join-item btn btn-primary" type="submit">{{ $t('config.save') }}</button> <button class="join-item btn btn-primary" type="submit">{{ $t('config.save') }}</button>
<button <button
v-if="configStore.configGui.length > 1 && configStore.configGui[configStore.configID].id > 1" v-if="configStore.configChannel.length > 1 && configStore.configChannel[configStore.configID].id > 1"
class="join-item btn btn-primary" class="join-item btn btn-primary"
@click="deleteChannel()" @click="deleteChannel()"
> >
@ -89,27 +66,22 @@ const configStore = useConfig()
const indexStore = useIndex() const indexStore = useIndex()
async function addChannel() { async function addChannel() {
const channels = $_.cloneDeep(configStore.configGui) const channels = $_.cloneDeep(configStore.configChannel)
const newChannel = $_.cloneDeep(configStore.configGui[configStore.configGui.length - 1]) const newChannel = $_.cloneDeep(configStore.configChannel[configStore.configChannel.length - 1])
const playoutConfigPath = newChannel.config_path.match(/.*\//)
const confName = `channel${String(channels.length + 1).padStart(3, '0')}`
newChannel.id = channels.length + 1 newChannel.id = channels.length + 1
newChannel.name = `Channel ${Math.random().toString(36).substring(7)}` newChannel.name = `Channel ${Math.random().toString(36).substring(7)}`
newChannel.config_path = `${playoutConfigPath}${confName}.toml`
newChannel.service = `ffplayout@${confName}.service`
channels.push(newChannel) channels.push(newChannel)
configStore.configGui = channels configStore.configChannel = channels
configStore.configID = configStore.configGui.length - 1 configStore.configID = configStore.configChannel.length - 1
} }
async function onSubmitGui() { async function onSubmitGui() {
/* /*
Save GUI settings. Save GUI settings.
*/ */
const update = await configStore.setGuiConfig(configStore.configGui[configStore.configID]) const update = await configStore.setGuiConfig(configStore.configChannel[configStore.configID])
if (update.status) { if (update.status) {
indexStore.msgAlert('success', t('config.updateChannelSuccess'), 2) indexStore.msgAlert('success', t('config.updateChannelSuccess'), 2)
@ -119,7 +91,7 @@ async function onSubmitGui() {
} }
async function deleteChannel() { async function deleteChannel() {
const config = $_.cloneDeep(configStore.configGui) const config = $_.cloneDeep(configStore.configChannel)
const id = config[configStore.configID].id const id = config[configStore.configID].id
if (id === 1) { if (id === 1) {
@ -133,8 +105,8 @@ async function deleteChannel() {
}) })
config.splice(configStore.configID, 1) config.splice(configStore.configID, 1)
configStore.configGui = config configStore.configChannel = config
configStore.configID = configStore.configGui.length - 1 configStore.configID = configStore.configChannel.length - 1
await configStore.getPlayoutConfig() await configStore.getPlayoutConfig()
if (response.status === 200) { if (response.status === 200) {

View File

@ -170,7 +170,7 @@ async function onSubmitPlayout() {
if (update.status === 200) { if (update.status === 200) {
indexStore.msgAlert('success', t('config.updatePlayoutSuccess'), 2) indexStore.msgAlert('success', t('config.updatePlayoutSuccess'), 2)
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
await $fetch(`/api/control/${channel}/process/`, { await $fetch(`/api/control/${channel}/process/`, {
method: 'POST', method: 'POST',
@ -188,7 +188,7 @@ async function onSubmitPlayout() {
async function restart(res: boolean) { async function restart(res: boolean) {
if (res) { if (res) {
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
await $fetch(`/api/control/${channel}/process/`, { await $fetch(`/api/control/${channel}/process/`, {
method: 'POST', method: 'POST',

View File

@ -22,15 +22,15 @@
</span> </span>
</NuxtLink> </NuxtLink>
</li> </li>
<li v-if="configStore.configGui.length > 1"> <li v-if="configStore.configChannel.length > 1">
<details tabindex="0" @focusout="closeDropdown"> <details tabindex="0" @focusout="closeDropdown">
<summary> <summary>
<div class="h-[19px] text-base"> <div class="h-[19px] text-base">
<span> {{ configStore.configGui[configStore.configID].name }} </span> <span> {{ configStore.configChannel[configStore.configID].name }} </span>
</div> </div>
</summary> </summary>
<ul class="p-2"> <ul class="p-2">
<li v-for="(channel, index) in configStore.configGui" :key="index"> <li v-for="(channel, index) in configStore.configChannel" :key="index">
<span> <span>
<a class="dropdown-item" @click="selectChannel(index)">{{ channel.name }}</a> <a class="dropdown-item" @click="selectChannel(index)">{{ channel.name }}</a>
</span> </span>
@ -59,15 +59,15 @@
</span> </span>
</NuxtLink> </NuxtLink>
</li> </li>
<li v-if="configStore.configGui.length > 1"> <li v-if="configStore.configChannel.length > 1">
<details tabindex="0" @focusout="closeDropdown"> <details tabindex="0" @focusout="closeDropdown">
<summary> <summary>
<div class="h-[19px] text-base"> <div class="h-[19px] text-base">
<span> {{ configStore.configGui[configStore.configID].name }} </span> <span> {{ configStore.configChannel[configStore.configID].name }} </span>
</div> </div>
</summary> </summary>
<ul class="p-2 bg-base-100 rounded-md !mt-1 w-36" tabindex="0"> <ul class="p-2 bg-base-100 rounded-md !mt-1 w-36" tabindex="0">
<li v-for="(channel, index) in configStore.configGui" :key="index"> <li v-for="(channel, index) in configStore.configChannel" :key="index">
<a class="dropdown-item" @click="selectChannel(index)"> <a class="dropdown-item" @click="selectChannel(index)">
{{ channel.name }} {{ channel.name }}
</a> </a>

View File

@ -6,7 +6,7 @@
<div class="w-full aspect-video"> <div class="w-full aspect-video">
<video v-if="streamExtension === 'flv'" ref="httpStreamFlv" controls /> <video v-if="streamExtension === 'flv'" ref="httpStreamFlv" controls />
<VideoPlayer <VideoPlayer
v-else-if="configStore.configGui[configStore.configID]" v-else-if="configStore.configChannel[configStore.configID]"
:key="configStore.configID" :key="configStore.configID"
class="live-player" class="live-player"
reference="httpStream" reference="httpStream"
@ -19,7 +19,7 @@
sources: [ sources: [
{ {
type: 'application/x-mpegURL', type: 'application/x-mpegURL',
src: configStore.configGui[configStore.configID].preview_url, src: configStore.configChannel[configStore.configID].preview_url,
}, },
], ],
}" }"
@ -180,12 +180,12 @@ playlistStore.currentClip = t('control.noClip')
const timeStr = ref('00:00:00') const timeStr = ref('00:00:00')
const timer = ref() const timer = ref()
const errorCounter = ref(0) const errorCounter = ref(0)
const streamExtension = ref(configStore.configGui[configStore.configID].preview_url.split('.').pop()) const streamExtension = ref(configStore.configChannel[configStore.configID].preview_url.split('.').pop())
const httpStreamFlv = ref(null) const httpStreamFlv = ref(null)
const httpFlvSource = ref({ const httpFlvSource = ref({
type: 'flv', type: 'flv',
isLive: true, isLive: true,
url: configStore.configGui[configStore.configID].preview_url, url: configStore.configChannel[configStore.configID].preview_url,
}) })
const mpegtsOptions = ref({ const mpegtsOptions = ref({
lazyLoadMaxDuration: 3 * 60, lazyLoadMaxDuration: 3 * 60,
@ -193,7 +193,7 @@ const mpegtsOptions = ref({
}) })
const streamUrl = ref( const streamUrl = ref(
`/data/event/${configStore.configGui[configStore.configID].id}?endpoint=playout&uuid=${authStore.uuid}` `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${authStore.uuid}`
) )
// 'http://127.0.0.1:8787/data/event/1?endpoint=playout&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a' // 'http://127.0.0.1:8787/data/event/1?endpoint=playout&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a'
@ -245,7 +245,7 @@ watch([status, error], async () => {
if (errorCounter.value > 15) { if (errorCounter.value > 15) {
await authStore.obtainUuid() await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.configGui[configStore.configID].id}?endpoint=playout&uuid=${ streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${
authStore.uuid authStore.uuid
}` }`
errorCounter.value = 0 errorCounter.value = 0
@ -268,7 +268,7 @@ watch([data], () => {
watch([configID], () => { watch([configID], () => {
resetStatus() resetStatus()
streamUrl.value = `/data/event/${configStore.configGui[configStore.configID].id}?endpoint=playout&uuid=${ streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${
authStore.uuid authStore.uuid
}` }`
@ -311,7 +311,7 @@ async function controlProcess(state: string) {
/* /*
Control playout systemd service (start, stop, restart) Control playout systemd service (start, stop, restart)
*/ */
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
await $fetch(`/api/control/${channel}/process/`, { await $fetch(`/api/control/${channel}/process/`, {
method: 'POST', method: 'POST',
@ -327,7 +327,7 @@ async function controlPlayout(state: string) {
- jump to last clip - jump to last clip
- reset playout state - reset playout state
*/ */
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
await $fetch(`/api/control/${channel}/playout/`, { await $fetch(`/api/control/${channel}/playout/`, {
method: 'POST', method: 'POST',

View File

@ -402,7 +402,7 @@ async function generatePlaylist() {
} }
} }
await $fetch(`/api/playlist/${configStore.configGui[configStore.configID].id}/generate/${playlistStore.listDate}`, { await $fetch(`/api/playlist/${configStore.configChannel[configStore.configID].id}/generate/${playlistStore.listDate}`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body, body,

View File

@ -96,7 +96,7 @@ const configStore = useConfig()
const indexStore = useIndex() const indexStore = useIndex()
const streamUrl = ref( const streamUrl = ref(
`/data/event/${configStore.configGui[configStore.configID].id}?endpoint=system&uuid=${authStore.uuid}` `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=system&uuid=${authStore.uuid}`
) )
// 'http://127.0.0.1:8787/data/event/1?endpoint=system&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a' // 'http://127.0.0.1:8787/data/event/1?endpoint=system&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a'
@ -139,7 +139,7 @@ watch([status, error], async () => {
if (errorCounter.value > 15) { if (errorCounter.value > 15) {
await authStore.obtainUuid() await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.configGui[configStore.configID].id}?endpoint=system&uuid=${ streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=system&uuid=${
authStore.uuid authStore.uuid
}` }`
errorCounter.value = 0 errorCounter.value = 0

View File

@ -144,9 +144,7 @@ export default {
addChannel: 'Neuen Kanal hinzufügen', addChannel: 'Neuen Kanal hinzufügen',
name: 'Name', name: 'Name',
previewUrl: 'Vorschau-URL', previewUrl: 'Vorschau-URL',
configPath: 'Konfigurationspfad',
extensions: 'Zusätzliche Erweiterungen', extensions: 'Zusätzliche Erweiterungen',
service: 'Dienst',
save: 'Speichern', save: 'Speichern',
delete: 'Löschen', delete: 'Löschen',
updateChannelSuccess: 'Kanal-Konfiguration erfolgreich aktualisiert!', updateChannelSuccess: 'Kanal-Konfiguration erfolgreich aktualisiert!',

View File

@ -144,9 +144,7 @@ export default {
addChannel: 'Add new Channel', addChannel: 'Add new Channel',
name: 'Name', name: 'Name',
previewUrl: 'Preview URL', previewUrl: 'Preview URL',
configPath: 'Config Path',
extensions: 'Extra Extensions', extensions: 'Extra Extensions',
service: 'Service',
save: 'Save', save: 'Save',
delete: 'Delete', delete: 'Delete',
updateChannelSuccess: 'Update channel config success!', updateChannelSuccess: 'Update channel config success!',

View File

@ -144,9 +144,7 @@ export default {
addChannel: 'Adicionar novo Canal', addChannel: 'Adicionar novo Canal',
name: 'Nome', name: 'Nome',
previewUrl: 'URL de Visualização', previewUrl: 'URL de Visualização',
configPath: 'Caminho de Configuração',
extensions: 'Extensões Extras', extensions: 'Extensões Extras',
service: 'Serviço',
save: 'Salvar', save: 'Salvar',
delete: 'Deletar', delete: 'Deletar',
updateChannelSuccess: 'Atualização da configuração do canal bem-sucedida!', updateChannelSuccess: 'Atualização da configuração do canal bem-sucedida!',

View File

@ -144,9 +144,7 @@ export default {
addChannel: 'Сделать новый канал', addChannel: 'Сделать новый канал',
name: 'Название канала', name: 'Название канала',
previewUrl: 'Предварительный просмотр эфира канала по URL', previewUrl: 'Предварительный просмотр эфира канала по URL',
configPath: 'Путь к конфигурации',
extensions: 'Дополнительные расширения', extensions: 'Дополнительные расширения',
service: 'Сервис',
save: 'Сохранить', save: 'Сохранить',
delete: 'Удалить', delete: 'Удалить',
updateChannelSuccess: 'Обновление конфигурации канала успешно!', updateChannelSuccess: 'Обновление конфигурации канала успешно!',

4719
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "ffplayout-frontend", "name": "ffplayout-frontend",
"version": "0.10.0", "version": "0.11.0",
"description": "Web GUI for ffplayout", "description": "Web GUI for ffplayout",
"author": "Jonathan Baecker", "author": "Jonathan Baecker",
"private": true, "private": true,
@ -15,14 +15,14 @@
"dependencies": { "dependencies": {
"@nuxtjs/color-mode": "^3.4.1", "@nuxtjs/color-mode": "^3.4.1",
"@pinia/nuxt": "^0.5.1", "@pinia/nuxt": "^0.5.1",
"@vuepic/vue-datepicker": "^8.7.0", "@vuepic/vue-datepicker": "^8.8.0",
"@vueuse/nuxt": "^10.9.0", "@vueuse/nuxt": "^10.10.1",
"bootstrap-icons": "^1.11.3", "bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mpegts.js": "^1.7.3", "mpegts.js": "^1.7.3",
"nuxt": "3.11.2", "nuxt": "3.12.1",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"sortablejs-vue3": "^1.2.11", "sortablejs-vue3": "^1.2.11",
"splitpanes": "^3.1.5", "splitpanes": "^3.1.5",
@ -32,14 +32,14 @@
"@nuxt/eslint": "^0.3.13", "@nuxt/eslint": "^0.3.13",
"@nuxtjs/i18n": "^8.3.1", "@nuxtjs/i18n": "^8.3.1",
"@nuxtjs/tailwindcss": "^6.12.0", "@nuxtjs/tailwindcss": "^6.12.0",
"@types/lodash": "^4.17.4", "@types/lodash": "^4.17.5",
"@types/video.js": "^7.3.58", "@types/video.js": "^7.3.58",
"daisyui": "^4.11.1", "daisyui": "^4.12.2",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"postcss-loader": "^8.1.1", "postcss-loader": "^8.1.1",
"sass": "^1.77.2", "sass": "^1.77.5",
"sass-loader": "^14.2.1", "sass-loader": "^14.2.1",
"vue": "^3.4.27", "vue": "^3.4.27",
"vue-router": "^4.3.2" "vue-router": "^4.3.3"
} }
} }

View File

@ -25,7 +25,7 @@
</div> </div>
<div class="w-[calc(100%-70px)] mt-10 px-6"> <div class="w-[calc(100%-70px)] mt-10 px-6">
<div v-if="activeConf === 1" class="w-full flex justify-center"> <div v-if="activeConf === 1" class="w-full flex justify-center">
<ConfigGui /> <ConfigChannel />
</div> </div>
<div v-else-if="activeConf === 2" class="w-full flex justify-center"> <div v-else-if="activeConf === 2" class="w-full flex justify-center">

View File

@ -4,7 +4,7 @@
<div class="absolute top-4 left-1"> <div class="absolute top-4 left-1">
<EventStatus /> <EventStatus />
</div> </div>
<SystemStats v-if="configStore.configGui.length > 0" /> <SystemStats v-if="configStore.configChannel.length > 0" />
<div class="flex flex-wrap justify-center gap-1 md:gap-0 md:join mt-5"> <div class="flex flex-wrap justify-center gap-1 md:gap-0 md:join mt-5">
<NuxtLink :to="localePath({ name: 'player' })" class="btn join-item btn-primary px-2"> <NuxtLink :to="localePath({ name: 'player' })" class="btn join-item btn-primary px-2">
{{ $t('button.player') }} {{ $t('button.player') }}

View File

@ -68,7 +68,7 @@ async function getLog() {
date = '' date = ''
} }
await fetch(`/api/log/${configStore.configGui[configStore.configID].id}?date=${date}`, { await fetch(`/api/log/${configStore.configChannel[configStore.configID].id}?date=${date}`, {
method: 'GET', method: 'GET',
headers: authStore.authHeader, headers: authStore.authHeader,
}) })

View File

@ -352,7 +352,7 @@ const xhr = ref(new XMLHttpRequest())
onMounted(async () => { onMounted(async () => {
let config_extensions = configStore.playout.storage.extensions let config_extensions = configStore.playout.storage.extensions
let extra_extensions = configStore.configGui[configStore.configID].extra_extensions let extra_extensions = configStore.configChannel[configStore.configID].extra_extensions
if (typeof config_extensions === 'string') { if (typeof config_extensions === 'string') {
config_extensions = config_extensions.split(',') config_extensions = config_extensions.split(',')
@ -425,7 +425,7 @@ async function handleDrop(event: any, targetFolder: any, isParent: boolean | nul
} }
if (source !== target) { if (source !== target) {
await fetch(`/api/file/${configStore.configGui[configStore.configID].id}/rename/`, { await fetch(`/api/file/${configStore.configChannel[configStore.configID].id}/rename/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source, target }), body: JSON.stringify({ source, target }),
@ -453,7 +453,7 @@ function setPreviewData(path: string) {
} }
previewName.value = fullPath.split('/').slice(-1)[0] previewName.value = fullPath.split('/').slice(-1)[0]
previewUrl.value = encodeURIComponent(`/file/${configStore.configGui[configStore.configID].id}${fullPath}`).replace( previewUrl.value = encodeURIComponent(`/file/${configStore.configChannel[configStore.configID].id}${fullPath}`).replace(
/%2F/g, /%2F/g,
'/' '/'
) )
@ -493,7 +493,7 @@ async function deleteFileOrFolder(del: boolean) {
showDeleteModal.value = false showDeleteModal.value = false
if (del) { if (del) {
await fetch(`/api/file/${configStore.configGui[configStore.configID].id}/remove/`, { await fetch(`/api/file/${configStore.configChannel[configStore.configID].id}/remove/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: deleteName.value }), body: JSON.stringify({ source: deleteName.value }),
@ -524,7 +524,7 @@ async function renameFile(ren: boolean) {
showRenameModal.value = false showRenameModal.value = false
if (ren && renameOldName.value !== renameNewName.value) { if (ren && renameOldName.value !== renameNewName.value) {
await fetch(`/api/file/${configStore.configGui[configStore.configID].id}/rename/`, { await fetch(`/api/file/${configStore.configChannel[configStore.configID].id}/rename/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: renameOldName.value, target: renameNewName.value }), body: JSON.stringify({ source: renameOldName.value, target: renameNewName.value }),
@ -563,7 +563,7 @@ async function createFolder(create: boolean) {
return return
} }
await $fetch(`/api/file/${configStore.configGui[configStore.configID].id}/create-folder/`, { await $fetch(`/api/file/${configStore.configChannel[configStore.configID].id}/create-folder/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: path }), body: JSON.stringify({ source: path }),
@ -600,7 +600,7 @@ async function upload(file: any): Promise<null | undefined> {
return new Promise((resolve) => { return new Promise((resolve) => {
xhr.value.open( xhr.value.open(
'PUT', 'PUT',
`/api/file/${configStore.configGui[configStore.configID].id}/upload/?path=${encodeURIComponent( `/api/file/${configStore.configChannel[configStore.configID].id}/upload/?path=${encodeURIComponent(
mediaStore.crumbs[mediaStore.crumbs.length - 1].path mediaStore.crumbs[mediaStore.crumbs.length - 1].path
)}` )}`
) )

View File

@ -266,7 +266,7 @@ onMounted(() => {
}) })
async function getPreset(index: number) { async function getPreset(index: number) {
fetch(`/api/presets/${configStore.configGui[configStore.configID].id}`, { fetch(`/api/presets/${configStore.configChannel[configStore.configID].id}`, {
method: 'GET', method: 'GET',
headers: authStore.authHeader, headers: authStore.authHeader,
}) })
@ -347,7 +347,7 @@ async function savePreset() {
: form.value.boxColor + '@' + numberToHex(form.value.boxAlpha), : form.value.boxColor + '@' + numberToHex(form.value.boxAlpha),
boxborderw: form.value.border, boxborderw: form.value.border,
alpha: form.value.overallAlpha, alpha: form.value.overallAlpha,
channel_id: configStore.configGui[configStore.configID].id, channel_id: configStore.configChannel[configStore.configID].id,
} }
const response = await fetch(`/api/presets/${form.value.id}`, { const response = await fetch(`/api/presets/${form.value.id}`, {
@ -386,7 +386,7 @@ async function createNewPreset(create: boolean) {
: form.value.boxColor + '@' + numberToHex(form.value.boxAlpha), : form.value.boxColor + '@' + numberToHex(form.value.boxAlpha),
boxborderw: form.value.border.toString(), boxborderw: form.value.border.toString(),
alpha: form.value.overallAlpha.toString(), alpha: form.value.overallAlpha.toString(),
channel_id: configStore.configGui[configStore.configID].id, channel_id: configStore.configChannel[configStore.configID].id,
} }
const response = await fetch('/api/presets/', { const response = await fetch('/api/presets/', {
@ -433,7 +433,7 @@ async function submitMessage() {
boxborderw: form.value.border.toString(), boxborderw: form.value.border.toString(),
} }
const response = await fetch(`/api/control/${configStore.configGui[configStore.configID].id}/text/`, { const response = await fetch(`/api/control/${configStore.configChannel[configStore.configID].id}/text/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify(obj), body: JSON.stringify(obj),

View File

@ -305,7 +305,7 @@ function setPreviewData(path: string) {
previewUrl.value = path previewUrl.value = path
} else { } else {
previewUrl.value = encodeURIComponent( previewUrl.value = encodeURIComponent(
`/file/${configStore.configGui[configStore.configID].id}${fullPath}` `/file/${configStore.configChannel[configStore.configID].id}${fullPath}`
).replace(/%2F/g, '/') ).replace(/%2F/g, '/')
} }
@ -435,7 +435,7 @@ async function importPlaylist(imp: boolean) {
playlistStore.isLoading = true playlistStore.isLoading = true
await $fetch( await $fetch(
`/api/file/${configStore.configGui[configStore.configID].id}/import/?file=${textFile.value[0].name}&date=${ `/api/file/${configStore.configChannel[configStore.configID].id}/import/?file=${textFile.value[0].name}&date=${
listDate.value listDate.value
}`, }`,
{ {
@ -468,11 +468,11 @@ async function savePlaylist(save: boolean) {
const saveList = processPlaylist(listDate.value, $_.cloneDeep(playlistStore.playlist), true) const saveList = processPlaylist(listDate.value, $_.cloneDeep(playlistStore.playlist), true)
await $fetch(`/api/playlist/${configStore.configGui[configStore.configID].id}/`, { await $fetch(`/api/playlist/${configStore.configChannel[configStore.configID].id}/`, {
method: 'POST', method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ body: JSON.stringify({
channel: configStore.configGui[configStore.configID].name, channel: configStore.configChannel[configStore.configID].name,
date: targetDate.value, date: targetDate.value,
program: saveList, program: saveList,
}), }),
@ -495,7 +495,7 @@ async function deletePlaylist(del: boolean) {
showDeleteModal.value = false showDeleteModal.value = false
if (del) { if (del) {
await $fetch(`/api/playlist/${configStore.configGui[configStore.configID].id}/${listDate.value}`, { await $fetch(`/api/playlist/${configStore.configChannel[configStore.configID].id}/${listDate.value}`, {
method: 'DELETE', method: 'DELETE',
headers: { ...configStore.contentType, ...authStore.authHeader }, headers: { ...configStore.contentType, ...authStore.authHeader },
}).then(() => { }).then(() => {

View File

@ -6,8 +6,8 @@ export const useConfig = defineStore('config', {
configID: 0, configID: 0,
configCount: 0, configCount: 0,
contentType: { 'content-type': 'application/json;charset=UTF-8' }, contentType: { 'content-type': 'application/json;charset=UTF-8' },
configGui: [] as GuiConfig[], configChannel: [] as GuiConfig[],
configGuiRaw: [] as GuiConfig[], configChannelRaw: [] as GuiConfig[],
playlistLength: 86400.0, playlistLength: 86400.0,
playout: {} as any, playout: {} as any,
currentUser: '', currentUser: '',
@ -48,8 +48,8 @@ export const useConfig = defineStore('config', {
.then((response) => response.json()) .then((response) => response.json())
.then((objs) => { .then((objs) => {
this.utcOffset = objs[0].utc_offset this.utcOffset = objs[0].utc_offset
this.configGui = objs this.configChannel = objs
this.configGuiRaw = _.cloneDeep(objs) this.configChannelRaw = _.cloneDeep(objs)
this.configCount = objs.length this.configCount = objs.length
}) })
.catch((e) => { .catch((e) => {
@ -61,14 +61,12 @@ export const useConfig = defineStore('config', {
navigateTo('/') navigateTo('/')
} }
this.configGui = [ this.configChannel = [
{ {
id: 1, id: 1,
config_path: '',
extra_extensions: '', extra_extensions: '',
name: 'Channel 1', name: 'Channel 1',
preview_url: '', preview_url: '',
service: '',
uts_offset: 0, uts_offset: 0,
}, },
] ]
@ -82,7 +80,7 @@ export const useConfig = defineStore('config', {
const stringObj = _.cloneDeep(obj) const stringObj = _.cloneDeep(obj)
let response let response
if (this.configGuiRaw.some((e) => e.id === stringObj.id)) { if (this.configChannelRaw.some((e) => e.id === stringObj.id)) {
response = await fetch(`/api/channel/${obj.id}`, { response = await fetch(`/api/channel/${obj.id}`, {
method: 'PATCH', method: 'PATCH',
headers: { ...this.contentType, ...authStore.authHeader }, headers: { ...this.contentType, ...authStore.authHeader },
@ -98,7 +96,7 @@ export const useConfig = defineStore('config', {
const json = await response.json() const json = await response.json()
const guiConfigs = [] const guiConfigs = []
for (const obj of this.configGui) { for (const obj of this.configChannel) {
if (obj.name === stringObj.name) { if (obj.name === stringObj.name) {
guiConfigs.push(json) guiConfigs.push(json)
} else { } else {
@ -106,8 +104,8 @@ export const useConfig = defineStore('config', {
} }
} }
this.configGui = guiConfigs this.configChannel = guiConfigs
this.configGuiRaw = _.cloneDeep(guiConfigs) this.configChannelRaw = _.cloneDeep(guiConfigs)
this.configCount = guiConfigs.length this.configCount = guiConfigs.length
} }
@ -121,7 +119,7 @@ export const useConfig = defineStore('config', {
const { timeToSeconds } = stringFormatter() const { timeToSeconds } = stringFormatter()
const authStore = useAuth() const authStore = useAuth()
const indexStore = useIndex() const indexStore = useIndex()
const channel = this.configGui[this.configID].id const channel = this.configChannel[this.configID].id
await fetch(`/api/playout/config/${channel}`, { await fetch(`/api/playout/config/${channel}`, {
method: 'GET', method: 'GET',
@ -146,7 +144,7 @@ export const useConfig = defineStore('config', {
async setPlayoutConfig(obj: any) { async setPlayoutConfig(obj: any) {
const { timeToSeconds } = stringFormatter() const { timeToSeconds } = stringFormatter()
const authStore = useAuth() const authStore = useAuth()
const channel = this.configGui[this.configID].id const channel = this.configChannel[this.configID].id
this.playlistLength = timeToSeconds(obj.playlist.length) this.playlistLength = timeToSeconds(obj.playlist.length)
this.playout.playlist.startInSec = timeToSeconds(obj.playlist.day_start) this.playout.playlist.startInSec = timeToSeconds(obj.playlist.day_start)

View File

@ -23,7 +23,7 @@ export const useMedia = defineStore('media', {
const authStore = useAuth() const authStore = useAuth()
const configStore = useConfig() const configStore = useConfig()
const indexStore = useIndex() const indexStore = useIndex()
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
const crumbs: Crumb[] = [] const crumbs: Crumb[] = []
let root = '/' let root = '/'

View File

@ -35,7 +35,7 @@ export const usePlaylist = defineStore('playlist', {
const authStore = useAuth() const authStore = useAuth()
const configStore = useConfig() const configStore = useConfig()
const indexStore = useIndex() const indexStore = useIndex()
const channel = configStore.configGui[configStore.configID].id const channel = configStore.configChannel[configStore.configID].id
await $fetch<Playlist>(`/api/playlist/${channel}?date=${date}`, { await $fetch<Playlist>(`/api/playlist/${channel}?date=${date}`, {
method: 'GET', method: 'GET',

2
types/index.d.ts vendored
View File

@ -23,11 +23,9 @@ declare global {
interface GuiConfig { interface GuiConfig {
id: number id: number
config_path: string
extra_extensions: string | string[] extra_extensions: string | string[]
name: string name: string
preview_url: string preview_url: string
service: string
uts_offset?: number uts_offset?: number
} }