format sourcecode with gofmt

This commit is contained in:
Bernhard B 2025-06-03 22:19:22 +02:00
parent b3a6ee1e5d
commit fb6ec6013b
2 changed files with 53 additions and 54 deletions

View File

@ -439,7 +439,7 @@ func (a *Api) SendV2(c *gin.Context) {
} }
textMode := req.TextMode textMode := req.TextMode
if textMode == nil { if textMode == nil {
defaultSignalTextMode := utils.GetEnv("DEFAULT_SIGNAL_TEXT_MODE", "normal") defaultSignalTextMode := utils.GetEnv("DEFAULT_SIGNAL_TEXT_MODE", "normal")
if defaultSignalTextMode == "styled" { if defaultSignalTextMode == "styled" {
styledStr := "styled" styledStr := "styled"

View File

@ -190,38 +190,38 @@ type ListInstalledStickerPacksResponse struct {
} }
type ContactProfile struct { type ContactProfile struct {
GivenName string `json:"given_name"` GivenName string `json:"given_name"`
FamilyName string `json:"lastname"` FamilyName string `json:"lastname"`
About string `json:"about"` About string `json:"about"`
HasAvatar bool `json:"has_avatar"` HasAvatar bool `json:"has_avatar"`
LastUpdatedTimestamp int64 `json:"last_updated_timestamp"` LastUpdatedTimestamp int64 `json:"last_updated_timestamp"`
} }
type Nickname struct { type Nickname struct {
Name string `json:"name"` Name string `json:"name"`
GivenName string `json:"given_name"` GivenName string `json:"given_name"`
FamilyName string `json:"family_name"` FamilyName string `json:"family_name"`
} }
type ListContactsResponse struct { type ListContactsResponse struct {
Number string `json:"number"` Number string `json:"number"`
Uuid string `json:"uuid"` Uuid string `json:"uuid"`
Name string `json:"name"` Name string `json:"name"`
ProfileName string `json:"profile_name"` ProfileName string `json:"profile_name"`
Username string `json:"username"` Username string `json:"username"`
Color string `json:"color"` Color string `json:"color"`
Blocked bool `json:"blocked"` Blocked bool `json:"blocked"`
MessageExpiration string `json:"message_expiration"` MessageExpiration string `json:"message_expiration"`
Note string `json:"note"` Note string `json:"note"`
Profile ContactProfile `json:"profile"` Profile ContactProfile `json:"profile"`
GivenName string `json:"given_name"` GivenName string `json:"given_name"`
Nickname Nickname `json:"nickname"` Nickname Nickname `json:"nickname"`
} }
type ListDevicesResponse struct { type ListDevicesResponse struct {
Name string `json:"name"` Name string `json:"name"`
LastSeenTimestamp int64 `json:"last_seen_timestamp"` LastSeenTimestamp int64 `json:"last_seen_timestamp"`
CreationTimestamp int64 `json:"creation_timestamp"` CreationTimestamp int64 `json:"creation_timestamp"`
} }
func cleanupTmpFiles(paths []string) { func cleanupTmpFiles(paths []string) {
@ -1311,7 +1311,7 @@ func (s *SignalClient) GetGroupAvatar(number string, groupId string) ([]byte, er
rawData, err = jsonRpc2Client.getRaw("getAvatar", &number, request) rawData, err = jsonRpc2Client.getRaw("getAvatar", &number, request)
if err != nil { if err != nil {
if err.Error() == "Could not find avatar" { if err.Error() == "Could not find avatar" {
return []byte{},&NotFoundError{Description: "No avatar found."} return []byte{}, &NotFoundError{Description: "No avatar found."}
} }
return []byte{}, err return []byte{}, err
} }
@ -1480,7 +1480,7 @@ func (s *SignalClient) GetAccounts() ([]string, error) {
func (s *SignalClient) GetAttachments() ([]string, error) { func (s *SignalClient) GetAttachments() ([]string, error) {
files := []string{} files := []string{}
attachmentsPath := s.signalCliConfig+"/attachments/" attachmentsPath := s.signalCliConfig + "/attachments/"
if _, err := os.Stat(attachmentsPath); !os.IsNotExist(err) { if _, err := os.Stat(attachmentsPath); !os.IsNotExist(err) {
err = filepath.Walk(attachmentsPath, func(path string, info os.FileInfo, err error) error { err = filepath.Walk(attachmentsPath, func(path string, info os.FileInfo, err error) error {
if info.IsDir() { if info.IsDir() {
@ -2149,10 +2149,10 @@ func (s *SignalClient) ListDevices(number string) ([]ListDevicesResponse, error)
resp := []ListDevicesResponse{} resp := []ListDevicesResponse{}
type ListDevicesSignalCliResponse struct { type ListDevicesSignalCliResponse struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Name string `json:"name"` Name string `json:"name"`
CreatedTimestamp int64 `json:"createdTimestamp"` CreatedTimestamp int64 `json:"createdTimestamp"`
LastSeenTimestamp int64 `json:"lastSeenTimestamp"` LastSeenTimestamp int64 `json:"lastSeenTimestamp"`
} }
var err error var err error
@ -2180,7 +2180,7 @@ func (s *SignalClient) ListDevices(number string) ([]ListDevicesResponse, error)
for _, entry := range signalCliResp { for _, entry := range signalCliResp {
deviceEntry := ListDevicesResponse{ deviceEntry := ListDevicesResponse{
Name: entry.Name, Name: entry.Name,
CreationTimestamp: entry.CreatedTimestamp, CreationTimestamp: entry.CreatedTimestamp,
LastSeenTimestamp: entry.LastSeenTimestamp, LastSeenTimestamp: entry.LastSeenTimestamp,
} }
@ -2376,28 +2376,28 @@ func (s *SignalClient) AddStickerPack(number string, packId string, packKey stri
func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, error) { func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, error) {
type SignalCliProfileResponse struct { type SignalCliProfileResponse struct {
LastUpdateTimestamp int64 `json:"lastUpdateTimestamp"` LastUpdateTimestamp int64 `json:"lastUpdateTimestamp"`
GivenName string `json:"givenName"` GivenName string `json:"givenName"`
FamilyName string `json:"familyName"` FamilyName string `json:"familyName"`
About string `json:"about"` About string `json:"about"`
HasAvatar bool `json:"hasAvatar"` HasAvatar bool `json:"hasAvatar"`
} }
type ListContactsSignlCliResponse struct { type ListContactsSignlCliResponse struct {
Number string `json:"number"` Number string `json:"number"`
Uuid string `json:"uuid"` Uuid string `json:"uuid"`
Name string `json:"name"` Name string `json:"name"`
ProfileName string `json:"profileName"` ProfileName string `json:"profileName"`
Username string `json:"username"` Username string `json:"username"`
Color string `json:"color"` Color string `json:"color"`
Blocked bool `json:"blocked"` Blocked bool `json:"blocked"`
MessageExpiration string `json:"messageExpiration"` MessageExpiration string `json:"messageExpiration"`
Note string `json:"note"` Note string `json:"note"`
GivenName string `json:"givenName"` GivenName string `json:"givenName"`
Profile SignalCliProfileResponse `json:"profile"` Profile SignalCliProfileResponse `json:"profile"`
Nickname string `json:"nickName"` Nickname string `json:"nickName"`
NickGivenName string `json:"nickGivenName"` NickGivenName string `json:"nickGivenName"`
NickFamilyName string `json:"nickFamilyName"` NickFamilyName string `json:"nickFamilyName"`
} }
resp := []ListContactsResponse{} resp := []ListContactsResponse{}
@ -2439,8 +2439,8 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
Color: value.Color, Color: value.Color,
Blocked: value.Blocked, Blocked: value.Blocked,
MessageExpiration: value.MessageExpiration, MessageExpiration: value.MessageExpiration,
Note: value.Note, Note: value.Note,
GivenName: value.GivenName, GivenName: value.GivenName,
} }
entry.Profile.About = value.Profile.About entry.Profile.About = value.Profile.About
entry.Profile.HasAvatar = value.Profile.HasAvatar entry.Profile.HasAvatar = value.Profile.HasAvatar
@ -2456,7 +2456,7 @@ func (s *SignalClient) ListContacts(number string) ([]ListContactsResponse, erro
return resp, nil return resp, nil
} }
func (s *SignalClient) SetPin(number string, registrationLockPin string) (error) { func (s *SignalClient) SetPin(number string, registrationLockPin string) error {
if s.signalCliMode == JsonRpc { if s.signalCliMode == JsonRpc {
type Request struct { type Request struct {
RegistrationLockPin string `json:"pin"` RegistrationLockPin string `json:"pin"`
@ -2481,8 +2481,7 @@ func (s *SignalClient) SetPin(number string, registrationLockPin string) (error)
return nil return nil
} }
func (s *SignalClient) RemovePin(number string) error {
func (s *SignalClient) RemovePin(number string) (error) {
if s.signalCliMode == JsonRpc { if s.signalCliMode == JsonRpc {
jsonRpc2Client, err := s.getJsonRpc2Client() jsonRpc2Client, err := s.getJsonRpc2Client()
if err != nil { if err != nil {