summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-05-19 22:31:28 +0200
committerJakob Borg <jakob@nym.se>2014-05-19 22:31:28 +0200
commitdba40eefb1900db524cf3bb23b1621d9fddcb6c0 (patch)
tree90f19c91b1bcceafa63669b9db015caa472b4250 /cmd
parent23b55f68b7bf746675e8feedac06274b72e51017 (diff)
Fix handling of changed/deleted directories (fixes #231)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/stpidx/main.go4
-rw-r--r--cmd/syncthing/gui.go11
2 files changed, 13 insertions, 2 deletions
diff --git a/cmd/stpidx/main.go b/cmd/stpidx/main.go
index b9907d646e..132a894a78 100644
--- a/cmd/stpidx/main.go
+++ b/cmd/stpidx/main.go
@@ -41,8 +41,8 @@ func main() {
inv := file.Flags&protocol.FlagInvalid != 0
dir := file.Flags&protocol.FlagDirectory != 0
prm := file.Flags & 0777
- log.Printf("File: %q, Del: %v, Inv: %v, Dir: %v, Perm: 0%03o, Modified: %d, Blocks: %d",
- file.Name, del, inv, dir, prm, file.Modified, len(file.Blocks))
+ log.Printf("File: %q, Ver:%d, Del: %v, Inv: %v, Dir: %v, Perm: 0%03o, Modified: %d, Blocks: %d",
+ file.Name, file.Version, del, inv, dir, prm, file.Modified, len(file.Blocks))
if *showBlocks {
for _, block := range file.Blocks {
log.Printf(" Size: %6d, Hash: %x", block.Size, block.Hash)
diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go
index 90160f1e24..e095000262 100644
--- a/cmd/syncthing/gui.go
+++ b/cmd/syncthing/gui.go
@@ -51,6 +51,7 @@ func startGUI(cfg config.GUIConfiguration, m *model.Model) error {
router.Get("/", getRoot)
router.Get("/rest/version", restGetVersion)
router.Get("/rest/model", restGetModel)
+ router.Get("/rest/need", restGetNeed)
router.Get("/rest/connections", restGetConnections)
router.Get("/rest/config", restGetConfig)
router.Get("/rest/config/sync", restGetConfigInSync)
@@ -125,6 +126,16 @@ func restGetModel(m *model.Model, w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(res)
}
+func restGetNeed(m *model.Model, w http.ResponseWriter, r *http.Request) {
+ var qs = r.URL.Query()
+ var repo = qs.Get("repo")
+
+ files := m.NeedFilesRepo(repo)
+
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(files)
+}
+
func restGetConnections(m *model.Model, w http.ResponseWriter) {
var res = m.ConnectionStats()
w.Header().Set("Content-Type", "application/json")