"apiv", "gonic", "devel", "csrffound", "Syncthing", "STID",
"ISTCONFIG", "socketio", "ldflags", "SThg", "Intf", "dismissible",
"rpath", "WSID", "sess", "IXDS", "xdsconfig", "xdsserver", "mfolder",
- "inotify", "Inot", "pname", "pkill", "sdkid", "CLOUDSYNC"
+ "inotify", "Inot", "pname", "pkill", "sdkid", "CLOUDSYNC", "xdsagent"
]
}
\ No newline at end of file
package common
import (
+ "fmt"
+
"github.com/gin-gonic/gin"
)
// APIError returns an uniform json formatted error
-func APIError(c *gin.Context, err string) {
+func APIError(c *gin.Context, format string, args ...interface{}) {
+ errMsg := fmt.Sprintf(format, args...)
c.JSON(500, gin.H{
"status": "error",
- "error": err,
+ "error": errMsg,
})
}
RawPath: filepath.Join(s.conf.ShareRootDir, f.RelativePath),
}
+ if s.conf.FileConf.SThgConf.RescanIntervalS > 0 {
+ folder.RescanIntervalS = s.conf.FileConf.SThgConf.RescanIntervalS
+ }
+
folder.Devices = append(folder.Devices, config.FolderDeviceConfiguration{
DeviceID: newDevice.DeviceID,
})
)
type SyncThingConf struct {
- BinDir string `json:"binDir"`
- Home string `json:"home"`
- GuiAddress string `json:"gui-address"`
- GuiAPIKey string `json:"gui-apikey"`
+ BinDir string `json:"binDir"`
+ Home string `json:"home"`
+ GuiAddress string `json:"gui-address"`
+ GuiAPIKey string `json:"gui-apikey"`
+ RescanIntervalS int `json:"rescanIntervalS"`
}
type FileConfig struct {
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptionsArgs, Response } from '@angular/http';
+import { CookieService } from 'ngx-cookie';
import { Location } from '@angular/common';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
// Default settings
const DEFAULT_GUI_PORT = 8384;
const DEFAULT_GUI_API_KEY = "1234abcezam";
+const DEFAULT_RESCAN_INTERV = 0; // 0: use syncthing-inotify to detect changes
@Injectable()
};
private statusSubject = <BehaviorSubject<ISyncThingStatus>>new BehaviorSubject(this._status);
- constructor(private http: Http, private _window: Window) {
+ constructor(private http: Http, private _window: Window, private cookie: CookieService) {
this._status.baseURL = 'http://localhost:' + DEFAULT_GUI_PORT;
this.baseRestUrl = this._status.baseURL + '/rest';
this.apikey = DEFAULT_GUI_API_KEY;
// Add or update Folder settings
let label = prj.label || "";
+ let scanInterval = parseInt(this.cookie.get("st-rescanInterval"), 10) || DEFAULT_RESCAN_INTERV;
let folder: ISTFolderConfiguration = {
id: prj.id,
label: label,
path: prj.path,
devices: [{ deviceID: newDevID, introducedBy: "" }],
autoNormalize: true,
+ rescanIntervalS: scanInterval,
};
let idx = stCfg.folders.findIndex(item => item.id === prj.id);