diff --git a/locales/de/translation.json b/locales/de/translation.json index 7246238..129c397 100644 --- a/locales/de/translation.json +++ b/locales/de/translation.json @@ -68,6 +68,8 @@ "backgroundfile": "Datei auswählen", "msgupload": "Hier können Sie einen neuen Hintergrund (.jpg oder .mp4) hochladen.", "background": "Hintergrund", + "backgroundDelete": "Hintergrund löschen", + "backgroundDeleteAsk": "Sind Sie sicher, dass sie die folgende Hintergrundsdatei permanent aus allen Paketen löschen wollen: ", "transition": "Standardübergang (wird beim Neustart angewendet)", "time": "Zeit / Datum anzeigen", "duration": "Anzeigedauer", diff --git a/locales/en/translation.json b/locales/en/translation.json index 6c0a577..c8c204a 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -68,6 +68,8 @@ "backgroundfile": "Select a file", "msgupload": "You can upload a new background (.jpg or .mp4) here.", "background": "Background", + "backgroundDelete": "Delete Background", + "backgroundDeleteAsk": "Are you sure you want to permanently delete the following background file from all bundles: ", "transition": "Default transition (applied on restart)", "time": "Display time", "duration": "Default duration", diff --git a/locales/fi/translation.json b/locales/fi/translation.json index 2acadc3..a500bf2 100644 --- a/locales/fi/translation.json +++ b/locales/fi/translation.json @@ -66,6 +66,8 @@ "msg1": "Suurin osa asetuksista otetaan käyttöön seuraavan dian vaihtuessa.", "name": "Nimi", "background": "Tausta", + "backgroundDelete": "Poista Tausta", + "backgroundDeleteAsk": "Haluatko varmasti poistaa seuraavan taustatiedoston pysyvästi kaikista diapaketeista: ", "transition": "Oletussiirtymä", "backgroundfile": "Valitse tiedosto", "msgupload": "Voit ladata uuden taustakuvan (.jpg or .mp4) alta.", diff --git a/modules/adminLobby.js b/modules/adminLobby.js index 54047ca..aa8fe52 100644 --- a/modules/adminLobby.js +++ b/modules/adminLobby.js @@ -1,4 +1,6 @@ -import cli from './cli.js' +import fs from 'fs'; +import cli from './cli.js'; +import { checkAndSanitizeFilePathName } from './utils.js'; export default class adminLobby { @@ -89,6 +91,17 @@ export default class adminLobby { } }); + socket.on('admin.deleteBackground', function (data) { + try { + data.name = checkAndSanitizeFilePathName(data.name); + fs.unlinkSync("./data/backgrounds/" + data.name); + cli.success("delete " + data.name); + socket.emit("callback.admin.reload", {}); + } catch (err) { + cli.error(err, "delete background"); + socket.emit("callback.admin.reload", {error: err}); + } + }); socket.on('controls.previous', function (data) { getAdminView(data.displayId).controls("previous"); diff --git a/public/js/dashboard.js b/public/js/dashboard.js index a222ce8..2ab5cd5 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -382,7 +382,7 @@ function updateSlides(slides) { } function editBundleProperties(bundle) { - window.open("/admin/edit/bundleProperties?bundle=" + bundle, '_blank', 'width=400,height=800,scrollbars=yes,status=no,location=no'); + window.open("/admin/edit/bundleProperties?bundle=" + bundle, '_blank', 'width=450,height=800,scrollbars=yes,status=no,location=no'); } function editBundleSlides(name) { diff --git a/views/admin/editBundleProperties.twig b/views/admin/editBundleProperties.twig index e87eb2f..6417ec2 100644 --- a/views/admin/editBundleProperties.twig +++ b/views/admin/editBundleProperties.twig @@ -1,7 +1,11 @@ {% extends 'layout/admin.twig' %} {% block header %} - + {% if config.useLocalAssets %} + + {% else %} + + {% endif %} {% endblock %} @@ -23,11 +27,14 @@