From cfe5f122515c17e054dda5f3252c18c8c169dacc Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Sun, 5 Feb 2017 19:02:15 +0100 Subject: [PATCH] Update to presenter tool --- presenter/convert.sh | 12 ---------- presenter/getfiles.pl | 19 +++++++++++---- presenter/index.pl | 15 ++++++++++-- presenter/scripts.js | 38 ++++++++--------------------- presenter/showPic.pl | 10 ++++---- presenter/showroom.pl | 12 ++++++---- presenter/style.css | 52 ++++++++++++++++++++++++---------------- presenter/uploadFiles.pl | 5 ++++ 8 files changed, 86 insertions(+), 77 deletions(-) diff --git a/presenter/convert.sh b/presenter/convert.sh index 6d7d770..0f12dff 100755 --- a/presenter/convert.sh +++ b/presenter/convert.sh @@ -1,14 +1,2 @@ #!/bin/bash -#convert \ -#-density 480 $1 -resize 25% \ -#-set filename:f '%t.%e' \ -#-flatten \ -#-colorspace rgb \ -#-background white \ -#-depth 8 \ -#-quality 84 \ -#PNG:'%[filename:1].png' - -#convert -density 300x300 -resize 1440x900 -quality 80 $1 `echo $1|cut -f1 -d'.'`.png;\ - pdftoppm -png -r 300 -scale-to 1400 $1 $2 diff --git a/presenter/getfiles.pl b/presenter/getfiles.pl index c70caff..1bc05d3 100755 --- a/presenter/getfiles.pl +++ b/presenter/getfiles.pl @@ -15,13 +15,24 @@ if (!($room =~ /^[a-zA-Z0-9]+$/) || !(-d "store/$room")) { my $cmd = "cd store;cd $room; ls -1 -v"; my @files = qx($cmd); -print "\n"; +foreach my $f (@files) { + chomp($f); + next if $f eq "currentstate"; + next if $f eq "thumb"; + print "\n"; } print ""; - - diff --git a/presenter/index.pl b/presenter/index.pl index ff8d763..617f569 100755 --- a/presenter/index.pl +++ b/presenter/index.pl @@ -16,7 +16,8 @@ print <

Remote Presenter

