bullet_train-outgoing_webhooks 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb +2 -0
- data/app/models/concerns/webhooks/outgoing/delivery_attempt_support.rb +13 -5
- data/app/models/concerns/webhooks/outgoing/event_support.rb +3 -3
- data/app/views/account/webhooks/outgoing/endpoints/_form.html.erb +3 -3
- data/app/views/account/webhooks/outgoing/endpoints/show.html.erb +3 -0
- data/config/locales/en/webhooks/outgoing/endpoints.en.yml +4 -3
- data/lib/bullet_train/outgoing_webhooks/version.rb +1 -1
- data/lib/bullet_train/outgoing_webhooks.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8374fc77da7bb26e3f82e7b38f7324fac6b5e817a285810e57c61c596a13a8e
|
4
|
+
data.tar.gz: f508d273562d3c44b0792f70e4ceb4730e301f77d338f4af43d343d41869d10b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 959cacc6c161f66a9910a512810592aba4a38f99bfad0b60f1b37932d90cf6b6deb261d64d8a3eebf96d30840b9a7970b8f9c90e981e61005ac38dfcc8c6f0e6
|
7
|
+
data.tar.gz: 42df3deb39cdc68862cf1aeaf444940bf182f704badaeedfff5f6cf318a31a9e292c57d4fb13584b091586532653bf5a9735f09fdf6a8d4854a502cc3c34432e
|
@@ -41,8 +41,10 @@ class Api::V1::Webhooks::Outgoing::EndpointsController < Api::V1::ApplicationCon
|
|
41
41
|
*permitted_fields,
|
42
42
|
:url,
|
43
43
|
:name,
|
44
|
+
:scaffolding_absolutely_abstract_creative_concept_id,
|
44
45
|
# 🚅 super scaffolding will insert new fields above this line.
|
45
46
|
*permitted_arrays,
|
47
|
+
event_type_ids: [],
|
46
48
|
# 🚅 super scaffolding will insert new arrays above this line.
|
47
49
|
)
|
48
50
|
|
@@ -31,13 +31,21 @@ module Webhooks::Outgoing::DeliveryAttemptSupport
|
|
31
31
|
def attempt
|
32
32
|
uri = URI.parse(delivery.endpoint_url)
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
if BulletTrain::OutgoingWebhooks.advanced_hostname_security
|
35
|
+
unless allowed_uri?(uri)
|
36
|
+
self.response_code = 0
|
37
|
+
self.error_message = "URI is not allowed: " + uri
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
hostname = if BulletTrain::OutgoingWebhooks.advanced_hostname_security
|
43
|
+
resolve_ip_from_authoritative(uri.hostname.downcase)
|
44
|
+
else
|
45
|
+
uri.hostname.downcase
|
38
46
|
end
|
39
47
|
|
40
|
-
http = Net::HTTP.new(
|
48
|
+
http = Net::HTTP.new(hostname, uri.port)
|
41
49
|
http.use_ssl = true if uri.scheme == "https"
|
42
50
|
request = Net::HTTP::Post.new(uri.path)
|
43
51
|
request.add_field("Host", uri.host)
|
@@ -30,11 +30,11 @@ module Webhooks::Outgoing::EventSupport
|
|
30
30
|
def endpoints
|
31
31
|
endpoints = send(BulletTrain::OutgoingWebhooks.parent_association).webhooks_outgoing_endpoints.listening_for_event_type_id(event_type_id)
|
32
32
|
|
33
|
-
case
|
33
|
+
case subject_type
|
34
34
|
when "Scaffolding::AbsolutelyAbstract::CreativeConcept"
|
35
|
-
endpoints.where(scaffolding_absolutely_abstract_creative_concept_id: [
|
35
|
+
endpoints.where(scaffolding_absolutely_abstract_creative_concept_id: [subject.id, nil])
|
36
36
|
when "Scaffolding::CompletelyConcrete::TangibleThing"
|
37
|
-
endpoints.where(scaffolding_absolutely_abstract_creative_concept_id: [
|
37
|
+
endpoints.where(scaffolding_absolutely_abstract_creative_concept_id: [subject.absolutely_abstract_creative_concept_id, nil])
|
38
38
|
else
|
39
39
|
endpoints
|
40
40
|
end
|
@@ -4,10 +4,10 @@
|
|
4
4
|
<% with_field_settings form: form do %>
|
5
5
|
<%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
|
6
6
|
<%= render 'shared/fields/text_field', method: :url %>
|
7
|
-
<%= render 'shared/fields/super_select', method: :scaffolding_absolutely_abstract_creative_concept_id,
|
8
|
-
choices: [['None', '']] + @endpoint.creative_concepts.map { |event_type| [event_type.name, event_type.id] }, other_options: {search: true} %>
|
9
7
|
<%= render 'shared/fields/super_select', method: :event_type_ids, html_options: {multiple: true},
|
10
|
-
|
8
|
+
choices: @endpoint.valid_event_types.map { |event_type| [event_type.label_string, event_type.id] } %>
|
9
|
+
<%= render 'shared/fields/super_select', method: :scaffolding_absolutely_abstract_creative_concept_id,
|
10
|
+
choices: [['None', '']] + @endpoint.creative_concepts.map { |event_type| [event_type.name, event_type.id] }, other_options: {search: true} %>
|
11
11
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
12
12
|
<% end %>
|
13
13
|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
<% with_attribute_settings object: @endpoint, strategy: :label do %>
|
13
13
|
<%= render 'shared/attributes/text', attribute: :name %>
|
14
14
|
<%= render 'shared/attributes/code', attribute: :url %>
|
15
|
+
|
15
16
|
<% # TODO We should make the `has_many` attribute partial configurable enough to handle this use case. %>
|
16
17
|
<%= render 'shared/attributes/attribute', attribute: :event_types do %>
|
17
18
|
<% if @endpoint.event_type_ids.any? %>
|
@@ -25,6 +26,8 @@
|
|
25
26
|
<%= t('webhooks/outgoing/endpoints.fields.event_types.all') %>
|
26
27
|
<% end %>
|
27
28
|
<% end %>
|
29
|
+
|
30
|
+
<%= render 'shared/attributes/belongs_to', attribute: :scaffolding_absolutely_abstract_creative_concept %>
|
28
31
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
29
32
|
<% end %>
|
30
33
|
<% end %>
|
@@ -46,11 +46,12 @@ en:
|
|
46
46
|
all: All Events
|
47
47
|
event_types: *event_types
|
48
48
|
|
49
|
-
scaffolding_absolutely_abstract_creative_concept_id:
|
50
|
-
_: &scaffolding_absolutely_abstract_creative_concept_id Creative Concept
|
49
|
+
scaffolding_absolutely_abstract_creative_concept_id: &scaffolding_absolutely_abstract_creative_concept
|
50
|
+
_: &scaffolding_absolutely_abstract_creative_concept_id Within Creative Concept
|
51
51
|
label: *scaffolding_absolutely_abstract_creative_concept_id
|
52
52
|
heading: *scaffolding_absolutely_abstract_creative_concept_id
|
53
|
-
|
53
|
+
|
54
|
+
scaffolding_absolutely_abstract_creative_concept: *scaffolding_absolutely_abstract_creative_concept
|
54
55
|
|
55
56
|
# 🚅 super scaffolding will insert new fields above this line.
|
56
57
|
created_at:
|
@@ -9,6 +9,7 @@ module BulletTrain
|
|
9
9
|
|
10
10
|
mattr_accessor :parent_class, default: default_for(BulletTrain, :parent_class, "Team")
|
11
11
|
mattr_accessor :base_class, default: default_for(BulletTrain, :base_class, "ApplicationRecord")
|
12
|
+
mattr_accessor :advanced_hostname_security, default: false
|
12
13
|
|
13
14
|
def self.parent_association
|
14
15
|
parent_class.underscore.to_sym
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-outgoing_webhooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|