diff --git a/internal/http/config.go b/internal/http/config.go index de7024b..5902c49 100644 --- a/internal/http/config.go +++ b/internal/http/config.go @@ -6,6 +6,8 @@ package http import ( "encoding/json" "net/http" + "os" + "path/filepath" "github.com/autobrr/autobrr/internal/config" "github.com/autobrr/autobrr/internal/domain" @@ -15,6 +17,9 @@ import ( ) type configJson struct { + Application string `json:"application"` + ConfigDir string `json:"config_dir"` + Database string `json:"database"` Host string `json:"host"` Port int `json:"port"` LogLevel string `json:"log_level"` @@ -50,6 +55,7 @@ func (h configHandler) Routes(r chi.Router) { func (h configHandler) getConfig(w http.ResponseWriter, r *http.Request) { conf := configJson{ + ConfigDir: h.cfg.Config.ConfigPath, Host: h.cfg.Config.Host, Port: h.cfg.Config.Port, LogLevel: h.cfg.Config.LogLevel, @@ -57,12 +63,29 @@ func (h configHandler) getConfig(w http.ResponseWriter, r *http.Request) { LogMaxSize: h.cfg.Config.LogMaxSize, LogMaxBackups: h.cfg.Config.LogMaxBackups, BaseURL: h.cfg.Config.BaseURL, + Database: h.cfg.Config.DatabaseType, CheckForUpdates: h.cfg.Config.CheckForUpdates, Version: h.server.version, Commit: h.server.commit, Date: h.server.date, } + ex, err := os.Executable() + if err != nil { + h.encoder.Error(w, err) + return + } + + conf.Application = ex + + absPath, err := filepath.Abs(h.cfg.Config.ConfigPath) + if err != nil { + h.encoder.Error(w, err) + return + } + + conf.ConfigDir = absPath + render.JSON(w, r, conf) } diff --git a/web/src/screens/settings/Application.tsx b/web/src/screens/settings/Application.tsx index dcd7583..04cadaf 100644 --- a/web/src/screens/settings/Application.tsx +++ b/web/src/screens/settings/Application.tsx @@ -23,9 +23,9 @@ interface RowItemProps { const RowItem = ({ label, value, title, emptyText }: RowItemProps) => { return (
-
{label}:
-
- {value ? {value} : emptyText} +
{label}
+
+ {value ? {value} : emptyText}
); @@ -59,9 +59,9 @@ const RowItemVersion = ({ label, value, title, newUpdate }: RowItemProps) => { return (
-
{label}:
-
- {value} +
{label}
+
+ {value} {newUpdate && newUpdate.html_url && ( {newUpdate.name} available! @@ -174,6 +174,9 @@ function ApplicationSettings() { + + +