Skip to content

Commit

Permalink
Remove lingering db conn, update default cli config
Browse files Browse the repository at this point in the history
A db conn opened for checking the number of chunks downloaded for a
particular file was previously not closed properly, but is fixed now.

CLI config defaults to XDG_CONFIG_DIR on linux, and default app config
dir on windows. macOS devices will enforce ~/.config/yeetfile.
  • Loading branch information
benbusby committed Dec 21, 2024
1 parent e4c5838 commit 808c9c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions backend/db/downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func UpdateDownload(id string) error {
WHERE chunk + 1 >= total_chunks
AND id=$1`

err := db.QueryRow(s, id, time.Now().UTC())
return err.Err()
_, err := db.Exec(s, id, time.Now().UTC())
return err
}

// CleanUpDownloads removes all in-progress downloads that haven't been updated
Expand Down
8 changes: 4 additions & 4 deletions backend/server/html/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<div class="right">
{{ if .Base.LoggedIn }}
{{ if eq .Base.Page "pass" }}
<a class="selected-page" href="{{.Base.Endpoints.Pass}}">Pass</a>
<a class="selected-page" href="{{.Base.Endpoints.Pass}}">Passwords</a>
{{ else }}
<a href="{{.Base.Endpoints.Pass}}">Pass</a>
<a href="{{.Base.Endpoints.Pass}}">Passwords</a>
{{ end }}

{{ if eq .Base.Page "vault" }}
<a class="selected-page" href="{{.Base.Endpoints.Vault}}">Vault</a>
<a class="selected-page" href="{{.Base.Endpoints.Vault}}">Files</a>
{{ else }}
<a href="{{.Base.Endpoints.Vault}}">Vault</a>
<a href="{{.Base.Endpoints.Vault}}">Files</a>
{{ end }}

{{ if eq .Base.Page "send" }}
Expand Down
10 changes: 5 additions & 5 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ var defaultConfig string
func setupConfigDir() (Paths, error) {
var localConfig string
var configErr error
if runtime.GOOS == "windows" {
baseDir, err := os.UserConfigDir()
if runtime.GOOS == "darwin" {
baseDir, err := os.UserHomeDir()
if err != nil {
return Paths{}, err
}

localConfig, configErr = makeConfigDirectories(baseDir, "yeetfile")
localConfig, configErr = makeConfigDirectories(baseDir, baseConfigPath)
} else {
baseDir, err := os.UserHomeDir()
baseDir, err := os.UserConfigDir()
if err != nil {
return Paths{}, err
}

localConfig, configErr = makeConfigDirectories(baseDir, baseConfigPath)
localConfig, configErr = makeConfigDirectories(baseDir, "yeetfile")
}

if configErr != nil {
Expand Down

0 comments on commit 808c9c3

Please sign in to comment.