diaspora_federation 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55951778511742a4269e05b406ef43ca976410c07e91364896138e3df1cf7019
4
- data.tar.gz: 3fed9b6d22ec275798e45a1df2c593835d1750fdac9c68158192a06640b4bcb5
3
+ metadata.gz: 126bd285db912266d404ee6db4fb7016291438fee3089341f60a257e64386ad6
4
+ data.tar.gz: 4e6301e3937258f34771d6a373618f0f24ebe230d7f9004bd2173f00b653ab30
5
5
  SHA512:
6
- metadata.gz: 33b62f247e32f32874930b71f907540ae7f0dbf88182d1bd8e5a4c4590dd21eee9c2f9b691d54ed96d5688b9eca5c7523780fbd1b1a89ad7e2ae4ad9ca77c371
7
- data.tar.gz: 581f0595fbd988aa146aea231bf80c2f81063c0719c671a83f685b162364922941bc8f68bd55b9a22385f520e0f7e162c66f71802e99703ccd54f03426d79731
6
+ metadata.gz: bf115ea37e268d101a94b1df2fcab533f147a238861813742800aa77edf287a8b23e6a2473344817e203374af884f2fc81ed470a0fab91d6b40891d8d58f9c29
7
+ data.tar.gz: 25749275957489227c092294b25c8d04809a4d79f42512f09941b0881dd9193eb94fe7716c292416c5e40bd7695dab835297e139bf243bfb535c81ac27413c7c
data/Changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.1.0
2
+
3
+ * Don't follow redirects when federating messages [#128](https://github.com/diaspora/diaspora_federation/pull/128)
4
+
5
+ # 1.0.1
6
+
7
+ * Disable rails forgery protection for the federation controller by default [#127](https://github.com/diaspora/diaspora_federation/pull/127)
8
+
1
9
  # 1.0.0
2
10
 
3
11
  * Add rails 7 support [#126](https://github.com/diaspora/diaspora_federation/pull/126)
@@ -15,8 +15,7 @@ module DiasporaFederation
15
15
  # @return [Hash] hydra opts
16
16
  def self.hydra_opts
17
17
  @hydra_opts ||= {
18
- followlocation: true,
19
- maxredirs: DiasporaFederation.http_redirect_limit,
18
+ followlocation: false,
20
19
  timeout: DiasporaFederation.http_timeout,
21
20
  method: :post,
22
21
  verbose: DiasporaFederation.http_verbose,
@@ -90,10 +89,10 @@ module DiasporaFederation
90
89
  # @param [Typhoeus::Request] request
91
90
  def prepare_request(request)
92
91
  request.on_complete do |response|
93
- success = validate_response_and_update_pod(request, response)
94
- log_line = "success=#{success} sender=#{@sender_id} obj=#{@obj_str} url=#{response.effective_url} " \
92
+ DiasporaFederation.callbacks.trigger(:update_pod, request.url, status_from_response(response))
93
+ log_line = "success=#{response.success?} sender=#{@sender_id} obj=#{@obj_str} url=#{request.url} " \
95
94
  "message=#{response.return_code} code=#{response.response_code} time=#{response.total_time}"
96
- if success
95
+ if response.success?
97
96
  logger.info(log_line)
98
97
  else
99
98
  logger.warn(log_line)
@@ -103,18 +102,6 @@ module DiasporaFederation
103
102
  end
104
103
  end
105
104
 
106
- def validate_response_and_update_pod(request, response)
107
- url = URI.parse(request.url)
108
- effective_url = URI.parse(response.effective_url)
109
- same_host = url.host == effective_url.host
110
-
111
- (response.success? && same_host).tap do |success|
112
- pod_url = (success ? effective_url : url).tap {|uri| uri.path = "/" }.to_s
113
- status = same_host ? status_from_response(response) : :redirected_to_other_hostname
114
- DiasporaFederation.callbacks.trigger(:update_pod, pod_url, status)
115
- end
116
- end
117
-
118
105
  def status_from_response(response)
119
106
  response.return_code == :ok ? response.response_code : response.return_code
120
107
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module DiasporaFederation
4
4
  # the gem version
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diaspora_federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Neff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-18 00:00:00.000000000 Z
11
+ date: 2023-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 3.3.7
223
+ rubygems_version: 3.4.10
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: diaspora* federation library