Skip to content

Commit 3ffa3ea

Browse files
committed
Update until v2.42.5
1 parent e85ca94 commit 3ffa3ea

73 files changed

Lines changed: 1742 additions & 918 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pre-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- uses: actions/checkout@v4
4646
- uses: actions/setup-go@v5
4747
with:
48-
go-version: 1.23.0
48+
go-version: '1.24'
4949
- run: make lint-backend
5050
shell: bash
5151
lint:
@@ -74,7 +74,7 @@ jobs:
7474
- uses: actions/checkout@v4
7575
- uses: actions/setup-go@v5
7676
with:
77-
go-version: 1.23.0
77+
go-version: '1.24'
7878
- run: make test-backend
7979
shell: bash
8080
test:
@@ -108,7 +108,7 @@ jobs:
108108
- uses: actions/checkout@v4
109109
- uses: actions/setup-go@v5
110110
with:
111-
go-version: 1.23.0
111+
go-version: '1.24'
112112
- run: make build-backend
113113
shell: bash
114114

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
fetch-depth: 0
9494
- uses: actions/setup-go@v5
9595
with:
96-
go-version: 1.23.0
96+
go-version: '1.24'
9797
- uses: actions/setup-node@v4
9898
with:
9999
node-version: "22.x"

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ formatters:
128128
settings:
129129
goimports:
130130
local-prefixes:
131-
- github.com/filebrowser/filebrowser
131+
- github.com/thevickypedia/filebrowser
132132
exclusions:
133133
generated: lax
134134
paths:

Dockerfile.s6

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ghcr.io/linuxserver/baseimage-alpine:3.22
22

33
RUN apk update && \
4-
apk --no-cache add ca-certificates mailcap jq
4+
apk --no-cache add ca-certificates mailcap jq libcap
55

66
# Make user and create necessary directories
77
RUN mkdir -p /config /database /srv && \
@@ -12,7 +12,8 @@ COPY filebrowser /bin/filebrowser
1212
COPY docker/common/ /
1313
COPY docker/s6/ /
1414

15-
RUN chown -R abc:abc /bin/filebrowser /defaults healthcheck.sh
15+
RUN chown -R abc:abc /bin/filebrowser /defaults healthcheck.sh && \
16+
setcap 'cap_net_bind_service=+ep' /bin/filebrowser
1617

1718
# Define healthcheck script
1819
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s CMD /healthcheck.sh

auth/hook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (a *HookAuth) SaveUser() (*users.User, error) {
150150
}
151151

