Filebrowser-Quantum: change initial config to newer default (#8497)

This commit is contained in:
CanbiZ
2025-10-20 09:35:38 +02:00
committed by GitHub
parent 8fd8bb407e
commit 932de62b38

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Author: MickLesk
# Author: MickLesk
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info() {
@@ -53,20 +53,9 @@ fi
header_info
function msg_info() {
local msg="$1"
echo -e "${INFO} ${YW}${msg}...${CL}"
}
function msg_ok() {
local msg="$1"
echo -e "${CM} ${GN}${msg}${CL}"
}
function msg_error() {
local msg="$1"
echo -e "${CROSS} ${RD}${msg}${CL}"
}
function msg_info() { echo -e "${INFO} ${YW}$1...${CL}"; }
function msg_ok() { echo -e "${CM} ${GN}$1${CL}"; }
function msg_error() { echo -e "${CROSS} ${RD}$1${CL}"; }
# Detect legacy FileBrowser installation
LEGACY_DB="/usr/local/community-scripts/filebrowser.db"
@@ -96,7 +85,7 @@ if [[ -f "$LEGACY_DB" || -f "$LEGACY_BIN" && ! -f "$CONFIG_PATH" ]]; then
fi
fi
# Check existing installation
# Existing installation
if [[ -f "$INSTALL_PATH" ]]; then
echo -e "${YW}⚠️ ${APP} is already installed.${CL}"
echo -n "Uninstall ${APP}? (y/N): "
@@ -120,18 +109,8 @@ fi
read -r update_prompt
if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Updating ${APP}"
tmp="${INSTALL_PATH}.tmp.$$"
if ! curl -fSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$tmp"; then
msg_error "Download failed"
rm -f "$tmp"
exit 1
fi
chmod 0755 "$tmp"
if ! mv -f "$tmp" "$INSTALL_PATH"; then
msg_error "Install failed (cannot move into $INSTALL_PATH)"
rm -f "$tmp"
exit 1
fi
curl -fsSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$INSTALL_PATH"
chmod +x "$INSTALL_PATH"
msg_ok "Updated ${APP}"
exit 0
else
@@ -147,7 +126,11 @@ PORT=${PORT:-$DEFAULT_PORT}
echo -n "Install ${APP}? (y/n): "
read -r install_prompt
if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
if ! [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
exit 0
fi
msg_info "Installing ${APP} on ${OS}"
$PKG_MANAGER curl ffmpeg &>/dev/null
curl -fsSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$INSTALL_PATH"
@@ -163,23 +146,26 @@ if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
echo -n "Use No Authentication? (y/N): "
read -r noauth_prompt
# === YAML CONFIG GENERATION ===
if [[ "${noauth_prompt,,}" =~ ^(y|yes)$ ]]; then
cat <<EOF >"$CONFIG_PATH"
server:
port: $PORT
sources:
- path: "$SRC_DIR"
name: "RootFS"
config:
denyByDefault: false
disableIndexing: false
indexingIntervalMinutes: 240
exclude:
folderPaths:
- "/proc"
- "/sys"
- "/dev"
- "/run"
- "/tmp"
- "/lost+found"
conditionals:
rules:
- neverWatchPath: "/proc"
- neverWatchPath: "/sys"
- neverWatchPath: "/dev"
- neverWatchPath: "/run"
- neverWatchPath: "/tmp"
- neverWatchPath: "/lost+found"
auth:
methods:
noauth: true
@@ -191,17 +177,19 @@ server:
port: $PORT
sources:
- path: "$SRC_DIR"
name: "RootFS"
config:
denyByDefault: false
disableIndexing: false
indexingIntervalMinutes: 240
exclude:
folderPaths:
- "/proc"
- "/sys"
- "/dev"
- "/run"
- "/tmp"
- "/lost+found"
conditionals:
rules:
- neverWatchPath: "/proc"
- neverWatchPath: "/sys"
- neverWatchPath: "/dev"
- neverWatchPath: "/run"
- neverWatchPath: "/tmp"
- neverWatchPath: "/lost+found"
auth:
adminUsername: admin
adminPassword: helper-scripts.com
@@ -210,7 +198,6 @@ EOF
fi
msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH"
[Unit]
@@ -248,7 +235,3 @@ EOF
msg_ok "Service created successfully"
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://$IP:$PORT${CL}"
else
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
exit 0
fi