onyxcord 2.0.6 → 2.0.8

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: c794e2e7f5ad51dea52e27c049fb7d08fb7b54c84b452243fe549cd54f46dd5d
4
- data.tar.gz: 2f7e1a9df9cf56085e31dd7bc13e843f8c5bee2e9083817305e6936117c92dd4
3
+ metadata.gz: de906b93116b1c325312db44d7373011c24b4ea6807cea759112af2846a9449a
4
+ data.tar.gz: 3be86bc11a833fd3cb8b88874837d2cc732c916a4b6f4afbad340f1573531f89
5
5
  SHA512:
6
- metadata.gz: dce8555d60a8bf6662bfc357c64918e75ff803ab30c43c93dab390756ee52e0057f20914367ec4cce89e5a6906c0745f99b89f42953bb9b91648caa3fe296378
7
- data.tar.gz: 7b25cd2d344182abbdce7fb5f74f8cffb7dea3ad478d6a03e9018ea138635fac13e9203184f656f677c39b85b26f1a8287f24ac6a855b5b9ae64ec12165e8c72
6
+ metadata.gz: b7c429540a55956bb417841e610d9e8da946d18c4565c3177a45cb2ec4ba885988e02fade2c910edff015aee77970709198d450ba5719faa1862a182ab3507fb
7
+ data.tar.gz: 8159656f82928ec348522857df842cfe27479c6ba147e090778ac26749533f7d0c32c80390b61df6e4b15ef485fa2e6dcb886355650cc2cb1f2598759f694da9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.8 - 2026-06-28
4
+
5
+ ### Correcoes de gateway
6
+
7
+ - Forca WebSocket do Gateway e do cliente generico em HTTP/1.1 para evitar `Async::WebSocket::ConnectionError: Failed to negotiate connection!` ao conectar no Discord.
8
+ - Desativa extensoes WebSocket no handshake para evitar close `Error while decoding payload` no Gateway do Discord.
9
+ - Remove o empacotamento separado `onyxcord-webhooks`; webhooks continuam incluidos diretamente na gem `onyxcord`.
10
+
3
11
  ## 2.0.6 - 2026-06-28
4
12
 
5
13
  ### Correcoes de empacotamento
@@ -64,7 +72,7 @@ bot.sync_application_commands!(server_id: ENV.fetch('DISCORD_SERVER_ID'))
64
72
  - **Gateway via Async-WebSocket**: Substituída a implementação de raw TCP sockets + `websocket-client-simple` por `async-websocket`, proporcionando um event loop de gateway extremamente rápido e escalável.
65
73
  - **Parse JSON via Oj**: A gem `oj` foi integrada em modo de compatibilidade (`mode: :compat`), acelerando transparentemente todas as serializações e deserializações de pacotes do Discord na lib inteira.
66
74
  - **Cache Inteligente LRU**: Os caches em memória (usuários, canais, servidores, membros) agora utilizam `LruRedux::ThreadSafeCache`. Os tamanhos padrão foram aumentados (`users: 50_000`, `channels: 10_000`, `servers: 1_000`, `members: 100_000`) e podem ser customizados via `OnyxCord.configure { |c| c.cache_sizes.users = 100_000 }`.
67
- - **Fusão do Webhooks**: A funcionalidade da gem separada `onyxcord-webhooks` foi integrada diretamente no núcleo da gem `onyxcord`. A gem `onyxcord-webhooks` agora atua apenas como um shim de transição deprecado.
75
+ - **Fusão do Webhooks**: A funcionalidade da gem separada `onyxcord-webhooks` foi integrada diretamente no núcleo da gem `onyxcord`; nao ha mais pacote separado para publicar.
68
76
  - **Alvo Ruby ≥ 3.4**: Atualizada a versão mínima requerida do Ruby para aproveitar as otimizações modernas do interpretador e fibras.
69
77
 
70
78
  ## 1.1.8 - 2026-06-28
@@ -81,7 +89,6 @@ bot.sync_application_commands!(server_id: ENV.fetch('DISCORD_SERVER_ID'))
81
89
  - `ruby -c lib/onyxcord/data/component.rb`: sucesso.
82
90
  - `ruby -c spec/components_v2_spec.rb`: sucesso.
83
91
  - `gem build onyxcord.gemspec`: sucesso.
84
- - `gem build onyxcord-webhooks.gemspec`: sucesso.
85
92
 
86
93
  ## 1.1.7 - 2026-06-28
87
94
 
@@ -93,7 +100,6 @@ bot.sync_application_commands!(server_id: ENV.fetch('DISCORD_SERVER_ID'))
93
100
  ### Validacao
94
101
 
95
102
  - `ruby -c onyxcord.gemspec`: sucesso.
96
- - `ruby -c onyxcord-webhooks.gemspec`: sucesso.
97
103
 
98
104
  ## 1.1.6 - 2026-06-28
99
105
 
data/Rakefile CHANGED
@@ -6,12 +6,8 @@ namespace :main do
6
6
  Bundler::GemHelper.install_tasks(name: 'onyxcord')
7
7
  end
8
8
 
9
- namespace :webhooks do
10
- Bundler::GemHelper.install_tasks(name: 'onyxcord-webhooks')
11
- end
12
-
13
- task build: %i[main:build webhooks:build]
14
- task release: %i[main:release webhooks:release]
9
+ task build: :'main:build'
10
+ task release: :'main:release'
15
11
 
16
12
  # Make "build" the default task
17
13
  task default: :build
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'async'
4
4
  require 'async/http/endpoint'
5
+ require 'async/http/protocol/http11'
5
6
  require 'async/websocket/client'
