gofmt code

see #12
This commit is contained in:
Bernhard B
2020-04-05 11:35:43 +02:00
parent 5d0eb28772
commit 54f1f5f13e

View File

@@ -1,23 +1,22 @@
package main
import (
log "github.com/sirupsen/logrus"
"github.com/satori/go.uuid"
"github.com/gin-gonic/gin"
"github.com/h2non/filetype"
"os/exec"
"time"
"errors"
"flag"
"bytes"
"os"
"encoding/base64"
"encoding/json"
"errors"
"flag"
"github.com/gin-gonic/gin"
"github.com/h2non/filetype"
"github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"os"
"os/exec"
"strings"
"time"
)
type GroupEntry struct{
type GroupEntry struct {
Name string `json:"name"`
Id string `json:"id"`
InternalId string `json:"internal_id"`
@@ -53,7 +52,6 @@ func send(c *gin.Context, attachmentTmpDir string, signalCliConfig string, numbe
cmd = append(cmd, []string{"-g", string(groupId)}...)
}
attachmentTmpPaths := []string{}
for _, base64Attachment := range base64Attachments {
u, err := uuid.NewV4()
@@ -100,7 +98,7 @@ func send(c *gin.Context, attachmentTmpDir string, signalCliConfig string, numbe
if len(attachmentTmpPaths) > 0 {
cmd = append(cmd, "-a")
cmd = append(cmd , attachmentTmpPaths...)
cmd = append(cmd, attachmentTmpPaths...)
}
_, err := runSignalCli(cmd)
@@ -223,7 +221,7 @@ func main() {
router.POST("/v1/register/:number", func(c *gin.Context) {
number := c.Param("number")
type Request struct{
type Request struct {
UseVoice bool `json:"use_voice"`
}
@@ -275,7 +273,6 @@ func main() {
return
}
_, err := runSignalCli([]string{"--config", *signalCliConfig, "-u", number, "verify", token})
if err != nil {
c.JSON(400, gin.H{"error": err.Error()})
@@ -285,7 +282,7 @@ func main() {
})
router.POST("/v1/send", func(c *gin.Context) {
type Request struct{
type Request struct {
Number string `json:"number"`
Recipients []string `json:"recipients"`
Message string `json:"message"`
@@ -308,7 +305,7 @@ func main() {
})
router.POST("/v2/send", func(c *gin.Context) {
type Request struct{
type Request struct {
Number string `json:"number"`
Recipients []string `json:"recipients"`
Message string `json:"message"`
@@ -354,7 +351,7 @@ func main() {
router.POST("/v1/groups/:number", func(c *gin.Context) {
number := c.Param("number")
type Request struct{
type Request struct {
Name string `json:"name"`
Members []string `json:"members"`
}
@@ -367,7 +364,6 @@ func main() {
return
}
cmd := []string{"--config", *signalCliConfig, "-u", number, "updateGroup", "-n", req.Name, "-m"}
cmd = append(cmd, req.Members...)
log.Info(cmd)
@@ -393,7 +389,6 @@ func main() {
c.JSON(200, groups)
})
router.DELETE("/v1/groups/:number/:groupid", func(c *gin.Context) {
base64EncodedGroupId := c.Param("groupid")
number := c.Param("number")