Restore installation endpoints (#1509)
This commit is contained in:
parent
aa39647094
commit
3a1e244bdf
|
@ -662,6 +662,36 @@ func (b *StatusBackend) SignGroupMembership(content string) (string, error) {
|
|||
return crypto.Sign(content, selectedChatAccount.AccountKey.PrivateKey)
|
||||
}
|
||||
|
||||
// EnableInstallation enables an installation for multi-device sync.
|
||||
func (b *StatusBackend) EnableInstallation(installationID string) error {
|
||||
st, err := b.statusNode.ShhExtService()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := st.EnableInstallation(installationID); err != nil {
|
||||
b.log.Error("error enabling installation", "err", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DisableInstallation disables an installation for multi-device sync.
|
||||
func (b *StatusBackend) DisableInstallation(installationID string) error {
|
||||
st, err := b.statusNode.ShhExtService()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := st.DisableInstallation(installationID); err != nil {
|
||||
b.log.Error("error disabling installation", "err", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateMailservers on ShhExtService.
|
||||
func (b *StatusBackend) UpdateMailservers(enodes []string) error {
|
||||
st, err := b.statusNode.ShhExtService()
|
||||
|
|
|
@ -93,6 +93,42 @@ func SignGroupMembership(content *C.char) *C.char {
|
|||
return C.CString(string(data))
|
||||
}
|
||||
|
||||
// EnableInstallation enables an installation for multi-device sync.
|
||||
//export EnableInstallation
|
||||
func EnableInstallation(installationID *C.char) *C.char {
|
||||
err := statusBackend.EnableInstallation(C.GoString(installationID))
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
data, err := json.Marshal(struct {
|
||||
Response string `json:"response"`
|
||||
}{Response: "ok"})
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
return C.CString(string(data))
|
||||
}
|
||||
|
||||
// DisableInstallation disables an installation for multi-device sync.
|
||||
//export DisableInstallation
|
||||
func DisableInstallation(installationID *C.char) *C.char {
|
||||
err := statusBackend.DisableInstallation(C.GoString(installationID))
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
data, err := json.Marshal(struct {
|
||||
Response string `json:"response"`
|
||||
}{Response: "ok"})
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
return C.CString(string(data))
|
||||
}
|
||||
|
||||
//ValidateNodeConfig validates config for status node
|
||||
//export ValidateNodeConfig
|
||||
func ValidateNodeConfig(configJSON *C.char) *C.char {
|
||||
|
|
|
@ -104,6 +104,40 @@ func SignGroupMembership(content string) string {
|
|||
return string(data)
|
||||
}
|
||||
|
||||
// EnableInstallation enables an installation for multi-device sync.
|
||||
func EnableInstallation(installationID string) string {
|
||||
err := statusBackend.EnableInstallation(installationID)
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
data, err := json.Marshal(struct {
|
||||
Response string `json:"response"`
|
||||
}{Response: "ok"})
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
return string(data)
|
||||
}
|
||||
|
||||
// DisableInstallation disables an installation for multi-device sync.
|
||||
func DisableInstallation(installationID string) string {
|
||||
err := statusBackend.DisableInstallation(installationID)
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
data, err := json.Marshal(struct {
|
||||
Response string `json:"response"`
|
||||
}{Response: "ok"})
|
||||
if err != nil {
|
||||
return makeJSONResponse(err)
|
||||
}
|
||||
|
||||
return string(data)
|
||||
}
|
||||
|
||||
// ValidateNodeConfig validates config for the Status node.
|
||||
func ValidateNodeConfig(configJSON string) string {
|
||||
var resp APIDetailedResponse
|
||||
|
|
Loading…
Reference in New Issue