Compare commits
14
Commits
v2.0.0-rc.2
...
v2.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5fa0772c6 | ||
|
|
ba5c67d9da | ||
|
|
f3d007025e | ||
|
|
e7a39808dd | ||
|
|
2b7aa7a0c9 | ||
|
|
4d8f0c532b | ||
|
|
367e251a0e | ||
|
|
cc6f2f8bec | ||
|
|
007fde8186 | ||
|
|
552f8168ea | ||
|
|
42426e3e69 | ||
|
|
e706391934 | ||
|
|
58ff28f84d | ||
|
|
74a1ecbb89 |
No files matched your search
@@ -5,7 +5,6 @@ install: skip
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- docker-ce
|
|
||||||
- pass
|
- pass
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ The path must be for a json or yaml file.`,
|
|||||||
checkErr(err)
|
checkErr(err)
|
||||||
key = settings.Key
|
key = settings.Key
|
||||||
} else {
|
} else {
|
||||||
key = generateRandomBytes(64)
|
key = generateKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
file := settingsFile{}
|
file := settingsFile{}
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ override the options.`,
|
|||||||
authMethod, auther := getAuthentication(flags)
|
authMethod, auther := getAuthentication(flags)
|
||||||
|
|
||||||
s := &settings.Settings{
|
s := &settings.Settings{
|
||||||
Key: generateRandomBytes(64), // 256 bit
|
Key: generateKey(),
|
||||||
Signup: mustGetBool(flags, "signup"),
|
Signup: mustGetBool(flags, "signup"),
|
||||||
Shell: strings.Split(strings.TrimSpace(mustGetString(flags, "shell")), " "),
|
Shell: strings.Split(strings.TrimSpace(mustGetString(flags, "shell")), " "),
|
||||||
AuthMethod: authMethod,
|
AuthMethod: authMethod,
|
||||||
|
|||||||
+1
-1
@@ -215,7 +215,7 @@ func setupLog(logMethod string) {
|
|||||||
|
|
||||||
func quickSetup(flags *pflag.FlagSet, d pythonData) {
|
func quickSetup(flags *pflag.FlagSet, d pythonData) {
|
||||||
set := &settings.Settings{
|
set := &settings.Settings{
|
||||||
Key: generateRandomBytes(64), // 256 bit
|
Key: generateKey(),
|
||||||
Signup: false,
|
Signup: false,
|
||||||
Defaults: settings.UserDefaults{
|
Defaults: settings.UserDefaults{
|
||||||
Scope: ".",
|
Scope: ".",
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ list or set it to 0.`,
|
|||||||
checkErr(usernameConflictError(user.Username, conflictuous.ID, user.ID))
|
checkErr(usernameConflictError(user.Username, conflictuous.ID, user.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If it doesn't exist, set the ID to 0 to automatically get a new
|
||||||
|
// one that make sense in this DB.
|
||||||
|
user.ID = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
err = d.store.Users.Save(user)
|
err = d.store.Users.Save(user)
|
||||||
|
|||||||
+4
-6
@@ -1,7 +1,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -10,6 +9,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/asdine/storm"
|
"github.com/asdine/storm"
|
||||||
|
"github.com/filebrowser/filebrowser/v2/settings"
|
||||||
"github.com/filebrowser/filebrowser/v2/storage"
|
"github.com/filebrowser/filebrowser/v2/storage"
|
||||||
"github.com/filebrowser/filebrowser/v2/storage/bolt"
|
"github.com/filebrowser/filebrowser/v2/storage/bolt"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -41,12 +41,10 @@ func mustGetUint(flags *pflag.FlagSet, flag string) uint {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateRandomBytes(n int) []byte {
|
func generateKey() []byte {
|
||||||
b := make([]byte, n)
|
k, err := settings.GenerateKey()
|
||||||
_, err := rand.Read(b)
|
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
// Note that err == nil only if we read len(b) bytes.
|
return k
|
||||||
return b
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type cobraFunc func(cmd *cobra.Command, args []string)
|
type cobraFunc func(cmd *cobra.Command, args []string)
|
||||||
|
|||||||
+1
-1
Submodule frontend updated: 2ed87febcb...e370fbe500.
+1
-1
@@ -30,7 +30,7 @@ type authToken struct {
|
|||||||
type extractor []string
|
type extractor []string
|
||||||
|
|
||||||
func (e extractor) ExtractToken(r *http.Request) (string, error) {
|
func (e extractor) ExtractToken(r *http.Request) (string, error) {
|
||||||
token, _ := request.AuthorizationHeaderExtractor.ExtractToken(r)
|
token, _ := request.HeaderExtractor{"X-Auth"}.ExtractToken(r)
|
||||||
|
|
||||||
// Checks if the token isn't empty and if it contains two dots.
|
// Checks if the token isn't empty and if it contains two dots.
|
||||||
// The former prevents incompatibility with URLs that previously
|
// The former prevents incompatibility with URLs that previously
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package settings
|
package settings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/filebrowser/filebrowser/v2/rules"
|
"github.com/filebrowser/filebrowser/v2/rules"
|
||||||
@@ -41,3 +42,15 @@ type Server struct {
|
|||||||
func (s *Server) Clean() {
|
func (s *Server) Clean() {
|
||||||
s.BaseURL = strings.TrimSuffix(s.BaseURL, "/")
|
s.BaseURL = strings.TrimSuffix(s.BaseURL, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenerateKey generates a key of 256 bits.
|
||||||
|
func GenerateKey() ([]byte, error) {
|
||||||
|
b := make([]byte, 64)
|
||||||
|
_, err := rand.Read(b)
|
||||||
|
// Note that err == nil only if we read len(b) bytes.
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
@@ -55,7 +55,6 @@ func convertUsersToNew(old []*oldUser) ([]*users.User, error) {
|
|||||||
|
|
||||||
for _, oldUser := range old {
|
for _, oldUser := range old {
|
||||||
user := &users.User{
|
user := &users.User{
|
||||||
ID: uint(oldUser.ID),
|
|
||||||
Username: oldUser.Username,
|
Username: oldUser.Username,
|
||||||
Password: oldUser.Password,
|
Password: oldUser.Password,
|
||||||
Scope: oldUser.Scope,
|
Scope: oldUser.Scope,
|
||||||
|
|||||||
+3
-3
@@ -89,11 +89,11 @@ func (s *Storage) Save(user *User) error {
|
|||||||
// id must be a string for username lookup or a uint for id lookup. If id
|
// id must be a string for username lookup or a uint for id lookup. If id
|
||||||
// is neither, a ErrInvalidDataType will be returned.
|
// is neither, a ErrInvalidDataType will be returned.
|
||||||
func (s *Storage) Delete(id interface{}) (err error) {
|
func (s *Storage) Delete(id interface{}) (err error) {
|
||||||
switch id.(type) {
|
switch id := id.(type) {
|
||||||
case string:
|
case string:
|
||||||
err = s.back.DeleteByUsername(id.(string))
|
err = s.back.DeleteByUsername(id)
|
||||||
case uint:
|
case uint:
|
||||||
err = s.back.DeleteByID(id.(uint))
|
err = s.back.DeleteByID(id)
|
||||||
default:
|
default:
|
||||||
err = errors.ErrInvalidDataType
|
err = errors.ErrInvalidDataType
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@ package version
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Version is the current File Browser version.
|
// Version is the current File Browser version.
|
||||||
Version = "v2.0.0-rc.2"
|
Version = "v2.0.2"
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user