huginn_mastodon_publish_agent 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c475df82b48cabc746a3e19aac8494f2f811f41e26c22e8bdf55c28fa24ea5c3
4
- data.tar.gz: 1562b2eaaa9cb6559a6619e82faef68204359b43056966f27ac449f0f8815c34
3
+ metadata.gz: 21d996010d2d2783d644ef215563408702a3417d7dad9cb0d251fe5cfc20bf18
4
+ data.tar.gz: 42cf4e36fc401ab9ea9c479f764a8e4871ceabbc96a31a45f8257db09e6261f9
5
5
  SHA512:
6
- metadata.gz: 78bff76a459732a26211ba3cb92b8c6462448d4376484d5b2772320b9cacac85d299201c18cfce784d3ed281e45b31e7db4eb71336da3601512e828e72841114
7
- data.tar.gz: f27fc9a849f9d76073f6bd562e2474114538d2b32daa48b7ea956ebdb20921045374816e0d3ae3aed6d595cd9091da251faadb9a96727293d20af4a057c2f7f2
6
+ metadata.gz: fac95f353502e456bf10e44f1579b7388a0f8aa0450a2d2caca9c635f01490cd36a9840d311ff428645a7ba73e1cf51694c6bb664a52e069c16b8433e01e31ea
7
+ data.tar.gz: 0a025df223f9b2dcdfa80f6001d56a0aa983579cb0f7ac46df9336c1bfd115f2b224f543ace18681dc3def17dedfc1868aa48e32528f20c894578031effb2f3b
@@ -13,6 +13,8 @@ module Agents
13
13
  You must also specify a `status` parameter, you can use [Liquid](https://github.com/huginn/huginn/wiki/Formatting-Events-using-Liquid) to format the status.
14
14
  Additional parameters can be passed via `parameters`.
15
15
 
16
+ Set `server` to send to the right server.
17
+
16
18
  Set `expected_update_period_in_days` to the maximum amount of time that you'd expect to pass between Events being created by this Agent.
17
19
 
18
20
  If `output_mode` is set to `merge`, the emitted Event will be merged into the original contents of the received Event.
@@ -83,6 +85,7 @@ module Agents
83
85
  def default_options
84
86
  {
85
87
  'status' => '',
88
+ 'server' => '',
86
89
  'access_token' => '',
87
90
  'debug' => 'false',
88
91
  'emit_events' => 'false',
@@ -92,6 +95,7 @@ module Agents
92
95
 
93
96
  form_configurable :access_token, type: :string
94
97
  form_configurable :status, type: :string
98
+ form_configurable :server, type: :string
95
99
  form_configurable :debug, type: :boolean
96
100
  form_configurable :emit_events, type: :boolean
97
101
  form_configurable :expected_receive_period_in_days, type: :string
@@ -101,6 +105,10 @@ module Agents
101
105
  errors.add(:base, "access_token is a required field")
102
106
  end
103
107
 
108
+ unless options['server'].present?
109
+ errors.add(:base, "server is a required field")
110
+ end
111
+
104
112
  unless options['status'].present?
105
113
  errors.add(:base, "status is a required field")
106
114
  end
@@ -139,7 +147,7 @@ module Agents
139
147
 
140
148
  def publish
141
149
 
142
- uri = URI.parse("https://mastodon.social/api/v1/statuses")
150
+ uri = URI.parse("https://#{interpolated['server']}/api/v1/statuses")
143
151
  request = Net::HTTP::Post.new(uri)
144
152
  request.set_form_data(
145
153
  "status" => "#{interpolated['status']}",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huginn_mastodon_publish_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Germain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-30 00:00:00.000000000 Z
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler