Skip to content

Commit

Permalink
multiple fixes to GUI and API
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippMundhenk committed Oct 28, 2023
1 parent 6c298fc commit 2a36f48
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN apt-get -y install \
lighttpd \
php-cgi \
php-curl \
sudo \
&& apt-get -y clean

RUN cd /tmp && \
Expand All @@ -41,6 +42,7 @@ RUN cp /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/
RUN mkdir -p /var/run/lighttpd
RUN touch /var/run/lighttpd/php-fastcgi.socket
RUN chown -R www-data /var/run/lighttpd
RUN echo 'www-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

ENV NAME="Scanner"
ENV MODEL="MFC-L2700DW"
Expand Down
4 changes: 2 additions & 2 deletions files/api/scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
$target = $_GET["target"];
if (empty($target)) {
header($_SERVER["SERVER_PROTOCOL"] . " 400 OK");
die("Error: No scanning function selected (try append: ?target=<file|email|image|ocr>");
die("Error: No scanning function selected (try append: ?target=<file|email|image|ocr>)");
}
if (in_array($target, array('file','email','image','ocr'))) {
$output = shell_exec('/opt/brother/scanner/brscan-skey/script/scanto'.$target.'.sh >> /var/log/scanner.log 2>&1');
$output = exec('sudo -u NAS /opt/brother/scanner/brscan-skey/script/scanto'.$target.'.sh >> /var/log/scanner.log 2>&1');
}
else
{
Expand Down
40 changes: 17 additions & 23 deletions files/gui/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
<link rel="stylesheet" href="main.css">
<title>Brother Scanner</title>
<?php
$button_file = $_ENV["RENAME_GUI_SCANTOFILE"];
if(empty($_ENV["RENAME_GUI_SCANTOFILE"]))
{
if (array_key_exists('RENAME_GUI_SCANTOFILE', $_ENV)) {
$button_file = $_ENV["RENAME_GUI_SCANTOFILE"];
} else {
$button_file = "Scan to file";
}
$button_email = $_ENV["RENAME_GUI_SCANTOEMAIL"];
if(empty($_ENV["RENAME_GUI_SCANTOEMAIL"]))
{
if (array_key_exists('RENAME_GUI_SCANTOEMAIL', $_ENV)) {
$button_email = $_ENV["RENAME_GUI_SCANTOEMAIL"];
} else {
$button_email = "Scan to email";
}
$button_image = $_ENV["RENAME_GUI_SCANTOIMAGE"];
if(empty($_ENV["RENAME_GUI_SCANTOIMAGE"]))
{
if (array_key_exists('RENAME_GUI_SCANTOIMAGE', $_ENV)) {
$button_image = $_ENV["RENAME_GUI_SCANTOIMAGE"];
} else {
$button_image = "Scan to image";
}
$button_ocr = $_ENV["RENAME_GUI_SCANTOOCR"];
if(empty($_ENV["RENAME_GUI_SCANTOOCR"]))
{
if (array_key_exists('RENAME_GUI_SCANTOIMAGE', $_ENV)) {
$button_ocr = $_ENV["RENAME_GUI_SCANTOOCR"];
} else {
$button_ocr = "Scan to OCR";
}
?>
Expand All @@ -31,17 +31,11 @@
<div class="form">
<div class="title">Brother Scanner</div>
<div class="cut cut-long"></div>
<form action="/scan.php?target=file" method="get">
<button type="submit" name="action" class="submit"><?php $button_file ?></button>
</form>
<form action="/scan.php?target=email" method="get">
<button type="submit" name="action" class="submit"><?php $button_email ?></button>
</form>
<form action="/scan.php?target=image" method="get">
<button type="submit" name="action" class="submit"><?php $button_image ?></button>
</form>
<form action="/scan.php?target=ocr" method="get">
<button type="submit" name="action" class="submit"><?php $button_ocr ?></button>
<form action="/scan.php" method="get">
<button type="submit" name="target" value="file" class="submit"><?php $button_file ?></button>
<button type="submit" name="target" value="email" class="submit"><?php $button_email ?></button>
<button type="submit" name="target" value="image" class="submit"><?php $button_image ?></button>
<button type="submit" name="target" value="ocr" class="submit"><?php $button_ocr ?></button>
</form>
</div>
</body>
Expand Down

0 comments on commit 2a36f48

Please sign in to comment.