updated
This commit is contained in:
parent
33863f05c4
commit
99c8bf8036
|
@ -5,13 +5,15 @@ All notable changes to this project will be documented in this file. See [standa
|
||||||
|
|
||||||
# v0.2.0
|
# v0.2.0
|
||||||
|
|
||||||
- improved GUI
|
- improved UI
|
||||||
- more unified coehisive look
|
- more unified coehisive look
|
||||||
- Adjusted header bar look and icon behavior
|
- Adjusted header bar look and icon behavior
|
||||||
- The shell is dead.
|
- The shell is dead.
|
||||||
- If you need to use custom commands, exec into the docker container.
|
- If you need to use custom commands, exec into the docker container.
|
||||||
- All configuration is done via `filebrowser.yaml`
|
- The json config file is dead.
|
||||||
- Removed old code to migrate database veresions
|
- All configuration is done via advanced `filebrowser.yaml`
|
||||||
|
- The only flag that is allowed is flag to specify config file.
|
||||||
|
- Removed old code to migrate database versions
|
||||||
- Removed all unused cmd code
|
- Removed all unused cmd code
|
||||||
|
|
||||||
# v0.1.4
|
# v0.1.4
|
||||||
|
|
|
@ -9,30 +9,34 @@ ok github.com/gtsteffaniak/filebrowser/diskcache 0.004s
|
||||||
? github.com/gtsteffaniak/filebrowser/errors [no test files]
|
? github.com/gtsteffaniak/filebrowser/errors [no test files]
|
||||||
? github.com/gtsteffaniak/filebrowser/files [no test files]
|
? github.com/gtsteffaniak/filebrowser/files [no test files]
|
||||||
PASS
|
PASS
|
||||||
ok github.com/gtsteffaniak/filebrowser/fileutils 0.003s
|
ok github.com/gtsteffaniak/filebrowser/fileutils 0.004s
|
||||||
2023/09/02 13:08:16 Error opening YAML file: open filebrowser.yaml: no such file or directory
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
exit status 1
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
FAIL github.com/gtsteffaniak/filebrowser/http 0.003s
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
|
2023/09/02 19:15:20 h: 401 <nil>
|
||||||
PASS
|
PASS
|
||||||
ok github.com/gtsteffaniak/filebrowser/img 0.123s
|
ok github.com/gtsteffaniak/filebrowser/http 0.094s
|
||||||
PASS
|
PASS
|
||||||
ok github.com/gtsteffaniak/filebrowser/rules 0.003s
|
ok github.com/gtsteffaniak/filebrowser/img 0.122s
|
||||||
2023/09/02 13:08:16 Error opening YAML file: open filebrowser.yaml: no such file or directory
|
PASS
|
||||||
exit status 1
|
ok github.com/gtsteffaniak/filebrowser/rules 0.002s
|
||||||
FAIL github.com/gtsteffaniak/filebrowser/runner 0.002s
|
PASS
|
||||||
|
ok github.com/gtsteffaniak/filebrowser/runner 0.004s
|
||||||
goos: linux
|
goos: linux
|
||||||
goarch: amd64
|
goarch: amd64
|
||||||
pkg: github.com/gtsteffaniak/filebrowser/search
|
pkg: github.com/gtsteffaniak/filebrowser/search
|
||||||
cpu: 11th Gen Intel(R) Core(TM) i5-11320H @ 3.20GHz
|
cpu: 11th Gen Intel(R) Core(TM) i5-11320H @ 3.20GHz
|
||||||
BenchmarkSearchAllIndexes-8 10 5705789 ns/op 3017139 B/op 44605 allocs/op
|
BenchmarkSearchAllIndexes-8 10 5176084 ns/op 2743632 B/op 42785 allocs/op
|
||||||
BenchmarkFillIndex-8 10 3205461 ns/op 18498 B/op 454 allocs/op
|
BenchmarkFillIndex-8 10 3263308 ns/op 18485 B/op 453 allocs/op
|
||||||
PASS
|
PASS
|
||||||
ok github.com/gtsteffaniak/filebrowser/search 0.117s
|
ok github.com/gtsteffaniak/filebrowser/search 0.109s
|
||||||
? github.com/gtsteffaniak/filebrowser/settings [no test files]
|
PASS
|
||||||
|
ok github.com/gtsteffaniak/filebrowser/settings 0.004s
|
||||||
? github.com/gtsteffaniak/filebrowser/share [no test files]
|
? github.com/gtsteffaniak/filebrowser/share [no test files]
|
||||||
? github.com/gtsteffaniak/filebrowser/storage [no test files]
|
? github.com/gtsteffaniak/filebrowser/storage [no test files]
|
||||||
? github.com/gtsteffaniak/filebrowser/storage/bolt [no test files]
|
? github.com/gtsteffaniak/filebrowser/storage/bolt [no test files]
|
||||||
PASS
|
PASS
|
||||||
ok github.com/gtsteffaniak/filebrowser/users 0.003s
|
ok github.com/gtsteffaniak/filebrowser/users 0.004s
|
||||||
? github.com/gtsteffaniak/filebrowser/version [no test files]
|
? github.com/gtsteffaniak/filebrowser/version [no test files]
|
||||||
FAIL
|
|
||||||
|
|
|
@ -2,8 +2,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gtsteffaniak/filebrowser/cmd"
|
"github.com/gtsteffaniak/filebrowser/cmd"
|
||||||
|
"github.com/gtsteffaniak/filebrowser/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
settings.Initialize()
|
||||||
cmd.StartFilebrowser()
|
cmd.StartFilebrowser()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,49 @@
|
||||||
package settings
|
package settings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/goccy/go-yaml"
|
"github.com/goccy/go-yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
var GlobalConfiguration Settings
|
var GlobalConfiguration Settings
|
||||||
|
|
||||||
func init() {
|
func Initialize() {
|
||||||
// Open and read the YAML file
|
// Open and read the YAML file
|
||||||
yamlFile, err := os.Open("filebrowser.yaml")
|
yamlFile, err := os.Open("filebrowser.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error opening YAML file: %v", err)
|
log.Println("Error opening config file: ", err)
|
||||||
|
log.Println("Using default config only")
|
||||||
|
// Get the current directory
|
||||||
|
dir, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the filepath package to join the directory and file names
|
||||||
|
err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// Check if it's a regular file (not a directory)
|
||||||
|
if !info.IsDir() {
|
||||||
|
fmt.Println(path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
setDefaults()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer yamlFile.Close()
|
defer yamlFile.Close()
|
||||||
|
|
||||||
stat, err := yamlFile.Stat()
|
stat, err := yamlFile.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error getting file information: %v", err)
|
log.Fatalf("Error getting file information: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
yamlData := make([]byte, stat.Size())
|
yamlData := make([]byte, stat.Size())
|
||||||
|
@ -27,7 +51,6 @@ func init() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error reading YAML data: %v", err)
|
log.Fatalf("Error reading YAML data: %v", err)
|
||||||
}
|
}
|
||||||
setDefaults()
|
|
||||||
// Unmarshal the YAML data into the Settings struct
|
// Unmarshal the YAML data into the Settings struct
|
||||||
err = yaml.Unmarshal(yamlData, &GlobalConfiguration)
|
err = yaml.Unmarshal(yamlData, &GlobalConfiguration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package settings
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfigLoad(t *testing.T) {
|
||||||
|
Initialize()
|
||||||
|
t.Log("Say bye")
|
||||||
|
}
|
Loading…
Reference in New Issue