Compare commits

...

2 Commits

Author SHA1 Message Date
Hazel Noack
55112c96dc used standart library instead of external 2025-07-15 14:33:37 +02:00
Hazel Noack
3fd6ab5675 finished up caching of website icons 2025-07-15 14:04:42 +02:00
5 changed files with 16 additions and 15 deletions

View File

@ -20,7 +20,7 @@ To configure this new tab page as website, you can install the firefox extension
## Config and Profiles ## Config and Profiles
This tool works with profiles. The default profile is `startpage`. If you want to load another profile just write it as command line arg after the command. To write a config File you can create the files here: This tool works with profiles. The default profile is `default`. If you want to load another profile just write it as command line arg after the command. To write a config File you can create the files here:
- `{profile}.toml` - `{profile}.toml`
- `.{profile}.toml` - `.{profile}.toml`
@ -43,8 +43,11 @@ air dev
## TODO ## TODO
- implement fetching website logos, to run at the start of the program and serve it from the temp directory - implementing proper command line args
- clear cache
- implement fetching in intervals - implement fetching in intervals
- host this website on a demo page
- implement ctl - implement ctl
- writing documentation
- implement autocomplete with a nice go backend and fast communication. Since it all runs locally nobody should have privacy concerns NEEDS TO BE ABLE TO TOGGLED OFF FOR DEMO PAGE - implement autocomplete with a nice go backend and fast communication. Since it all runs locally nobody should have privacy concerns NEEDS TO BE ABLE TO TOGGLED OFF FOR DEMO PAGE
WRITE DOCUMENTATION

1
go.mod
View File

@ -5,7 +5,6 @@ go 1.24.2
require github.com/labstack/echo/v4 v4.13.4 require github.com/labstack/echo/v4 v4.13.4
require ( require (
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f // indirect
github.com/labstack/gommon v0.4.2 // indirect github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect

View File

@ -9,7 +9,6 @@ import (
"slices" "slices"
"gitea.elara.ws/Hazel/transfem-startpage/internal/diyhrt" "gitea.elara.ws/Hazel/transfem-startpage/internal/diyhrt"
"github.com/kirsle/configdir"
"github.com/pelletier/go-toml" "github.com/pelletier/go-toml"
) )
@ -103,12 +102,14 @@ func (c *Config) LoadDiyHrt(listings []diyhrt.Listing) {
func (rc *Config) ScanForConfigFile(profile string) error { func (rc *Config) ScanForConfigFile(profile string) error {
profileFile := profile + ".toml" profileFile := profile + ".toml"
configPath := configdir.LocalConfig("startpage") baseDir, cacheDirErr := os.UserConfigDir()
configFile := filepath.Join(configPath, profileFile) if cacheDirErr == nil {
configFile := filepath.Join(baseDir, "startpage", profileFile)
if err := rc.LoadConfigFile(configFile); !errors.Is(err, os.ErrNotExist) { if err := rc.LoadConfigFile(configFile); !errors.Is(err, os.ErrNotExist) {
return err return err
} }
}
if err := rc.LoadConfigFile(profileFile); !errors.Is(err, os.ErrNotExist) { if err := rc.LoadConfigFile(profileFile); !errors.Is(err, os.ErrNotExist) {
return err return err
@ -139,7 +140,7 @@ func (rc *Config) LoadConfigFile(file string) error {
func (c *Config) Init() error { func (c *Config) Init() error {
fmt.Print("downloading website icons") fmt.Print("downloading website icons")
for i, _ := range c.Template.Websites { for i := range c.Template.Websites {
fmt.Print(".") fmt.Print(".")
c.Template.Websites[i].Cache() c.Template.Websites[i].Cache()
} }

View File

@ -61,13 +61,11 @@ func getFileSystem() http.FileSystem {
} }
func main() { func main() {
fmt.Println("running transfem startpage") profile := "default"
profile := "startpage"
if len(os.Args) > 1 { if len(os.Args) > 1 {
profile = os.Args[1] profile = os.Args[1]
} }
fmt.Println("loading profile " + profile + "...") fmt.Println("loading profile " + profile)
err := CurrentConfig.ScanForConfigFile(profile) err := CurrentConfig.ScanForConfigFile(profile)
if err != nil { if err != nil {

View File

@ -1 +1 @@
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1 exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1