6
7
  require 'onyxcord/async/runtime'
7
8
  require 'onyxcord/rate_limiter/gateway'
@@ -293,9 +294,9 @@ module OnyxCord
293
294
  @pipe_broken = false
294
295
  @closed = false
295
296
 
296
- endpoint = Async::HTTP::Endpoint.parse(url)
297
+ endpoint = websocket_endpoint(url)
297
298
 
298
- Async::WebSocket::Client.connect(endpoint) do |connection|
299
+ Async::WebSocket::Client.connect(endpoint, extensions: nil) do |connection|
299
300
  @connection = connection
300
301
  LOGGER.debug('WebSocket connected')
301
302
 
@@ -313,6 +314,14 @@ module OnyxCord
313
314
  @connection = nil
314
315
  end
315
316
 
317
+ def websocket_endpoint(url)
318
+ Async::HTTP::Endpoint.parse(
319
+ url,
320
+ protocol: Async::HTTP::Protocol::HTTP11,
321
+ alpn_protocols: ['http/1.1']
322
+ )
323
+ end
324
+
316
325
  def handle_open; end
317
326
 
318
327
  def handle_error(e)
@@ -453,7 +462,7 @@ module OnyxCord
453
462
 
454
463
  @send_limiter.wait
455
464
 
456
- @connection.write(Protocol::WebSocket::TextMessage.generate(data))
465
+ @connection.write(data)
457
466
  @connection.flush
458
467
  rescue StandardError => e
459
468
  @pipe_broken = true
@@ -3,5 +3,5 @@
3
3
  # OnyxCord and all its functionality, in this case only the version.
4
4
  module OnyxCord
5
5
  # The current version of onyxcord.
6
- VERSION = '2.0.6'
6
+ VERSION = '2.0.8'
7
7
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Webhook support for onyxcord
3
+ # Webhook support bundled in onyxcord.
4
4
  module OnyxCord
5
5
  module Webhooks
6
- # The current version of onyxcord-webhooks.
7
- VERSION = '2.0.6'
6
+ # Kept for compatibility with code that checks the webhooks module version.
7
+ VERSION = '2.0.8'
8
8
  end
9
9
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'onyxcord/async/runtime'
4
4
  require 'async/http/endpoint'
5
+ require 'async/http/protocol/http11'
5
6
  require 'async/websocket/client'
6
7
 
7
8
  module OnyxCord
@@ -43,10 +44,10 @@ module OnyxCord
43
44
  private
44
45
 
45
46
  def connect
46
- endpoint = Async::HTTP::Endpoint.parse(@host)
47
+ endpoint = websocket_endpoint(@host)
47
48
 
48
49
  @task = OnyxCord::AsyncRuntime.async do
49
- Async::WebSocket::Client.connect(endpoint) do |connection|
50
+ Async::WebSocket::Client.connect(endpoint, extensions: nil) do |connection|
50
51
  @connection = connection
51
52
  @connected = true
52
53
  @open_handler&.call
@@ -64,5 +65,13 @@ module OnyxCord
64
65
  rescue StandardError => e
65
66
  @error_handler&.call(e)
66
67
  end
68
+
69
+ def websocket_endpoint(url)
70
+ Async::HTTP::Endpoint.parse(
71
+ url,
72
+ protocol: Async::HTTP::Protocol::HTTP11,
73
+ alpn_protocols: ['http/1.1']
74
+ )
75
+ end
67
76
  end
68
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onyxcord
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Silva
@@ -506,7 +506,6 @@ files:
506
506
  - lib/onyxcord/webhooks/version.rb
507
507
  - lib/onyxcord/webhooks/view.rb
508
508
  - lib/onyxcord/websocket.rb
509
- - onyxcord-webhooks.gemspec
510
509
  - onyxcord.gemspec
511
510
  homepage: https://github.com/kruldevb/OnyxCord
512
511
  licenses:
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/onyxcord/webhooks/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'onyxcord-webhooks'
7
- spec.version = OnyxCord::Webhooks::VERSION
8
- spec.authors = ['Gustavo Silva']
9
- spec.email = ['gustavosilva8kt@gmail.com']
10
-
11
- spec.summary = '[DEPRECATED] Webhook client for onyxcord — now bundled into the onyxcord gem'
12
- spec.description = "This gem is deprecated. Webhooks are now included in the onyxcord gem. Install 'onyxcord' instead."
13
- spec.homepage = 'https://github.com/kruldevb/OnyxCord'
14
- spec.license = 'MIT'
15
-
16
- spec.files = ['lib/onyxcord/webhooks.rb', 'lib/onyxcord/webhooks/version.rb']
17
- spec.bindir = 'exe'
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ['lib']
20
-
21
- # This gem now simply depends on the main onyxcord gem
22
- spec.add_dependency 'onyxcord', "~> #{OnyxCord::Webhooks::VERSION}"
23
-
24
- spec.required_ruby_version = '>= 3.4'
25
- spec.metadata = {
26
- 'bug_tracker_uri' => 'https://github.com/kruldevb/OnyxCord/issues',
27
- 'documentation_uri' => 'https://github.com/kruldevb/OnyxCord#readme',
28
- 'source_code_uri' => 'https://github.com/kruldevb/OnyxCord',
29
- 'rubygems_mfa_required' => 'true'
30
- }
31
-
32
- spec.post_install_message = <<~MSG
33
- ⚠️ onyxcord-webhooks is DEPRECATED.
34
- Webhooks are now bundled into the 'onyxcord' gem.
35
- Please update your Gemfile:
36
- gem 'onyxcord', '~> 2.0'
37
- and remove 'onyxcord-webhooks'.
38
- MSG
39
- end