Skip to content

Commit

Permalink
fixes issue #25
Browse files Browse the repository at this point in the history
  • Loading branch information
reaby committed Sep 19, 2022
1 parent 35aace9 commit a0b3ea7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions public/js/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ socket.on('callback.edit', function (data) {

$("#duration").val(data.slideData.duration || "");

if (slideData.epochStart != -1) {
if (slideData.epochStart && slideData.epochStart != -1) {
let d = new Date(slideData.epochStart);
let isoStr = (new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString()).slice(0, -1);
$("#enableStart").val(isoStr);
}

if (slideData.epochEnd != -1) {
if (slideData.epochStart && slideData.epochEnd != -1) {
let d = new Date(slideData.epochEnd);
let isoStr = (new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString()).slice(0, -1);
$("#enableEnd").val(isoStr);
Expand Down
6 changes: 3 additions & 3 deletions routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export default function (pluginManager, websocket, dispatcher) {
fields[fieldname] = val;
});

req.busboy.on('file', function (fieldname, file, filename, encoding, mimeType) {
req.busboy.on('file', function (fieldname, file, details) {
if (fieldname === "newBackground")
if (filename.length > 0 && (mimeType === "image/jpeg" || mimeType === "video/mp4" || mimeType === "image/png")) {
let fstream = fs.createWriteStream('./data/backgrounds/' + filename);
if (details.filename.length > 0 && (details.mimeType === "image/jpeg" || details.mimeType === "video/mp4" || details.mimeType === "image/png")) {
let fstream = fs.createWriteStream('./data/backgrounds/' + details.filename);
file.pipe(fstream);
} else {
file.resume();
Expand Down
4 changes: 1 addition & 3 deletions views/admin/editSlide.twig
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@
<canvas id="tempCanvas" width="1920" height="1080" style="display: none"></canvas>

<script>
var socket = io.connect("{{ config.serverUrl }}:{{ config.serverListenPort }}/admin-" + displayId);
</script>
<script>
var socket = io("{{ config.serverUrl }}/admin-{{ displayId }}");
var images = {};
$('.ui.button').popup({
delay: {
Expand Down

0 comments on commit a0b3ea7

Please sign in to comment.