mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 06:48:48 -05:00
* ui: changed how PolicyEditor is instantiated via a route * server: added paths/resolve API * server: refresh affected source manager after policy change Also switched 15-second refresh cycle which is way too aggressive to 30-minute cycle (manual refresh button can be used if needed). * policy: allow overriding top-level policy for estimation * server: changed source create API to always require policy * ui: streamlined new snapshot and estimate flow * linter fix
29 lines
759 B
Go
29 lines
759 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
"path/filepath"
|
|
|
|
"github.com/kopia/kopia/internal/ospath"
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
"github.com/kopia/kopia/snapshot"
|
|
)
|
|
|
|
func (s *Server) handlePathResolve(ctx context.Context, r *http.Request, body []byte) (interface{}, *apiError) {
|
|
var req serverapi.ResolvePathRequest
|
|
|
|
if err := json.Unmarshal(body, &req); err != nil {
|
|
return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request body")
|
|
}
|
|
|
|
return &serverapi.ResolvePathResponse{
|
|
SourceInfo: snapshot.SourceInfo{
|
|
Path: filepath.Clean(ospath.ResolveUserFriendlyPath(req.Path, true)),
|
|
Host: s.rep.ClientOptions().Hostname,
|
|
UserName: s.rep.ClientOptions().Username,
|
|
},
|
|
}, nil
|
|
}
|