add missing translations, add error about forbidden folder access

This commit is contained in:
jb-alvarado 2024-05-27 12:01:31 +02:00
parent 0d28abcd40
commit 8d63cc4f85
13 changed files with 72 additions and 30 deletions

View File

@ -168,7 +168,7 @@ async function onSubmitPlayout() {
configStore.onetimeInfo = true
if (update.status === 200) {
indexStore.msgAlert('success', 'Update playout config success!', 2)
indexStore.msgAlert('success', t('config.updatePlayoutSuccess'), 2)
const channel = configStore.configGui[configStore.configID].id
@ -182,7 +182,7 @@ async function onSubmitPlayout() {
}
})
} else {
indexStore.msgAlert('error', 'Update playout config failed!', 2)
indexStore.msgAlert('error', t('config.updatePlayoutFailed'), 2)
}
}

View File

@ -268,6 +268,7 @@
</template>
<script setup lang="ts">
const { $dayjs } = useNuxtApp()
const { t } = useI18n()
const { width } = useWindowSize({ initialWidth: 800 })
const authStore = useAuth()
@ -409,7 +410,7 @@ async function generatePlaylist() {
.then((response: any) => {
playlistStore.playlist = processPlaylist(playlistStore.listDate, response.program, false)
prop.switchClass()
indexStore.msgAlert('success', 'Generate Playlist done...', 2)
indexStore.msgAlert('success', t('player.generateDone'), 2)
})
.catch((e: any) => {
indexStore.msgAlert('error', e.data ? e.data : e, 4)

View File

@ -86,6 +86,7 @@ export default {
all: 'Alle',
addBlock: 'Zeitblock hinzufügen',
infinitInfo: 'Die Wiedergabe läuft im unendlichen Modus. Es sind keine zeitbasierten Informationen möglich.',
generateDone: 'Wiedergabeliste generieren erledigt...',
},
media: {
notExists: 'Speicher existiert nicht!',
@ -128,6 +129,10 @@ export default {
borderWidth: 'Rahmenbreite',
send: 'Senden',
name: 'Name',
saveDone: 'Voreinstellung gespeichert!',
saveFailed: 'Voreinstellung speichern fehlgeschlagen!',
sendDone: 'Erfolgreich gesendet...',
sendFailed: 'Senden fehlgeschlagen...',
},
log: {
download: 'Protokoll herunterladen',
@ -182,6 +187,10 @@ export default {
outText: `Die endgültige Playout-Kompression. Passen Sie die Einstellungen entsprechend Ihren Bedürfnissen an. 'mode' hat die Optionen 'desktop', 'hls', 'null', 'stream'. Verwenden Sie 'stream' und passen Sie die 'output_param:'-Einstellungen an, wenn Sie zu einem rtmp/rtsp/srt/... Server streamen wollen. In der Produktion sollten Sie die hls-Wiedergabeliste nicht mit ffpapi ausliefern, sondern nginx oder einen anderen Webserver verwenden!`,
restartTile: 'Playout neustarten',
restartText: 'ffplayout neustarten um Einstellungen anzuwenden?',
updatePlayoutSuccess: 'Update der Playout-Konfiguration erfolgreich!',
updatePlayoutFailed: 'Update playout config fehlgeschlagen!',
forbiddenPlaylistPath: 'Zugriff untersagt: Playlist-Ordner kann nicht geöffnet werden.',
noPlayoutConfig: 'Keine Playout-Konfiguration gefunden!',
},
user: {
title: 'Benutzer-Konfiguration',

View File

@ -86,6 +86,7 @@ export default {
all: 'All',
addBlock: 'Add time block',
infinitInfo: 'Playout runs in infinite mode. No time based information is possible.',
generateDone: 'Generate Playlist done...',
},
media: {
notExists: 'Storage not exist!',
@ -128,6 +129,10 @@ export default {
borderWidth: 'Border Width',
send: 'Send',
name: 'Name',
saveDone: 'Save Preset done!',
saveFailed: 'Save Preset failed!',
sendDone: 'Sending success...',
sendFailed: 'Sending failed...',
},
log: {
download: 'Download log file',
@ -181,6 +186,10 @@ export default {
outText: `The final playout compression. Adjust the settings according to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust the 'output_param:' settings if you want to stream to an rtmp/rtsp/srt/... server. In production don't serve hls playlist with ffpapi, use nginx or another web server!`,
restartTile: 'Restart Playout',
restartText: 'Restart ffplayout to apply changes?',
updatePlayoutSuccess: 'Update playout config success!',
updatePlayoutFailed: 'Update playout config failed!',
forbiddenPlaylistPath: 'Access forbidden: Playlist folder cannot be opened.',
noPlayoutConfig: 'No playout config found!',
},
user: {
title: 'User Configuration',

View File

@ -86,6 +86,7 @@ export default {
all: 'Todos',
addBlock: 'Adicionar bloco de tempo',
infinitInfo: 'O playout é executado no modo infinito. Nenhuma informação baseada em tempo é possível',
generateDone: 'Gerar lista de reprodução concluída...',
},
media: {
notExists: 'O armazenamento não existe!',
@ -128,6 +129,10 @@ export default {
borderWidth: 'Largura da borda',
send: 'Enviar',
name: 'Nome',
saveDone: 'Salvar predefinição concluída!',
saveFailed: 'Falha ao salvar a predefinição!',
sendDone: 'Enviando com sucesso...',
sendFailed: 'O envio falhou...',
},
log: {
download: 'Baixar arquivo de registro',
@ -181,6 +186,10 @@ export default {
outText: `A compressão final do stream gerado pelo playout. Ajuste as configurações de acordo com suas necessidades. 'mode' possui as opções 'desktop', 'hls', 'null', 'stream'. Use 'stream' e ajuste as configurações de 'output_param:' se você desejar retransmitir o stream para um servidor rtmp/rtsp/srt/... Em ambiente de produção não sirva a playlist hls com ffpapi, use nginx ou outro servidor web!`,
restartTile: 'Reiniciar Playout',
restartText: 'Reiniciar o ffplayout para aplicar as alterações?',
updatePlayoutSuccess: 'Sucesso na atualização da configuração do playout!',
updatePlayoutFailed: 'Falha na atualização da configuração do playout!',
forbiddenPlaylistPath: 'Acesso proibido: A pasta da lista de reprodução não pode ser aberta',
noPlayoutConfig: 'Nenhuma configuração de playout encontrada!',
},
user: {
title: 'Configuração de usuário',

View File

@ -86,6 +86,7 @@ export default {
all: 'Все',
addBlock: 'Добавить время начало передачи',
infinitInfo: 'Воспроизведение работает в бесконечном режиме. Никакая информация, основанная на времени, невозможна.',
generateDone: 'Генерация плейлиста завершена...',
},
media: {
notExists: 'Папки не существует!',
@ -128,6 +129,10 @@ export default {
borderWidth: 'Border Width',
send: 'Отправить в эфир',
name: 'Название',
saveDone: 'Сохранение предустановки выполнено!',
saveFailed: 'Сохранить пресет не удалось!',
sendDone: 'Отправка успешна...',
sendFailed: 'Отправка не удалась...',
},
log: {
download: 'Скачать лог файл',
@ -181,6 +186,10 @@ export default {
outText: `The final playout compression. Adjust the settings according to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust the 'output_param:' settings if you want to stream to an rtmp/rtsp/srt/... server. In production don't serve hls playlist with ffpapi, use nginx or another web server!`,
restartTile: 'Перезапуск Playout',
restartText: 'Перезапустить ffplayout для применения изменений?',
updatePlayoutSuccess: 'Обновление конфигурации воспроизведения прошло успешно!',
updatePlayoutFailed: 'Обновление конфигурации воспроизведения не удалось!',
forbiddenPlaylistPath: 'Доступ запрещен: Папка плейлиста не может быть открыта.',
noPlayoutConfig: 'Конфигурация воспроизведения не найдена!',
},
user: {
title: 'Конфигурация пользователя',

12
package-lock.json generated
View File

@ -1,17 +1,17 @@
{
"name": "ffplayout-frontend",
"version": "0.9.4",
"version": "0.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ffplayout-frontend",
"version": "0.9.4",
"version": "0.10.0",
"hasInstallScript": true,
"dependencies": {
"@nuxtjs/color-mode": "^3.4.1",
"@pinia/nuxt": "^0.5.1",
"@vuepic/vue-datepicker": "^8.6.0",
"@vuepic/vue-datepicker": "^8.7.0",
"@vueuse/nuxt": "^10.9.0",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.11",
@ -5063,9 +5063,9 @@
"integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA=="
},
"node_modules/@vuepic/vue-datepicker": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-8.6.0.tgz",
"integrity": "sha512-ZnG7xquVf7WyMKXk7JxWOJ5ursig1t8o2AtH9ycetiik+lemV9+HNEx+YOR1xeCUfhupGTgJmyAxCSZHP/Sv/w==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-8.7.0.tgz",
"integrity": "sha512-EqL51GdaRg6AExVuPCOmnO81n9+oLqgTi+LlST44TwU0UcX0UfefHx1HXwV948fAqBgj0ESgTyDvjXx7EFFL2A==",
"dependencies": {
"date-fns": "^3.6.0"
},

View File

@ -1,6 +1,6 @@
{
"name": "ffplayout-frontend",
"version": "0.9.4",
"version": "0.10.0",
"description": "Web GUI for ffplayout",
"author": "Jonathan Baecker",
"private": true,
@ -15,7 +15,7 @@
"dependencies": {
"@nuxtjs/color-mode": "^3.4.1",
"@pinia/nuxt": "^0.5.1",
"@vuepic/vue-datepicker": "^8.6.0",
"@vuepic/vue-datepicker": "^8.7.0",
"@vueuse/nuxt": "^10.9.0",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.11",

View File

@ -223,6 +223,7 @@
</template>
<script setup lang="ts">
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
@ -356,9 +357,9 @@ async function savePreset() {
})
if (response.status === 200) {
indexStore.msgAlert('success', 'Save Preset done!', 2)
indexStore.msgAlert('success', t('message.saveDone'), 2)
} else {
indexStore.msgAlert('error', 'Save Preset failed!', 2)
indexStore.msgAlert('error', t('message.saveFailed'), 2)
}
}
}
@ -395,10 +396,10 @@ async function createNewPreset(create: boolean) {
})
if (response.status === 200) {
indexStore.msgAlert('success', 'Save Preset done!', 2)
indexStore.msgAlert('success', t('message.saveDone'), 2)
getPreset(-1)
} else {
indexStore.msgAlert('error', 'Save Preset failed!', 2)
indexStore.msgAlert('error', t('message.saveFailed'), 2)
}
}
@ -439,9 +440,9 @@ async function submitMessage() {
})
if (response.status === 200) {
indexStore.msgAlert('success', 'Sending success...', 2)
indexStore.msgAlert('success', t('message.sendDone'), 2)
} else {
indexStore.msgAlert('error', 'Sending failed...', 2)
indexStore.msgAlert('error', t('message.sendFailed'), 2)
}
}
</script>

View File

@ -117,6 +117,7 @@ export const useConfig = defineStore('config', {
},
async getPlayoutConfig() {
const { $i18n } = useNuxtApp()
const { timeToSeconds } = stringFormatter()
const authStore = useAuth()
const indexStore = useIndex()
@ -138,7 +139,7 @@ export const useConfig = defineStore('config', {
this.playout = data
})
.catch(() => {
indexStore.msgAlert('error', 'No playout config found!', 3)
indexStore.msgAlert('error', $i18n.t('config.noPlayoutConfig'), 3)
})
},

View File

@ -19,6 +19,7 @@ export const useMedia = defineStore('media', {
this.isLoading = true
}
const { $i18n } = useNuxtApp()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
@ -35,7 +36,7 @@ export const useMedia = defineStore('media', {
if (response.status === 200) {
return response.json()
} else {
indexStore.msgAlert('error', useNuxtApp().$i18n.t('media.notExists'), 3)
indexStore.msgAlert('error', $i18n.t('media.notExists'), 3)
return {
source: '',
@ -64,13 +65,13 @@ export const useMedia = defineStore('media', {
if (foldersOnly) {
this.folderCrumbs = crumbs
data.parent_folders = data.parent_folders.map((i: any) => ({ uid: genUID(), name: i }))
data.parent_folders = data.parent_folders?.map((i: any) => ({ uid: genUID(), name: i })) ?? []
data.folders = data.folders.map((i: any) => ({ uid: genUID(), name: i }))
this.folderList = data
} else {
this.currentPath = path
this.crumbs = crumbs
data.parent_folders = data.parent_folders.map((i: any) => ({ uid: genUID(), name: i }))
data.parent_folders = data.parent_folders?.map((i: any) => ({ uid: genUID(), name: i })) ?? []
data.folders = data.folders.map((i: any) => ({ uid: genUID(), name: i }))
this.folderTree = data
}

View File

@ -36,17 +36,11 @@ export const usePlaylist = defineStore('playlist', {
const configStore = useConfig()
const indexStore = useIndex()
const channel = configStore.configGui[configStore.configID].id
let statusCode = 0
await fetch(`/api/playlist/${channel}?date=${date}`, {
await $fetch<Playlist>(`/api/playlist/${channel}?date=${date}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => {
statusCode = response.status
return response.json()
})
.then((data) => {
if (data.program) {
const programData = processPlaylist(date, data.program, false)
@ -66,8 +60,10 @@ export const usePlaylist = defineStore('playlist', {
}
})
.catch((e) => {
if (statusCode >= 400) {
indexStore.msgAlert('error', e, 3)
if (e.status >= 403) {
indexStore.msgAlert('error', e.data, 5)
} else if (e.status >= 400) {
indexStore.msgAlert('error', e.data, 5)
} else if (this.playlist.length > 0 && this.playlist[0].date === date) {
indexStore.msgAlert('warning', $i18n.t('player.unsavedProgram'), 3)
} else {

6
types/index.d.ts vendored
View File

@ -51,6 +51,12 @@ declare global {
body?: any
}
interface Playlist {
channel: string
date: string
program: PlaylistItem[]
}
interface PlaylistItem {
date?: string
uid: string