Bump version to 1.0.21
This commit is contained in:
@@ -95,3 +95,9 @@ type SSHKeyResponse struct {
|
||||
type ErrorResponse struct {
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type SettingsInfoResponse struct {
|
||||
Version string `json:"version"`
|
||||
DataDir string `json:"data_dir"`
|
||||
SSHPubKey string `json:"ssh_pub_key"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
@@ -82,6 +83,17 @@ func NewServer(cfg *config.Config, db *sql.DB, engine *syncengine.Engine) *Serve
|
||||
w.Write([]byte(pubKey))
|
||||
})
|
||||
|
||||
r.With(auth.RequireAuth).Get("/settings/info", func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _, pubKey, _ := sshmanager.EnsureServerKey(cfg.SSHDir())
|
||||
resp := SettingsInfoResponse{
|
||||
Version: cfg.Version,
|
||||
DataDir: cfg.DataDir,
|
||||
SSHPubKey: pubKey,
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(resp)
|
||||
})
|
||||
|
||||
r.With(auth.RequireAuth).Route("/ssh-keys", func(r chi.Router) {
|
||||
r.Get("/", sshKeyHandler.List)
|
||||
r.Post("/", sshKeyHandler.Create)
|
||||
|
||||
Reference in New Issue
Block a user