mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 23:54:22 +01:00
Add ability to update about text in UpdateProfileRequest
This commit is contained in:
@@ -146,6 +146,7 @@ type CreateGroupResponse struct {
|
||||
type UpdateProfileRequest struct {
|
||||
Name string `json:"name"`
|
||||
Base64Avatar string `json:"base64_avatar"`
|
||||
About string `json:"about"`
|
||||
}
|
||||
|
||||
type TrustIdentityRequest struct {
|
||||
@@ -1115,7 +1116,7 @@ func (a *Api) UpdateProfile(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.signalClient.UpdateProfile(number, req.Name, req.Base64Avatar)
|
||||
err = a.signalClient.UpdateProfile(number, req.Name, req.Base64Avatar, req.About)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
|
||||
@@ -1356,7 +1356,7 @@ func (s *SignalClient) GetAttachment(attachment string) ([]byte, error) {
|
||||
return attachmentBytes, nil
|
||||
}
|
||||
|
||||
func (s *SignalClient) UpdateProfile(number string, profileName string, base64Avatar string) error {
|
||||
func (s *SignalClient) UpdateProfile(number string, profileName string, base64Avatar string, about string) error {
|
||||
var err error
|
||||
var avatarTmpPath string
|
||||
if base64Avatar != "" {
|
||||
@@ -1399,6 +1399,7 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
|
||||
Name string `json:"given-name"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
RemoveAvatar bool `json:"remove-avatar"`
|
||||
About string `json:"about"`
|
||||
}
|
||||
request := Request{Name: profileName}
|
||||
if base64Avatar == "" {
|
||||
@@ -1413,7 +1414,7 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
|
||||
}
|
||||
_, err = jsonRpc2Client.getRaw("updateProfile", &number, request)
|
||||
} else {
|
||||
cmd := []string{"--config", s.signalCliConfig, "-a", number, "updateProfile", "--given-name", profileName}
|
||||
cmd := []string{"--config", s.signalCliConfig, "-a", number, "updateProfile", "--given-name", profileName, "--about", about}
|
||||
if base64Avatar == "" {
|
||||
cmd = append(cmd, "--remove-avatar")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user