mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-08-23 05:16:02 +00:00
chore: Formattet the project
This commit is contained in:
parent
0651bca94b
commit
6c774054fd
@ -744,7 +744,7 @@ func (s *SignalClient) About() About {
|
||||
BuildNr: 2,
|
||||
Mode: getSignalCliModeString(s.signalCliMode),
|
||||
Version: utils.GetEnv("BUILD_VERSION", "unset"),
|
||||
Capabilities: map[string][]string{"v2/send": []string{"quotes", "mentions"}},
|
||||
Capabilities: map[string][]string{"v2/send": {"quotes", "mentions"}},
|
||||
}
|
||||
return about
|
||||
}
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/yuin/gopher-lua"
|
||||
"github.com/cjoudrey/gluahttp"
|
||||
"layeh.com/gopher-luar"
|
||||
luajson "layeh.com/gopher-json"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/bbernhard/signal-cli-rest-api/utils"
|
||||
"github.com/bbernhard/signal-cli-rest-api/api"
|
||||
"strings"
|
||||
"github.com/bbernhard/signal-cli-rest-api/utils"
|
||||
"github.com/cjoudrey/gluahttp"
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"io"
|
||||
luajson "layeh.com/gopher-json"
|
||||
"layeh.com/gopher-luar"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type PluginInputData struct {
|
||||
Params map[string]string
|
||||
Params map[string]string
|
||||
QueryParams map[string]string
|
||||
Payload string
|
||||
Payload string
|
||||
}
|
||||
|
||||
type PluginOutputData struct {
|
||||
payload string
|
||||
payload string
|
||||
httpStatusCode int
|
||||
}
|
||||
|
||||
@ -50,13 +50,13 @@ func execPlugin(c *gin.Context, pluginConfig utils.PluginConfig) {
|
||||
}
|
||||
|
||||
pluginInputData := &PluginInputData{
|
||||
Params: make(map[string]string),
|
||||
Params: make(map[string]string),
|
||||
QueryParams: make(map[string]string),
|
||||
Payload: string(jsonData),
|
||||
Payload: string(jsonData),
|
||||
}
|
||||
|
||||
pluginOutputData := &PluginOutputData{
|
||||
payload: "",
|
||||
payload: "",
|
||||
httpStatusCode: 200,
|
||||
}
|
||||
|
||||
@ -98,5 +98,5 @@ func (p plugHandler) ExecutePlugin(pluginConfig utils.PluginConfig) gin.HandlerF
|
||||
return gin.HandlerFunc(fn)
|
||||
}
|
||||
|
||||
//exported
|
||||
// exported
|
||||
var PluginHandler plugHandler
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func GetEnv(key string, defaultVal string) string {
|
||||
|
||||
@ -11,32 +11,31 @@ func expectEqual(t *testing.T, in1 bool, in2 bool) {
|
||||
}
|
||||
|
||||
func TestIsPhoneNumber(t *testing.T) {
|
||||
res := IsPhoneNumber("+12345678")
|
||||
res := IsPhoneNumber("+12345678")
|
||||
expectEqual(t, res, true)
|
||||
}
|
||||
|
||||
|
||||
func TestIsPhoneNumberWithSpaces(t *testing.T) {
|
||||
res := IsPhoneNumber("+ 12345678")
|
||||
res := IsPhoneNumber("+ 12345678")
|
||||
expectEqual(t, res, true)
|
||||
}
|
||||
|
||||
func TestIsPhoneNumberWithSpaces1(t *testing.T) {
|
||||
res := IsPhoneNumber("+ 1234 5678")
|
||||
res := IsPhoneNumber("+ 1234 5678")
|
||||
expectEqual(t, res, true)
|
||||
}
|
||||
|
||||
func TestIsPhoneNumberWithInvalidCharacters(t *testing.T) {
|
||||
res := IsPhoneNumber("+123456x")
|
||||
res := IsPhoneNumber("+123456x")
|
||||
expectEqual(t, res, false)
|
||||
}
|
||||
|
||||
func TestIsPhoneNumberWithMissingPrefix(t *testing.T) {
|
||||
res := IsPhoneNumber("123456x")
|
||||
res := IsPhoneNumber("123456x")
|
||||
expectEqual(t, res, false)
|
||||
}
|
||||
|
||||
func TestIsPhoneNumberWithInvalidCharactersAndSpaces(t *testing.T) {
|
||||
res := IsPhoneNumber("+12345 6x")
|
||||
res := IsPhoneNumber("+12345 6x")
|
||||
expectEqual(t, res, false)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user