Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions filebrowser/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

BOLD='\033[0;1m'
BOLD='\033[[0;1m'

printf "$${BOLD}Installing filebrowser \n\n"

Expand All @@ -11,20 +11,27 @@ fi

printf "🥳 Installation complete! \n\n"

printf "👷 Starting filebrowser in background... \n\n"
printf "🛠️ Configuring filebrowser \n\n"

ROOT_DIR=${FOLDER}
ROOT_DIR=$${ROOT_DIR/\~/$HOME}

DB_FLAG=""
if [ "${DB_PATH}" != "filebrowser.db" ]; then
DB_FLAG=" -d ${DB_PATH}"
echo "DB_PATH: ${DB_PATH}"

export FB_DATABASE="${DB_PATH}"

# Check if filebrowser db exists
if [[ ! -f "${DB_PATH}" ]]; then
filebrowser config init 2>&1 | tee -a ${LOG_PATH}
filebrowser users add admin "" --perm.admin=true --viewMode=mosaic 2>&1 | tee -a ${LOG_PATH}
fi

printf "📂 Serving $${ROOT_DIR} at http://localhost:${PORT} \n\n"
filebrowser config set --baseurl=${SERVER_BASE_PATH} --port=${PORT} --auth.method=noauth --root=$ROOT_DIR 2>&1 | tee -a ${LOG_PATH}

printf "Running 'filebrowser --noauth --root $ROOT_DIR --port ${PORT}$${DB_FLAG} --baseurl ${SERVER_BASE_PATH}' \n\n"
printf "👷 Starting filebrowser in background... \n\n"

printf "📂 Serving $${ROOT_DIR} at http://localhost:${PORT} \n\n"

filebrowser --noauth --root $ROOT_DIR --port ${PORT}$${DB_FLAG} --baseurl ${SERVER_BASE_PATH} > ${LOG_PATH} 2>&1 &
filebrowser >> ${LOG_PATH} 2>&1 &

printf "📝 Logs at ${LOG_PATH} \n\n"
Loading