Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit131b90b

Browse files
committed
fix filebrowser
1 parente3de0d9 commit131b90b

File tree

3 files changed

+25
-38
lines changed

3 files changed

+25
-38
lines changed

‎.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
"name":"Development environments on your infrastructure",
33
"image":"codercom/oss-dogfood:latest",
44
"features": {
5-
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
65
"ghcr.io/devcontainers/features/docker-in-docker:2": {
76
"moby":"false"
87
},
98
"ghcr.io/coder/devcontainer-features/code-server:1": {
109
"auth":"none",
1110
"port":13337
1211
},
13-
"./filebrowser": {}
12+
"./filebrowser": {
13+
"folder":"${containerWorkspaceFolder}"
14+
}
1415
},
1516
// SYS_PTRACE to enable go debugging
1617
"runArgs": ["--cap-add=SYS_PTRACE"],

‎.devcontainer/filebrowser/devcontainer-feature.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@
99
"default":"13339",
1010
"description":"The port to run filebrowser on"
1111
},
12-
// "folder": {
13-
// "type": "string",
14-
// "default": "${containerWorkspaceFolder}",
15-
// "description": "The root directory for filebrowser to serve"
16-
//},
17-
"auth": {
12+
"folder": {
1813
"type":"string",
19-
"enum": [
20-
"none",
21-
"password"
22-
],
23-
"default":"none",
24-
"description":"Authentication method (none or password)"
14+
"default":"",
15+
"description":"The root directory for filebrowser to serve"
16+
},
17+
"baseUrl": {
18+
"type":"string",
19+
"default":"",
20+
"description":"The base URL for filebrowser (e.g., /filebrowser)"
2521
}
2622
},
2723
"entrypoint":"/usr/local/bin/filebrowser-entrypoint",

‎.devcontainer/filebrowser/install.sh

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,36 @@ if ! command -v filebrowser &>/dev/null; then
1111
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh| bash
1212
fi
1313

14-
printf"🥳 Installation complete!\n\n"
15-
16-
# Create run script.
14+
# Create entrypoint.
1715
cat>/usr/local/bin/filebrowser-entrypoint<<EOF
18-
#!/bin/bash
19-
20-
printf "🛠️ Configuring filebrowser\n\n"
16+
#!/usr/bin/env bash
2117
22-
AUTH="${AUTH}"
2318
PORT="${PORT}"
24-
FOLDER="$(pwd)"
19+
FOLDER="${FOLDER:-}"
20+
FOLDER="\${FOLDER:-\$(pwd)}"
21+
BASEURL="${BASEURL:-}"
2522
LOG_PATH=/tmp/filebrowser.log
26-
export FB_DATABASE="/tmp/filebrowser.db"
23+
export FB_DATABASE="\${HOME}/.filebrowser.db"
24+
25+
printf "🛠️ Configuring filebrowser\n\n"
2726
2827
# Check if filebrowser db exists.
2928
if [[ ! -f "\${FB_DATABASE}" ]]; then
30-
filebrowser config init
31-
if [[ "\$AUTH" == "password" ]]; then
32-
filebrowser users add admin admin --perm.admin=true --viewMode=mosaic
33-
fi
34-
fi
35-
36-
# Configure filebrowser.
37-
if [[ "\$AUTH" == "none" ]]; then
38-
filebrowser config set --port="\${PORT}" --auth.method=noauth --root="\${FOLDER}"
39-
else
40-
filebrowser config set --port="\${PORT}" --auth.method=json --root="\${FOLDER}"
29+
filebrowser config init >>\${LOG_PATH} 2>&1
30+
filebrowser users add admin "" --perm.admin=true --viewMode=mosaic >>\${LOG_PATH} 2>&1
4131
fi
4232
43-
set -euo pipefail
33+
filebrowser configset --baseurl=\${BASEURL} --port=\${PORT} --auth.method=noauth --root=\${FOLDER} >>\${LOG_PATH} 2>&1
4434
4535
printf "👷 Starting filebrowser...\n\n"
36+
4637
printf "📂 Serving\${FOLDER} at http://localhost:\${PORT}\n\n"
4738
48-
filebrowser >>\${LOG_PATH}2>&1&
39+
filebrowser >>\${LOG_PATH} &
4940
5041
printf "📝 Logs at\${LOG_PATH}\n\n"
5142
EOF
5243

5344
chmod +x /usr/local/bin/filebrowser-entrypoint
5445

55-
printf"✅ File Browser installed!\n\n"
56-
printf"🚀 Run 'filebrowser-entrypoint' to start the service\n\n"
46+
printf"🥳 Installation complete!\n\n"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp