Skip to content

Commit

Permalink
Merge pull request #23 from vgarcia007/custom01
Browse files Browse the repository at this point in the history
Upgrade web interface and Dockerfile
  • Loading branch information
PhilippMundhenk authored Sep 15, 2024
2 parents 7a55a32 + 1c67b59 commit 17bc755
Show file tree
Hide file tree
Showing 41 changed files with 10,003 additions and 239 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker-compose.yml
.vscode
!.vscode/launch.json
24 changes: 15 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN apt-get -y install \
php-curl \
sudo \
iproute2 \
jq \
&& apt-get -y clean

RUN cd /tmp && \
Expand Down Expand Up @@ -50,31 +51,36 @@ ENV MODEL="MFC-L2700DW"
ENV IPADDRESS="192.168.1.123"
ENV USERNAME="NAS"

#only set these variables, if inotify needs to be triggered (e.g., for Synology Drive):
#only set these variables in the compose file, if inotify needs to be triggered (e.g., for Synology Drive):
ENV SSH_USER=""
ENV SSH_PASSWORD=""
ENV SSH_HOST=""
ENV SSH_PATH=""

#only set these variables, if you need FTP upload:
#only set these variables in the compose file, if you need FTP upload:
ENV FTP_USER=""
ENV FTP_PASSWORD=""
ENV FTP_HOST=""

#only set these variables in the compose file, if you need Telegram notifications:
ENV TELEGRAM_TOKEN=""
ENV TELEGRAM_CHATID=""

# Make sure this ends in a slash.
ENV FTP_PATH="/scans/"

EXPOSE 54925
EXPOSE 54921
EXPOSE 80

ADD files/gui/index.php /var/www/html
ADD files/gui/main.css /var/www/html
ADD files/api/scan.php /var/www/html
ADD files/api/active.php /var/www/html
ADD files/api/list.php /var/www/html
ADD files/api/download.php /var/www/html
#ADD files/gui/index.php /var/www/html
#ADD files/gui/main.css /var/www/html
#ADD files/api/scan.php /var/www/html
#ADD files/api/active.php /var/www/html
#ADD files/api/list.php /var/www/html
#ADD files/api/download.php /var/www/html
COPY html /var/www/html
RUN chown -R www-data /var/www/

#directory for scans:
VOLUME /scans

Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: brotherscanner update-container

build: brotherscanner

brotherscanner:
docker build --no-cache -t brotherscanner -f Dockerfile .

update-container:
./update-container.sh
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ You can configure the tool via environment variables:
| RENAME_GUI_SCANTOIMAGE="Scan photo" | optional | renames GUI button "Scan to image" to "Scan photo" |
| RENAME_GUI_SCANTOOCR="Scan High-Res" | optional | renames GUI button "Scan to OCR" to "Scan High-Res" |
| USE_JPEG_COMPRESSION | optional | use JPEG compression when creating PDFs |
| TELEGRAM_TOKEN | optional | If TELEGRAM_TOKEN and TELEGRAM_CHATID are set, then this sends notification |
| TELEGRAM_CHATID | optional | If TELEGRAM_TOKEN and TELEGRAM_CHATID are set, then this sends notification |
### FTPS upload
In addition to the storage in the mounted volume, you can use FTPS (Secure FTP) Upload.
Expand Down Expand Up @@ -172,7 +175,8 @@ here is an example of the environment:
#### GUI
You can access the GUI under the IP of your container and the set port (or 80 in default case).
With the full config example below, the result will look something like this:
![Screenshot of web interface](doc/GUI.jpg)
![Screenshot of main web interface](doc/gui-main.jpg)
![Screenshot of file list web interface](doc/gui-filelist.jpg)
Note that the interface does not block when pressing a button.
Thus, make sure to wait for your scan to complete, before pressing another button.
Expand Down
Binary file removed doc/GUI.jpg
Binary file not shown.
Binary file added doc/gui-filelist.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/gui-main.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions docker-compose-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

services:
brother-scanner:
image: ghcr.io/philippmundhenk/brotherscannerdocker
volumes:
- /path/on/host:/scans
ports:
- 33355:33355
- 54925:54925/udp # mandatory, for scanner tools
- 54921:54921 # mandatory, for scanner tools
- 161:161/udp # mandatory, for scanner tools
environment:
- NAME=Scanner
- MODEL=MFC-L2700DW
- IPADDRESS=192.168.188.133 # scanner IP address
- UID=1000 # note: network mount needs to have correct permissions!
- GID=1000 # note: network mount needs to have correct permissions!
- TZ=Europe/Berlin
- HOST_IPADDRESS=192.168.188.117
- WEBSERVER=true
- RENAME_GUI_SCANTOFILE="Scan front pages"
- RENAME_GUI_SCANTOEMAIL="Scan rear pages"
- DISABLE_GUI_SCANTOOCR=true
- DISABLE_GUI_SCANTOIMAGE=true
- OCR_SERVER=192.168.188.117
- OCR_PORT=3217
- OCR_PATH=ocr.php
- TELEGRAM_TOKEN="" # note: keep the word bot in the string
- TELEGRAM_CHATID=127585497 # note: target chat id. can be person or group
restart: unless-stopped

# optional, for OCR
ocr:
image: ghcr.io/philippmundhenk/tesseractocrmicroservice
restart: unless-stopped
ports:
- 3217:80
8 changes: 0 additions & 8 deletions files/api/active.php

This file was deleted.

13 changes: 0 additions & 13 deletions files/api/list.php

This file was deleted.

62 changes: 0 additions & 62 deletions files/gui/index.php

This file was deleted.

144 changes: 0 additions & 144 deletions files/gui/main.css

This file was deleted.

30 changes: 30 additions & 0 deletions html/active.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

function isProcessRunning($processName) {
// Execute the pgrep command
$command = "pgrep $processName";
exec($command, $output, $status);

// Check if pgrep returned a status of 0, which means the process was found
if ($status === 0) {
// Process is running
return true;
} else {
// Process is not running
return false;
}
}

// Check if the scanimage, sleep, and curl processes are running
$result = array(
'scan' => isProcessRunning('scanimage'),
'waiting' => isProcessRunning('sleep'),
'ocr' => isProcessRunning('curl')
);


// Output the result as JSON
header('Content-Type: application/json; charset=utf-8');
echo json_encode($result);

?>
Loading

0 comments on commit 17bc755

Please sign in to comment.