Bump Syncthing 0.14.38
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Sat, 7 Oct 2017 19:43:09 +0000 (21:43 +0200)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Sat, 7 Oct 2017 19:43:09 +0000 (21:43 +0200)
Makefile
glide.yaml
lib/syncthing/stfolder.go

index cb0af7b..3329ead 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,8 @@
 VERSION := 0.2.0
 
 # Syncthing version to install
-SYNCTHING_VERSION = 0.14.28
-SYNCTHING_INOTIFY_VERSION = 0.8.6
+SYNCTHING_VERSION = 0.14.38
+SYNCTHING_INOTIFY_VERSION = 0.8.7
 
 
 # Retrieve git tag/commit to set sub-version string
index 033c303..1f3f847 100644 (file)
@@ -8,7 +8,7 @@ import:
   version: ^1.1.4
 - package: github.com/gin-contrib/static
 - package: github.com/syncthing/syncthing
-  version: =0.14.28
+  version: =0.14.38
   subpackages:
   - lib/sync
   - lib/config
index a5312eb..d5c74ef 100644 (file)
@@ -6,6 +6,7 @@ import (
        "strings"
 
        common "github.com/iotbzh/xds-common/golib"
+       "github.com/iotbzh/xds-server/lib/folder"
        stconfig "github.com/syncthing/syncthing/lib/config"
        "github.com/syncthing/syncthing/lib/protocol"
 )
@@ -19,6 +20,48 @@ type FolderChangeArg struct {
        ShareRootDir string
 }
 
+// FolderLoadFromStConfig Load/Retrieve folder config from syncthing database
+func (s *SyncThing) FolderLoadFromStConfig(f *[]folder.FolderConfig) error {
+
+       defaultSdk := "" // cannot know which was the default sdk
+
+       stCfg, err := s.ConfigGet()
+       if err != nil {
+               return err
+       }
+       if len(stCfg.Devices) < 1 {
+               return fmt.Errorf("Cannot load syncthing config: no device defined")
+       }
+       devID := stCfg.Devices[0].DeviceID.String()
+       if devID == s.MyID {
+               if len(stCfg.Devices) < 2 {
+                       return fmt.Errorf("Cannot load syncthing config: no valid device found")
+               }
+               devID = stCfg.Devices[1].DeviceID.String()
+       }
+
+       for _, stFld := range stCfg.Folders {
+               /*
+                       cliPath := strings.TrimPrefix(stFld.Path, s.conf.FileConf.ShareRootDir)
+                       if cliPath == "" {
+                               cliPath = stFld.Path
+                       }*/
+               cliPath := stFld.Path
+               *f = append(*f, folder.FolderConfig{
+                       ID:            stFld.ID,
+                       Label:         stFld.Label,
+                       ClientPath:    strings.TrimRight(cliPath, "/"),
+                       Type:          folder.TypeCloudSync,
+                       Status:        folder.StatusDisable,
+                       DefaultSdk:    defaultSdk,
+                       RootPath:      "", //s.conf.FileConf.ShareRootDir,
+                       DataCloudSync: folder.CloudSyncConfig{SyncThingID: devID},
+               })
+       }
+
+       return nil
+}
+
 // FolderChange is called when configuration has changed
 func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error) {
 
@@ -73,7 +116,7 @@ func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error) {
        folder := stconfig.FolderConfiguration{
                ID:            id,
                Label:         label,
-               RawPath:       pathCli,
+               Path:          pathCli,
                AutoNormalize: true,
        }