Compare commits

..

1 Commits

Author SHA1 Message Date
Benjamin Gaudé e9d178a11e Add debian directory 2021-03-19 12:58:15 +01:00
18 changed files with 5714 additions and 8745 deletions

View File

@ -40,7 +40,6 @@ tidy:
go mod tidy
watch:
go get github.com/cortesi/modd/cmd/modd
go run github.com/cortesi/modd/cmd/modd
lint:

View File

@ -75,10 +75,10 @@ Un exemple d'appel à l'API est disponible dans le fichier [`misc/powow.http`](.
### Dépendances
- Go 1.17
- Go 1.13
- modd
- make
- NodeJS (20.x) / npm
- NodeJS/npm
### Compiler et démarrer le serveur de développement

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

14
debian/control vendored Normal file
View File

@ -0,0 +1,14 @@
Source: fake-sms
Section: unknown
Priority: optional
Maintainer: Cadoles <contact@cadoles.com>
Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar, curl
Standards-Version: 3.9.4
Homepage: http://forge.cadoles.com/Cadoles/fake-sms
Vcs-Git: http://forge.cadoles.com/Cadoles/fake-sms.git
Vcs-Browser: http://forge.cadoles.com/Cadoles/fake-sms
Package: fake-sms
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Serveur d'envoi de SMS factice pour le développement avec interface web

1
debian/fake-sms.dirs vendored Normal file
View File

@ -0,0 +1 @@
var/lib/fake-sms

11
debian/fake-sms.service vendored Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Serveur d'envoi de SMS factice pour le développement avec interface web
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/fake-sms -workdir /usr/share/fake-sms -config /etc/fake-sms/config.yml
Restart=on-failure
[Install]
WantedBy=multi-user.target

54
debian/rules vendored Normal file
View File

@ -0,0 +1,54 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
GO_VERSION := 1.15.6
OS := linux
ARCH := amd64
GOPATH=$(HOME)/go
ifeq (, $(shell which go 2>/dev/null))
override_dh_auto_build: install-go
endif
ifeq (, $(shell which node 2>/dev/null))
override_dh_auto_build: install-nodejs
endif
%:
dh $@ --with systemd
override_dh_auto_build: $(GOPATH)
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" make tooling
npm install
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" go mod vendor
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release
$(GOPATH):
mkdir -p $(GOPATH)
install-go:
wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
install-nodejs:
curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
override_dh_auto_install:
mkdir -p debian/fake-sms/usr/share/fake-sms
mkdir -p debian/fake-sms/etc/fake-sms
mkdir -p debian/fake-sms/usr/bin
cp -r release/fake-sms-$(OS)-$(ARCH)/* debian/fake-sms/usr/share/fake-sms/
mv debian/fake-sms/usr/share/fake-sms/bin/fake-sms debian/fake-sms/usr/bin/fake-sms
mv debian/fake-sms/usr/share/fake-sms/config.yml debian/fake-sms/etc/fake-sms/config.yml
install -d debian/fake-sms
override_dh_strip:
override_dh_auto_test:

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

10
go.mod
View File

@ -5,15 +5,21 @@ go 1.14
require (
github.com/asdine/storm/v3 v3.1.1
github.com/caarlos0/env/v6 v6.2.1
github.com/cortesi/modd v0.0.0-20221227201034-99fec65d0ecf // indirect
github.com/cortesi/modd v0.0.0-20210222043654-cbdcc23af7d5 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/elliotchance/phpserialize v1.3.0
github.com/fatih/color v1.10.0 // indirect
github.com/go-chi/chi v4.1.1+incompatible
github.com/google/go-cmp v0.5.4 // indirect
github.com/kovetskiy/go-php-serialize v0.0.0-20141101074437-71ef41a548d8
github.com/kovetskiy/go-php-serialize v0.0.0-20141101074437-71ef41a548d8 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0 // indirect
gitlab.com/wpetit/goweb v0.0.0-20200707070104-985ce3eba3c2
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d // indirect
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.2.8
)

26
go.sum
View File

@ -46,8 +46,8 @@ github.com/caarlos0/env/v6 v6.2.1 h1:/bFpX1dg4TNioJjg7mrQaSrBoQvRfLUHNfXivdFbbEo
github.com/caarlos0/env/v6 v6.2.1/go.mod h1:3LpmfcAYCG6gCiSgDLaFR5Km1FRpPwFvBbRcjHar6Sw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cortesi/modd v0.0.0-20221227201034-99fec65d0ecf h1:NjFxMa5TC3Yb4jhI+7QnC6OZOL11sLpo5i0KlH3TWKw=
github.com/cortesi/modd v0.0.0-20221227201034-99fec65d0ecf/go.mod h1:WgVcz6/4WJwygF7In33TF8u5yu3SOSpO957IEu0SQ0g=
github.com/cortesi/modd v0.0.0-20210222043654-cbdcc23af7d5 h1:R2McxbAMq4aEHYUzQ8DGxWPXHSr33LdWS1C2qWCS554=
github.com/cortesi/modd v0.0.0-20210222043654-cbdcc23af7d5/go.mod h1:5XXIj61uad0c9FWBHCA1M+pP+xvO0+/OI10xL4Hg68w=
github.com/cortesi/moddwatch v0.0.0-20210222043437-a6aaad86a36e h1:vNbhR09qtq9ELJgvhAWng4zl/4CVTPBPVev3R8MlUYc=
github.com/cortesi/moddwatch v0.0.0-20210222043437-a6aaad86a36e/go.mod h1:MUkYRZrwFTHATqCI5tDJRPqmBt9xf3q4+Avfut7kCCE=
github.com/cortesi/termlog v0.0.0-20210222042314-a1eec763abec h1:v7D8uHsIKsyjfyhhNdY4qivqN558Ejiq+CDXiUljZ+4=
@ -63,13 +63,13 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/elliotchance/phpserialize v1.3.0 h1:yQ9t2spsOBp95V9qo4vPYIC2bXFaYOraRb8hpWd5E38=
github.com/elliotchance/phpserialize v1.3.0/go.mod h1:gt7XX9+ETUcLXbtTKEuyrqW3lcLUAeS/AnGZ2e49TZs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4=
github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
@ -133,15 +133,11 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
@ -185,8 +181,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -219,9 +213,6 @@ golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210323141857-08027d57d8cf h1:sewfyKLWuY3ko6EI4hbFziQ8bHkfammpzCDfLT92I1c=
golang.org/x/net v0.0.0-20210323141857-08027d57d8cf/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -253,16 +244,11 @@ golang.org/x/sys v0.0.0-20201029080932-201ba4db2418/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 h1:SgQ6LNaYJU0JIuEHv9+s6EbhSCwYeAf5Yvj6lpYlqAE=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20191110171634-ad39bd3f0407/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs=
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@ -340,6 +326,6 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
mvdan.cc/editorconfig v0.1.1-0.20200121172147-e40951bde157/go.mod h1:Ge4atmRUYqueGppvJ7JNrtqpqokoJEFxYbP0Z+WeKS8=
mvdan.cc/sh/v3 v3.3.0-0.dev.0.20210224101809-fb5052e7a010 h1:0xJA1YM0Ppa63jEfcdPsjRHo1qxklwXWhIPr9tAQ2J4=
mvdan.cc/sh/v3 v3.3.0-0.dev.0.20210224101809-fb5052e7a010/go.mod h1:fPQmabBpREM/XQ9YXSU5ZFZ/Sm+PmKP9/vkFHgYKJEI=
mvdan.cc/sh/v3 v3.2.2 h1:UpH3jtOUEXBWXZg35bnRukUjsB6UR+nNhhXCi2dGKOs=
mvdan.cc/sh/v3 v3.2.2/go.mod h1:fPQmabBpREM/XQ9YXSU5ZFZ/Sm+PmKP9/vkFHgYKJEI=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

View File

@ -28,8 +28,7 @@ type DataConfig struct {
}
type PowowConfig struct {
APIKey string `yaml:"apiKey" env:"FAKESMS_POWOW_API_KEY"`
InvalidPhoneNumber string `yaml:"invalidPhoneNumber" env:"FAKESMS_POWOW_INVALID_PHONE_NUMBER"`
APIKey string `yaml:"apiKey" env:"FAKESMS_POWOW_API_KEY"`
}
type PowowSMS struct {
@ -79,8 +78,7 @@ func NewDefault() *Config {
Path: "fakesms.db",
},
Powow: PowowConfig{
APIKey: "powow",
InvalidPhoneNumber: "+33666666666",
APIKey: "powow",
},
}
}

View File

@ -103,7 +103,17 @@ func HandleGetOutbox(ctx context.Context, qry cqrs.Query) (interface{}, error) {
match := true
if req.Search.Recipient != "" {
match = strings.Contains(sms.Recipient, req.Search.Recipient)
found := false
if strings.Contains(sms.Recipient, req.Search.Recipient) {
found = true
break
}
if !found {
match = false
}
}
if !req.Search.After.IsZero() && !sms.SentAt.After(req.Search.After) {

View File

@ -81,6 +81,16 @@ func handlePowowEntrypoint(w http.ResponseWriter, r *http.Request) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
//data, err := ioutil.ReadAll(r.Body)
//if err != nil {
// logger.Error(ctx, "could not read body", logger.E(errors.WithStack(err)))
// http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
// return
//}
//defer r.Body.Close()
pr := &PowowRequest{
Payload: make(map[string]interface{}),
}
@ -121,12 +131,26 @@ func handlePowowEntrypoint(w http.ResponseWriter, r *http.Request) {
}
pr.Payload = map[string]interface{}{
"SmsID": smsid,
"MobilePhoneNumber": strings.TrimSpace(r.FormValue("MobilePhoneNumber")),
"MobilePhoneNumber": r.FormValue("MobilePhoneNumber"),
"TimeToSend": r.FormValue("TimeToSend"),
"CustomData": customData,
}
}
//if err := json.Unmarshal(data, pr); err != nil {
// logger.Error(ctx, "could not parse request", logger.E(errors.WithStack(err)))
// http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
// return
//}
//if err := json.Unmarshal(data, &pr.Payload); err != nil {
// logger.Error(ctx, "could not parse request payload", logger.E(errors.WithStack(err)))
// http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
// return
//}
// Authenticate user
if conf.Powow.APIKey != pr.APIKey {
res := &PowowResponse{
@ -139,18 +163,6 @@ func handlePowowEntrypoint(w http.ResponseWriter, r *http.Request) {
return
}
// If phone number must return an error
if conf.Powow.InvalidPhoneNumber == pr.Payload["MobilePhoneNumber"] {
res := &PowowResponse{
Success: false,
ErrorCode: map[int]ErrorCode{0: ErrorCodeTransactionSMSSendInvalidMobilePhoneNumber},
}
sendPowowResponse(w, res)
return
}
// Handle Powow command
switch pr.Command {
case CommandTransactionalSMSSend:

View File

@ -1,13 +1,13 @@
FROM golang:1.17 AS build
FROM golang:1.15 AS build
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG http_proxy=
ARG https_proxy=
RUN apt-get update && apt-get install -y build-essential git bash curl python2
RUN apt-get update && apt-get install -y build-essential git bash curl
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y nodejs
COPY . /src

View File

@ -38,16 +38,3 @@ APIKey=powow
&TimeToSend=2017-01-01 10:00:00
&CustomData=a%3A1%3A%7Bs%3A9%3A%22Firstname%22%3Bs%3A8%3A%22am9obg%3D%3D%22%3B%7D
# custom data [Firstname => "john"] = a:1:{s:9:"Firstname";s:8:"am9obg==";}
### Send transactional SMS - Generate InvalidPhoneNumber error with valid phone number
POST http://localhost:3000/api/v1/mock/powow
Content-Type: application/x-www-form-urlencoded
APIKey=powow
&Command=TransactionalSms.Send
&ResponseFormat=JSON
&SmsID={{SmsID}}
&MobilePhoneNumber=%2B33666666666
&TimeToSend=2017-01-01 10:00:00
&CustomData=a%3A1%3A%7Bs%3A9%3A%22Firstname%22%3Bs%3A8%3A%22am9obg%3D%3D%22%3B%7D

14225
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,21 +11,21 @@
"author": "Cadoles <contact@cadoles.com>",
"license": "AGPL-3.0",
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.9",
"babel-loader": "^9.1.3",
"bulma": "^0.9.4",
"bulma-switch": "^2.0.4",
"css-loader": "^6.10.0",
"file-loader": "^6.2.0",
"mini-css-extract-plugin": "^2.8.0",
"node-sass": "~9.0",
"resolve-url-loader": "^5.0.0",
"sass-loader": "^14.1.1",
"stimulus": "^3.2.2",
"style-loader": "^3.3.4",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
"@babel/core": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@babel/preset-env": "^7.2.0",
"babel-loader": "^8.0.4",
"bulma": "^0.8.2",
"bulma-switch": "^2.0.0",
"css-loader": "^3.5.2",
"file-loader": "^6.0.0",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.10.0",
"resolve-url-loader": "^3.0.0",
"sass-loader": "^8.0.2",
"stimulus": "^1.1.0",
"style-loader": "^1.1.4",
"webpack": "^4.25.0",
"webpack-cli": "^3.1.2"
}
}

View File

@ -64,8 +64,8 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin({
filename: "./css/[name].css",
chunkFilename: "./css/[id].css"
filename: "/css/[name].css",
chunkFilename: "/css/[id].css"
})
]
}