- HDOC my @files = qx(cd store; ls -1 -v ); @@ -28,6 +29,16 @@ foreach my $f (@files) { print <
+ +

Usage summary

+
    +
  • The menu hides on the left side of the screen - move your pointer there or click close to the boarder of the window +
  • File upload: First select a file (jpg, png, gif or pdf only), then click upload. Converting PDFs might take a moment +
  • Click on an image to show to all connected viewers +
  • "View" - the selected image is shown in a new browser window, the public view is not changed +
  • "Delete" - delete the selected files from the list above +
  • Click anywhere in the image to set a red pointer for everybody to see +
  • Images can be changed by using the arrow keys -HDOC \ No newline at end of file +HDOC diff --git a/presenter/scripts.js b/presenter/scripts.js index d7b2c48..3eb1665 100644 --- a/presenter/scripts.js +++ b/presenter/scripts.js @@ -32,8 +32,8 @@ function updatefiles() { } function present(f) { - if(f != "") { - getData("showPic.pl?img="+f+"&room="+currentRoom+'&posx=-1&posy=-1'); + if(f) { + getData("showPic.pl?img="+f.getAttribute('data-file')+"&room="+currentRoom+'&posx=-1&posy=-1'); } else { alert("Select a file to show!"); @@ -45,14 +45,14 @@ function presentNext(d) { else if(d==38 || d==33) d=-1; else return true; current = currentPic.split(',',1); - for(i=0;i
     
    '; - - c = currentPic.split(',',1); - document.getElementById('current').innerHTML = "Current: "+c[0]; } setTimeout('getData("getPic.pl?old='+t+'&room='+currentRoom+'",null,updatepresentation)',1000); } -function preview(f) { - document.getElementById("preview").innerHTML = ''; - } - -function previewSelected() { - f = document.getElementById("filelist").value; - document.getElementById("preview").innerHTML = ''; - } - - -function togglemulti() { - document.getElementById("filelist").setAttribute('multiple','multiple'); - } - - setTimeout('updatefiles();',500); setTimeout('updatepresentation(" ");',200); diff --git a/presenter/showPic.pl b/presenter/showPic.pl index 0066cb5..ee8bdb1 100755 --- a/presenter/showPic.pl +++ b/presenter/showPic.pl @@ -9,23 +9,23 @@ my $cgi = new CGI(); my $room = $cgi->param("room"); if (!($room =~ /^[a-zA-Z0-9]+$/) || !(-d "store/$room")) { print "Invalid room"; - return 1; + exit 1; } my $t = $cgi->param("img"); -if($t =~ /[\"\$\(\)\/]/ || !(-e "store/$room/$t")) { +if(!($t =~ /^[a-zA-Z0-9\.\-_]+$/) || $t =~ /[\"\$\(\)\/]/ || !(-e "store/$room/$t")) { print "Invalid selection"; - return 1; + exit 1; } my $tmp = $cgi->param("posx").','.$cgi->param("posy"); if(!($tmp =~ /^-?[0-9]+,-?[0-9]+$/)) { print "Invalid Position"; - return 1; + exit 1; } $t .= ','.$tmp; system("echo $t>store/$room/currentstate"); -1; \ No newline at end of file +1; diff --git a/presenter/showroom.pl b/presenter/showroom.pl index cc51d02..a1a43af 100755 --- a/presenter/showroom.pl +++ b/presenter/showroom.pl @@ -33,16 +33,18 @@ print < - + +
     
    - -
    - -
    You can use arrow keys to change slides! + + + HDOC diff --git a/presenter/style.css b/presenter/style.css index 66585e0..7d830c1 100644 --- a/presenter/style.css +++ b/presenter/style.css @@ -16,7 +16,7 @@ body { color:#888; font-family: sans-serif; height: 100%; - overflow:hidden; + overflow:hidden !important; margin:0; padding-left:20px; } @@ -24,6 +24,7 @@ body { body.title { background:#f0f0ea; padding:0; + margin-left: 20px; } h1 { @@ -39,10 +40,12 @@ h1 { left:-200px; position:absolute; top:0; + padding-left:10px; border-right:70px solid #000; background:#ccb; transition:left 0.6s 3s ease-out, border 0.6s 3s ease-out; - overflow:hidden; + overflow-y:scroll !important; + overflow-x:hidden; } #control:hover { @@ -66,11 +69,11 @@ h1 { #content img { height:100%; -/* width:100%; */ + width:100%; max-height:100%; max-width:100%; object-fit:contain; - margin:0 auto; + margin:auto; padding:0; } @@ -82,13 +85,6 @@ h1 { width:180px; } -/* -@keyframes pointerani { - 0% {width:25px;height:25px;margin:0;} - 100% {width:20px;height:20px;margin:2.5px 0 0 2.5px;} -} -*/ - @keyframes pointerani { 0% {opacity:.2;} 100% {opacity:.7;} @@ -103,17 +99,31 @@ h1 { opacity:0.7; border-radius:15px; position:absolute; - //animation: pointerani 1s infinite alternate; } -#preview { - width:205px; - border:1px solid #aaa; - margin:1px; + +#files div { + padding-top:2px; + border-bottom:1px solid #aaa; + clear:both; + +} + +#files img { + margin:auto; + max-height:100px; + max-width:150px; + object-fit:contain; position:relative; - left:5px; - padding:1px; - text-align:center; - background:white; - } +} +#files button { + font-size:80%; + width:35px; + display:block; + float:right; + margin-right:5px; + padding:0px; + } + + diff --git a/presenter/uploadFiles.pl b/presenter/uploadFiles.pl index 487e514..3479767 100755 --- a/presenter/uploadFiles.pl +++ b/presenter/uploadFiles.pl @@ -20,6 +20,11 @@ my $basename = GetBasename($upfile); $basename =~ s-/--; $basename =~ s-\s--; +unless($basename =~ /^[a-zA-Z0-9\.\-_]+$/) { + print("Filename contains invalid characters. Only a-z A-Z 0-9 . _ - are allowed."); + exit(-1); + } + my $fh = $cgi->upload('upfile'); -- 2.43.0