152152
if u == nil {
153-
pass, err := users.HashPwd(a.Cred.Password)
153+
pass, err := users.ValidateAndHashPwd(a.Cred.Password, a.Settings.MinimumPasswordLength)
154154
if err != nil {
155155
return nil, err
156156
}
@@ -186,7 +186,7 @@ func (a *HookAuth) SaveUser() (*users.User, error) {
186186

187187
// update the password when it doesn't match the current
188188
if p {
189-
pass, err := users.HashPwd(a.Cred.Password)
189+
pass, err := users.ValidateAndHashPwd(a.Cred.Password, a.Settings.MinimumPasswordLength)
190190
if err != nil {
191191
return nil, err
192192
}

auth/proxy.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package auth
22

33
import (
4-
"crypto/rand"
54
"errors"
65
"net/http"
76

@@ -29,15 +28,14 @@ func (a ProxyAuth) Auth(r *http.Request, usr users.Store, setting *settings.Sett
2928
}
3029

3130
func (a ProxyAuth) createUser(usr users.Store, setting *settings.Settings, srv *settings.Server, username string) (*users.User, error) {
32-
const passwordSize = 32
33-
randomPasswordBytes := make([]byte, passwordSize)
34-
_, err := rand.Read(randomPasswordBytes)
31+
const randomPasswordLength = settings.DefaultMinimumPasswordLength + 10
32+
pwd, err := users.RandomPwd(randomPasswordLength)
3533
if err != nil {
3634
return nil, err
3735
}
3836

3937
var hashedRandomPassword string
40-
hashedRandomPassword, err = users.HashPwd(string(randomPasswordBytes))
38+
hashedRandomPassword, err = users.ValidateAndHashPwd(pwd, setting.MinimumPasswordLength)
4139
if err != nil {
4240
return nil, err
4341
}

cmd/cmd.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
package cmd
22

3-
import (
4-
"log"
5-
)
6-
73
// Execute executes the commands.
8-
func Execute() {
9-
if err := rootCmd.Execute(); err != nil {
10-
log.Fatal(err)
11-
}
4+
func Execute() error {
5+
return rootCmd.Execute()
126
}

cmd/cmds_add.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ var cmdsAddCmd = &cobra.Command{
1515
Short: "Add a command to run on a specific event",
1616
Long: `Add a command to run on a specific event.`,
1717
Args: cobra.MinimumNArgs(2),
18-
Run: python(func(_ *cobra.Command, args []string, d pythonData) {
18+
RunE: python(func(_ *cobra.Command, args []string, d *pythonData) error {
1919
s, err := d.store.Settings.Get()
20-
checkErr(err)
20+
if err != nil {
21+
return err
22+
}
2123
command := strings.Join(args[1:], " ")
2224
s.Commands[args[0]] = append(s.Commands[args[0]], command)
2325
err = d.store.Settings.Save(s)
24-
checkErr(err)
26+
if err != nil {
27+
return err
28+
}
2529
printEvents(s.Commands)
30+
return nil
2631
}, pythonConfig{}),
2732
}

cmd/cmds_ls.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ var cmdsLsCmd = &cobra.Command{
1414
Short: "List all commands for each event",
1515
Long: `List all commands for each event.`,
1616
Args: cobra.NoArgs,
17-
Run: python(func(cmd *cobra.Command, _ []string, d pythonData) {
17+
RunE: python(func(cmd *cobra.Command, _ []string, d *pythonData) error {
1818
s, err := d.store.Settings.Get()
19-
checkErr(err)
20-
evt := mustGetString(cmd.Flags(), "event")
19+
if err != nil {
20+
return err
21+
}
22+
evt, err := getString(cmd.Flags(), "event")
23+
if err != nil {
24+
return err
25+
}
2126

2227
if evt == "" {
2328
printEvents(s.Commands)
@@ -27,5 +32,6 @@ var cmdsLsCmd = &cobra.Command{
2732
show["after_"+evt] = s.Commands["after_"+evt]
2833
printEvents(show)
2934
}
35+
return nil
3036
}, pythonConfig{}),
3137
}

cmd/cmds_rm.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,31 @@ including 'index_end'.`,
3535

3636
return nil
3737
},
38-
Run: python(func(_ *cobra.Command, args []string, d pythonData) {
38+
RunE: python(func(_ *cobra.Command, args []string, d *pythonData) error {
3939
s, err := d.store.Settings.Get()
40-
checkErr(err)
40+
if err != nil {
41+
return err
42+
}
4143
evt := args[0]
4244

4345
i, err := strconv.Atoi(args[1])
44-
checkErr(err)
46+
if err != nil {
47+
return err
48+
}
4549
f := i
4650
if len(args) == 3 {
4751
f, err = strconv.Atoi(args[2])
48-
checkErr(err)
52+
if err != nil {
53+
return err
54+
}
4955
}
5056

5157
s.Commands[evt] = append(s.Commands[evt][:i], s.Commands[evt][f+1:]...)
5258
err = d.store.Settings.Save(s)
53-
checkErr(err)
59+
if err != nil {
60+
return err
61+
}
5462
printEvents(s.Commands)
63+
return nil
5564
}, pythonConfig{}),
5665
}

0 commit comments

Comments
 (0)