mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(web): show more app info (#1145)
* feat(web): add app info * database type used * application binary path * config path * feat(web): label colors light theme * feat(web): truncate long fields
This commit is contained in:
parent
2eed1b3e90
commit
d3ca3e59c0
4 changed files with 41 additions and 12 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue