Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
Make the signing key optional
Acho Arnold431c2cf8d0e9
diff --git a/api/pkg/requests/request.go b/api/pkg/requests/request.goindex 19688f68..b6842804 100644--- a/api/pkg/requests/request.go+++ b/api/pkg/requests/request.go@@ -1,6 +1,7 @@package requestsimport (+ "net/url""strconv""strings""unicode"@@ -42,6 +43,18 @@ func (input *request) sanitizeBool(value string) string {return value}+func (input *request) sanitizeURL(value string) string {+ value = strings.TrimSpace(value)+ website, err := url.Parse(value)+ if err != nil {+ return value+ }+ if website.Scheme == "" {+ return "https://" + value+ }+ return value+}+func (input *request) sanitizeStringPointer(value string) *string {value = strings.TrimSpace(value)if value == "" {diff --git a/api/pkg/requests/webhook_store_request.go b/api/pkg/requests/webhook_store_request.goindex d453adeb..fca0a7d2 100644--- a/api/pkg/requests/webhook_store_request.go+++ b/api/pkg/requests/webhook_store_request.go@@ -18,7 +18,8 @@ type WebhookStore struct {// Sanitize sets defaults to WebhookStorefunc (input *WebhookStore) Sanitize() WebhookStore {- input.URL = strings.TrimSpace(input.URL)+ input.URL = input.sanitizeURL(input.URL)+ input.SigningKey = strings.TrimSpace(input.SigningKey)input.Events = input.removeStringDuplicates(input.Events)var phoneNumbers []stringdiff --git a/api/pkg/validators/webhook_handler_validator.go b/api/pkg/validators/webhook_handler_validator.goindex 89fd5042..131ae329 100644--- a/api/pkg/validators/webhook_handler_validator.go+++ b/api/pkg/validators/webhook_handler_validator.go@@ -70,7 +70,6 @@ func (validator *WebhookHandlerValidator) ValidateStore(ctx context.Context, useData: &request,Rules: govalidator.MapData{"signing_key": []string{- "required","min:1","max:255",},diff --git a/web/pages/settings/index.vue b/web/pages/settings/index.vueindex 9b439b5a..2061e2ae 100644--- a/web/pages/settings/index.vue+++ b/web/pages/settings/index.vue@@ -429,7 +429,7 @@class="mt-6"persistent-placeholderpersistent-hint- label="Signing Key"+ label="Signing Key (optional)"placeholder="******************":error="errorMessages.has('signing_key')":error-messages="errorMessages.get('signing_key')"