mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-24 16:26:04 +02:00
ingress
This commit is contained in:
@@ -6,15 +6,10 @@
|
|||||||
"description": "filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files",
|
"description": "filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files",
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||||
"startup": "services",
|
"startup": "services",
|
||||||
"ingress": false,
|
"ingress": true,
|
||||||
"ingress_port": 8099,
|
"ingress_port": 8099,
|
||||||
"panel_icon": "mdi:file-search",
|
"panel_icon": "mdi:file-search",
|
||||||
"arch": [
|
"arch": ["aarch64", "amd64", "armv7", "armhf"],
|
||||||
"aarch64",
|
|
||||||
"amd64",
|
|
||||||
"armv7",
|
|
||||||
"armhf"
|
|
||||||
],
|
|
||||||
"ports": {
|
"ports": {
|
||||||
"8080/tcp": 8087
|
"8080/tcp": 8087
|
||||||
},
|
},
|
||||||
@@ -22,19 +17,9 @@
|
|||||||
"8080/tcp": "Web UI port"
|
"8080/tcp": "Web UI port"
|
||||||
},
|
},
|
||||||
"apparmor": true,
|
"apparmor": true,
|
||||||
"privileged": [
|
"privileged": ["SYS_ADMIN", "DAC_READ_SEARCH"],
|
||||||
"SYS_ADMIN",
|
|
||||||
"DAC_READ_SEARCH"
|
|
||||||
],
|
|
||||||
"full_access": true,
|
"full_access": true,
|
||||||
"map": [
|
"map": ["media:rw", "config:rw", "addons:rw", "backup:rw", "share:rw", "ssl"],
|
||||||
"media:rw",
|
|
||||||
"config:rw",
|
|
||||||
"addons:rw",
|
|
||||||
"backup:rw",
|
|
||||||
"share:rw",
|
|
||||||
"ssl"
|
|
||||||
],
|
|
||||||
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]",
|
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]",
|
||||||
"environment": {
|
"environment": {
|
||||||
"FB_BASEURL": "/filebrowser"
|
"FB_BASEURL": "/filebrowser"
|
||||||
|
|||||||
96
filebrowser/rootfs/etc/nginx/includes/mime.types
Normal file
96
filebrowser/rootfs/etc/nginx/includes/mime.types
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
types {
|
||||||
|
text/html html htm shtml;
|
||||||
|
text/css css;
|
||||||
|
text/xml xml;
|
||||||
|
image/gif gif;
|
||||||
|
image/jpeg jpeg jpg;
|
||||||
|
application/javascript js;
|
||||||
|
application/atom+xml atom;
|
||||||
|
application/rss+xml rss;
|
||||||
|
|
||||||
|
text/mathml mml;
|
||||||
|
text/plain txt;
|
||||||
|
text/vnd.sun.j2me.app-descriptor jad;
|
||||||
|
text/vnd.wap.wml wml;
|
||||||
|
text/x-component htc;
|
||||||
|
|
||||||
|
image/png png;
|
||||||
|
image/svg+xml svg svgz;
|
||||||
|
image/tiff tif tiff;
|
||||||
|
image/vnd.wap.wbmp wbmp;
|
||||||
|
image/webp webp;
|
||||||
|
image/x-icon ico;
|
||||||
|
image/x-jng jng;
|
||||||
|
image/x-ms-bmp bmp;
|
||||||
|
|
||||||
|
font/woff woff;
|
||||||
|
font/woff2 woff2;
|
||||||
|
|
||||||
|
application/java-archive jar war ear;
|
||||||
|
application/json json;
|
||||||
|
application/mac-binhex40 hqx;
|
||||||
|
application/msword doc;
|
||||||
|
application/pdf pdf;
|
||||||
|
application/postscript ps eps ai;
|
||||||
|
application/rtf rtf;
|
||||||
|
application/vnd.apple.mpegurl m3u8;
|
||||||
|
application/vnd.google-earth.kml+xml kml;
|
||||||
|
application/vnd.google-earth.kmz kmz;
|
||||||
|
application/vnd.ms-excel xls;
|
||||||
|
application/vnd.ms-fontobject eot;
|
||||||
|
application/vnd.ms-powerpoint ppt;
|
||||||
|
application/vnd.oasis.opendocument.graphics odg;
|
||||||
|
application/vnd.oasis.opendocument.presentation odp;
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||||
|
application/vnd.oasis.opendocument.text odt;
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||||
|
pptx;
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
|
xlsx;
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
|
docx;
|
||||||
|
application/vnd.wap.wmlc wmlc;
|
||||||
|
application/x-7z-compressed 7z;
|
||||||
|
application/x-cocoa cco;
|
||||||
|
application/x-java-archive-diff jardiff;
|
||||||
|
application/x-java-jnlp-file jnlp;
|
||||||
|
application/x-makeself run;
|
||||||
|
application/x-perl pl pm;
|
||||||
|
application/x-pilot prc pdb;
|
||||||
|
application/x-rar-compressed rar;
|
||||||
|
application/x-redhat-package-manager rpm;
|
||||||
|
application/x-sea sea;
|
||||||
|
application/x-shockwave-flash swf;
|
||||||
|
application/x-stuffit sit;
|
||||||
|
application/x-tcl tcl tk;
|
||||||
|
application/x-x509-ca-cert der pem crt;
|
||||||
|
application/x-xpinstall xpi;
|
||||||
|
application/xhtml+xml xhtml;
|
||||||
|
application/xspf+xml xspf;
|
||||||
|
application/zip zip;
|
||||||
|
|
||||||
|
application/octet-stream bin exe dll;
|
||||||
|
application/octet-stream deb;
|
||||||
|
application/octet-stream dmg;
|
||||||
|
application/octet-stream iso img;
|
||||||
|
application/octet-stream msi msp msm;
|
||||||
|
|
||||||
|
audio/midi mid midi kar;
|
||||||
|
audio/mpeg mp3;
|
||||||
|
audio/ogg ogg;
|
||||||
|
audio/x-m4a m4a;
|
||||||
|
audio/x-realaudio ra;
|
||||||
|
|
||||||
|
video/3gpp 3gpp 3gp;
|
||||||
|
video/mp2t ts;
|
||||||
|
video/mp4 mp4;
|
||||||
|
video/mpeg mpeg mpg;
|
||||||
|
video/quicktime mov;
|
||||||
|
video/webm webm;
|
||||||
|
video/x-flv flv;
|
||||||
|
video/x-m4v m4v;
|
||||||
|
video/x-mng mng;
|
||||||
|
video/x-ms-asf asx asf;
|
||||||
|
video/x-ms-wmv wmv;
|
||||||
|
video/x-msvideo avi;
|
||||||
|
}
|
||||||
16
filebrowser/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
16
filebrowser/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ignore_client_abort off;
|
||||||
|
proxy_read_timeout 86400s;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_send_timeout 86400s;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
|
||||||
|
proxy_hide_header X-Frame-Options;
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
1
filebrowser/rootfs/etc/nginx/includes/resolver.conf
Normal file
1
filebrowser/rootfs/etc/nginx/includes/resolver.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
resolver 127.0.0.11;
|
||||||
6
filebrowser/rootfs/etc/nginx/includes/server_params.conf
Normal file
6
filebrowser/rootfs/etc/nginx/includes/server_params.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root /dev/null;
|
||||||
|
server_name $hostname;
|
||||||
|
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
9
filebrowser/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
9
filebrowser/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
ssl_protocols TLSv1.2;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
|
||||||
|
ssl_ecdh_curve secp384r1;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
3
filebrowser/rootfs/etc/nginx/includes/upstream.conf
Normal file
3
filebrowser/rootfs/etc/nginx/includes/upstream.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
upstream backend {
|
||||||
|
server 127.0.0.1:8080;
|
||||||
|
}
|
||||||
56
filebrowser/rootfs/etc/nginx/nginx.conf
Normal file
56
filebrowser/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Run nginx in foreground.
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
# This is run inside Docker.
|
||||||
|
user root;
|
||||||
|
|
||||||
|
# Pid storage location.
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
# Set number of worker processes.
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Write error log to Hass.io add-on log.
|
||||||
|
error_log /proc/1/fd/1 error;
|
||||||
|
|
||||||
|
# Load allowed environment vars
|
||||||
|
env HASSIO_TOKEN;
|
||||||
|
|
||||||
|
# Load dynamic modules.
|
||||||
|
include /etc/nginx/modules/*.conf;
|
||||||
|
|
||||||
|
# Max num of simultaneous connections by a worker process.
|
||||||
|
events {
|
||||||
|
worker_connections 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/includes/mime.types;
|
||||||
|
|
||||||
|
log_format hassio '[$time_local] $status '
|
||||||
|
'$http_x_forwarded_for($remote_addr) '
|
||||||
|
'$request ($http_user_agent)';
|
||||||
|
|
||||||
|
access_log /proc/1/fd/1 hassio;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
gzip on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
sendfile on;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
tcp_nopush on;
|
||||||
|
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/includes/resolver.conf;
|
||||||
|
include /etc/nginx/includes/upstream.conf;
|
||||||
|
|
||||||
|
include /etc/nginx/servers/*.conf;
|
||||||
|
}
|
||||||
17
filebrowser/rootfs/etc/nginx/servers/ingress.conf
Normal file
17
filebrowser/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
server {
|
||||||
|
listen %%interface%%:%%port%% default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
client_max_body_size 0;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
|
proxy_connect_timeout 30m;
|
||||||
|
proxy_send_timeout 30m;
|
||||||
|
proxy_read_timeout 30m;
|
||||||
|
proxy_pass http://backend%%subpath%%;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,38 +5,38 @@
|
|||||||
##########
|
##########
|
||||||
|
|
||||||
if bashio::supervisor.ping; then
|
if bashio::supervisor.ping; then
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||||
bashio::log.blue " $(bashio::addon.description)"
|
bashio::log.blue " $(bashio::addon.description)"
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
|
|
||||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||||
bashio::log.magenta ' There is an update available for this add-on!'
|
bashio::log.magenta ' There is an update available for this add-on!'
|
||||||
bashio::log.magenta \
|
bashio::log.magenta \
|
||||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||||
else
|
else
|
||||||
bashio::log.green ' You are running the latest version of this add-on.'
|
bashio::log.green ' You are running the latest version of this add-on.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||||
|
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
' Please, share the above information when looking for help'
|
' Please, share the above information when looking for help'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
' or support in, e.g., GitHub, forums or the Discord chat.'
|
' or support in, e.g., GitHub, forums or the Discord chat.'
|
||||||
bashio::log.green \
|
bashio::log.green \
|
||||||
' https://github.com/alexbelgium/hassio-addons'
|
' https://github.com/alexbelgium/hassio-addons'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@@ -45,84 +45,80 @@ fi
|
|||||||
|
|
||||||
# Mount local Share if configured and if Protection Mode is active
|
# Mount local Share if configured and if Protection Mode is active
|
||||||
if bashio::config.has_value 'localdisks'; then
|
if bashio::config.has_value 'localdisks'; then
|
||||||
bashio::log.info 'Mounting local hdd...'
|
bashio::log.info 'Mounting local hdd...'
|
||||||
bashio::require.unprotected
|
bashio::require.unprotected
|
||||||
MOREDISKS=$(bashio::config 'localdisks')
|
MOREDISKS=$(bashio::config 'localdisks')
|
||||||
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \
|
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \
|
||||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
for disk in ${MOREDISKS//,/ }; do # Separate comma separated values
|
||||||
do
|
bashio::log.info "Mount ${disk}"
|
||||||
bashio::log.info "Mount ${disk}"
|
mkdir -p /share/$disk && \
|
||||||
mkdir -p /share/$disk && \
|
if [ ! -d /share/$disk ]; then
|
||||||
if [ ! -d /share/$disk ]; then
|
echo "Creating /share/$disk"
|
||||||
echo "Creating /share/$disk"
|
mkdir -p /share/$disk
|
||||||
mkdir -p /share/$disk
|
chown -R abc:abc /share/$disk
|
||||||
chown -R abc:abc /share/$disk
|
fi
|
||||||
fi
|
mount /dev/$disk /share/$disk && \
|
||||||
mount /dev/$disk /share/$disk && \
|
bashio::log.info "Success!"
|
||||||
bashio::log.info "Success!"
|
done || \
|
||||||
done || \
|
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
||||||
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
|
||||||
fi || true
|
fi || true
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# MOUNT SMB SHARES #
|
# MOUNT SMB SHARES #
|
||||||
####################
|
####################
|
||||||
if bashio::config.has_value 'networkdisks'; then
|
if bashio::config.has_value 'networkdisks'; then
|
||||||
# Mount CIFS Share if configured and if Protection Mode is active
|
# Mount CIFS Share if configured and if Protection Mode is active
|
||||||
bashio::log.info 'Mounting smb share(s)...'
|
bashio::log.info 'Mounting smb share(s)...'
|
||||||
|
|
||||||
# Define variables
|
# Define variables
|
||||||
MOREDISKS=$(bashio::config 'networkdisks')
|
MOREDISKS=$(bashio::config 'networkdisks')
|
||||||
CIFS_USERNAME=$(bashio::config 'cifsusername')
|
CIFS_USERNAME=$(bashio::config 'cifsusername')
|
||||||
CIFS_PASSWORD=$(bashio::config 'cifspassword')
|
CIFS_PASSWORD=$(bashio::config 'cifspassword')
|
||||||
MOUNTED=false
|
MOUNTED=false
|
||||||
SMBVERS=""
|
SMBVERS=""
|
||||||
SECVERS=""
|
SECVERS=""
|
||||||
|
|
||||||
if bashio::config.has_value 'cifsdomain'; then
|
if bashio::config.has_value 'cifsdomain'; then
|
||||||
DOMAIN=",domain=$(bashio::config 'cifsdomain')"
|
DOMAIN=",domain=$(bashio::config 'cifsdomain')"
|
||||||
else
|
else
|
||||||
DOMAIN=""
|
DOMAIN=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mounting disks
|
# Mounting disks
|
||||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
for disk in ${MOREDISKS//,/ }; do # Separate comma separated values
|
||||||
do
|
# Clean name of network share
|
||||||
# Clean name of network share
|
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
||||||
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
diskname=${disk//\\//} #replace \ with /
|
||||||
diskname=${disk//\\//} #replace \ with /
|
diskname=${diskname##*/} # Get only last part of the name
|
||||||
diskname=${diskname##*/} # Get only last part of the name
|
# Prepare mount point
|
||||||
# Prepare mount point
|
mkdir -p /mnt/$diskname
|
||||||
mkdir -p /mnt/$diskname
|
chown -R root:root /mnt/$diskname
|
||||||
chown -R root:root /mnt/$diskname
|
|
||||||
|
#Tries to mount with default options
|
||||||
#Tries to mount with default options
|
mount -t cifs -o rw,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$DOMAIN $disk /mnt/$diskname 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
||||||
mount -t cifs -o rw,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$DOMAIN $disk /mnt/$diskname 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
|
||||||
|
# if Fail test different smb and sec versions
|
||||||
# if Fail test different smb and sec versions
|
if [ $MOUNTED = false ]; then
|
||||||
if [ $MOUNTED = false ]; then
|
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"; do
|
||||||
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"
|
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
|
||||||
do
|
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5"; do
|
||||||
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
|
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
|
||||||
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5"
|
|
||||||
do
|
|
||||||
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
fi
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Messages
|
# Messages
|
||||||
if [ $MOUNTED = true ]; then
|
if [ $MOUNTED = true ]; then
|
||||||
#Test write permissions
|
#Test write permissions
|
||||||
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze && bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze && bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||||
else
|
else
|
||||||
# message if still fail
|
# message if still fail
|
||||||
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
|
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
|
||||||
bashio::log.fatal "Error read : $(<ERRORCODE)" # Mount share
|
bashio::log.fatal "Error read : $(<ERRORCODE)" # Mount share
|
||||||
rm ERRORCODE
|
rm ERRORCODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
fi || true
|
fi || true
|
||||||
|
|
||||||
###################
|
###################
|
||||||
@@ -147,18 +143,37 @@ bashio::log.info 'PUID GUID set to root'
|
|||||||
PUID=0
|
PUID=0
|
||||||
PGID=0
|
PGID=0
|
||||||
|
|
||||||
|
#################
|
||||||
|
# NGINX SETTING #
|
||||||
|
#################
|
||||||
|
|
||||||
|
declare port
|
||||||
|
declare certfile
|
||||||
|
declare ingress_interface
|
||||||
|
declare ingress_port
|
||||||
|
declare keyfile
|
||||||
|
|
||||||
|
FB_BASEURL=$(bashio::addon.ingress_entry)
|
||||||
|
export FB_BASEURL
|
||||||
|
|
||||||
|
port=$(bashio::addon.port 80)
|
||||||
|
ingress_port=$(bashio::addon.ingress_port)
|
||||||
|
ingress_interface=$(bashio::addon.ip_address)
|
||||||
|
sed -i "s|%%port%%|${ingress_port}|g" /etc/nginx/servers/ingress.conf
|
||||||
|
sed -i "s|%%interface%%|${ingress_interface}|g" /etc/nginx/servers/ingress.conf
|
||||||
|
sed -i "s|%%subpath%%|${FB_BASEURL}/|g" /etc/nginx/servers/ingress.conf
|
||||||
|
mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# LAUNCH FILEBROWSER #
|
# LAUNCH FILEBROWSER #
|
||||||
######################
|
######################
|
||||||
|
|
||||||
FB_BASEURL="/filebrowser"
|
|
||||||
export $FB_BASEURL
|
|
||||||
NOAUTH=""
|
NOAUTH=""
|
||||||
|
|
||||||
if bashio::config.true 'NoAuth'; then
|
if bashio::config.true 'NoAuth'; then
|
||||||
if ! bashio::fs.file_exists "/data/noauth"; then
|
if ! bashio::fs.file_exists "/data/noauth"; then
|
||||||
rm /data/auth &> /dev/null || true
|
rm /data/auth &>/dev/null || true
|
||||||
rm /config/filebrowser/filebrowser.dB &> /dev/null || true
|
rm /config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||||
touch /data/noauth
|
touch /data/noauth
|
||||||
NOAUTH="--noauth"
|
NOAUTH="--noauth"
|
||||||
bashio::log.warning "Auth method change, database reset"
|
bashio::log.warning "Auth method change, database reset"
|
||||||
@@ -166,14 +181,17 @@ if bashio::config.true 'NoAuth'; then
|
|||||||
bashio::log.info "NoAuth option selected"
|
bashio::log.info "NoAuth option selected"
|
||||||
else
|
else
|
||||||
if ! bashio::fs.file_exists "/data/auth"; then
|
if ! bashio::fs.file_exists "/data/auth"; then
|
||||||
rm /data/noauth &> /dev/null || true
|
rm /data/noauth &>/dev/null || true
|
||||||
rm /config/filebrowser/filebrowser.dB &> /dev/null || true
|
rm /config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||||
touch /data/auth
|
touch /data/auth
|
||||||
bashio::log.warning "Auth method change, database reset"
|
bashio::log.warning "Auth method change, database reset"
|
||||||
fi
|
fi
|
||||||
bashio::log.info "Default username/password : admin/admin"
|
bashio::log.info "Default username/password : admin/admin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "Please wait 1 or 2 minutes to allow the server to load"
|
bashio::log.info "Starting..."
|
||||||
|
|
||||||
/./filebrowser $CERTFILE $KEYFILE --root=/ --address=0.0.0.0 --database=/config/filebrowser/filebrowser.dB $NOAUTH
|
/./filebrowser "$CERTFILE $KEYFILE --root=/ --address=0.0.0.0 --database=/config/filebrowser/filebrowser.dB $NOAUTH" &
|
||||||
|
bashio::net.wait_for 8080 localhost 900 || true
|
||||||
|
bashio::log.info "Started !"
|
||||||
|
exec nginx
|
||||||
|
|||||||
Reference in New Issue
Block a user