huginn_ntfy_agent 0.1.10 → 0.1.11
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/lib/huginn_ntfy_agent/ntfy_agent.rb +13 -4
- 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: 1aa2e942aeb9996384098af520a81982d95e68b9bcdbca8a045c57023a795dc3
|
4
|
+
data.tar.gz: b81b42b5e80ee569db1c58dd6a2e33e00596c7debdd3b7d0c19a7e725c2aac95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66d7ad71a0791eb7793213f16b7cc30b931db74c0a595571a7f4becdee3f636856863eb7e3b1073c5a3a1c41c02e78a324e08402ec8bb8133be5f959a4598a6c
|
7
|
+
data.tar.gz: 63ea701581462330f061eef10b09343df3fde9370d65bda6d474dcb7af55fd930939b767152fbc57117347f209ca59167c2d5bc64f8df6f738218da2b7947622
|
@@ -27,6 +27,8 @@ module Agents
|
|
27
27
|
The `attach` is an URL of an attachment, see attach via URL
|
28
28
|
|
29
29
|
The `delay` is Timestamp or duration for delayed delivery (30min, 9am).
|
30
|
+
|
31
|
+
The `token` is needed if auth is enabled.
|
30
32
|
|
31
33
|
The `email` is an e-mail address for e-mail notifications
|
32
34
|
|
@@ -71,8 +73,7 @@ module Agents
|
|
71
73
|
form_configurable :emit_events, type: :boolean
|
72
74
|
form_configurable :debug, type: :boolean
|
73
75
|
form_configurable :server, type: :string
|
74
|
-
form_configurable :
|
75
|
-
form_configurable :password, type: :string
|
76
|
+
form_configurable :token, type: :string
|
76
77
|
form_configurable :topic, type: :string
|
77
78
|
form_configurable :message, type: :string
|
78
79
|
form_configurable :title, type: :string
|
@@ -145,7 +146,13 @@ module Agents
|
|
145
146
|
def subscribe
|
146
147
|
|
147
148
|
uri = URI.parse("#{interpolated['server']}/#{interpolated['topic']}/json?since=10m&poll=1")
|
148
|
-
|
149
|
+
headers = {}
|
150
|
+
headers["Authorization"] = "Bearer #{interpolated['token']}" if interpolated['token'].present?
|
151
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
152
|
+
http.use_ssl = true if uri.scheme == 'https'
|
153
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
154
|
+
headers.each { |key, value| request[key] = value }
|
155
|
+
response = http.request(request)
|
149
156
|
|
150
157
|
log_curl_output(response.code,response.body)
|
151
158
|
|
@@ -177,7 +184,9 @@ module Agents
|
|
177
184
|
end
|
178
185
|
|
179
186
|
url = URI.parse(interpolated['server'])
|
180
|
-
|
187
|
+
headers = {}
|
188
|
+
headers["Authorization"] = "Bearer #{interpolated['token']}" if interpolated['token'].present?
|
189
|
+
response = HTTParty.post(url, body: data.to_json, headers: headers)
|
181
190
|
|
182
191
|
log_curl_output(response.code,response.body)
|
183
192
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_ntfy_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Germain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|