Commit Graph

91 Commits

Author SHA1 Message Date
bitfl0wer 98c842fd25
Match scheme for "ws" or "wss" and choose whether to connect with TLS connector for tungstenite 2024-08-26 12:53:32 +02:00
Flori 5bee907733
Prefer `&str` over `String` when possible (#553)
Prefer &str over String where possible.
2024-08-26 12:44:58 +02:00
kozabrada123 b9bc37fcd4 Readd Observer trait as reexport 2024-07-25 11:29:35 +02:00
bitfl0wer 491cd255de
Add one BILLION derives 2024-07-18 23:04:35 +02:00
bitfl0wer 7554f90187
Replace `Observer` and `GatewayEvent` with `pubserve` crate 2024-07-13 14:28:22 +02:00
Flori 484c69229d
No openssl (#522)
* Remove openssl from some packages' deps

* Add shorthand wasm build script

* Eliminate openssl dependency from crate

* Build RootCertStore from webpki roots instead of native roots

* Expand wasm documentation

* Revert reqwest

* Lock reqwest at 0.11.23

* Lock reqwest at 0.11.26, latest possible version

* Add wasm test script
2024-07-13 08:31:45 +02:00
kozabrada123 743f106ec6
Miscellaneous fixes (#514)
- fix `PATCH /users/@me` - It incorrectly returned a required password error, even if the current password was set
- fix `GET /users/@me/guilds` - It incorrectly sent body parameters instead of query ones
- don't log debug! for every successful ratelimited request - use trace! so it's less spamy
- update the max expected compression ratio (several times) from 20 to 200. let's hope that will be enough
- fix deserialization errors relating to guild folders in user settings
- fix a panic in `SqlxBitFlags` if there are extra flags. It now truncates them
- update `chorus_macros` to 0.4.1 (due to the above fix)
- log (trace!) event data if we fail to parse it or it's unrecognised, for debugging purposes
- fix a deserialization error in the `MessageACK` event
- fix `public_flags` in user objects not being `PublicFlags` bitflags
2024-06-28 14:05:59 +02:00
kozabrada123 89333d6353
Implement gateway options, zlib-stream compression (#508)
* feat: add GatewayOptions

* feat: implement zlib-stream compression

This also changes how gateway messages work.
Now each gateway backend converts its message into an
intermediary RawGatewayMessage, from which we inflate
and parse GatewayMessages.

Thanks to ByteAlex and their zlib-stream-rs crate, which
helped me understand how to parse a compressed websocket stream
2024-06-23 17:23:13 +02:00
kozabrada123 aac31726ec Reuse gateway backends, don't duplicate them for voice gateway (#493) 2024-04-30 16:17:47 +02:00
kozabrada123 b2fd3e18cc Move Shared<T> to types/mod.rs, bump some dependencies (#492)
* deps: bump rustls to 0.21.11

This is done to fix CVE-2024-32650, which practically shouldn't affect
us but it's still better not to use vulnerable dependencies.

* deps: bump h2 to 0.3.26

This is done to fix another vulnerability, which should also not affect
us (non-critical, in h2 servers)

* fix: move Shared<T> to types/mod.rs
2024-04-28 14:15:57 +02:00
kozabrada123 74d6785e50 Primitive voice implementation (feature/voice) (#457)
* Add Webrtc Identify & Ready

* Add more webrtc typings

* Attempt an untested voice gateway implementation

* fmt

* Merge with main

* Same allow as for voice as normal gateway

* Test error observer

* Minor updates

* More derives

* Even more derives

* Small types update

* e

* Minor doc fixes

* Modernise voice gateway

* Add default impl for voicegatewayerror

* Make voice event fields pub

* Event updates via the scientific method

* ??

* Fix bad request in voice gateway init

* Voice gateway updates

* Fix error failing to 'deserialize' properly

* Update voice identify

* Clarify FIXME related to #430

* Update to v7

* Create seperate voice_gateway.rs and voice_udp.rs

* Restructure voice to new module

* fix: deserialization error in speaking bitflags

* feat: kinda janky ip discovery impl

* feat: return ip discovery data + minor update

* feat: packet parsing!

* fix: voice works again

* feat: add voice_media_sink_wants

(comitting uncommited changes to merge)

* chore: rename events/webrtc to events/voice_gateway

* Add UdpHandle

* chore: clippy + other misc updates

* fix: attempt to fix failing wasm build

* chore: yes clippy, that is indeed an unneeded return statement

* feat: add VoiceData struct

* feat: add VoiceData reference to UdpHandler

* feat: decryption?

* chore: formatting

* feat: add ssrc definition (op 12)

* feat: add untested sending & asbtract nonce generation

* feat: Public api! (sorta)

* small updates

* feat: add sequence number

* chore: yes

* feat: merge VoiceHandler into official development

* chore: yes clippy, you are special

* fix: duplicated gateway events

* feat: first try at vgw wasm compat

* fix: blunder

* fix: gateway connect using wrong url

* fix: properly using encrypted data, bad practice for buffer creation

* chore: split voice udp

* feat: udp error handling, create udp/backends

* fix: its the same

* chore: clarify UDP on WASM

* api: split voice gateway and udp features, test for voice gateway in WASM

* feat: new encryption modes, minor code quality

* docs: document voice encryption modes

* chore: unused imports

* chore: update getrandom version to match wasm version

* chore: update on packet size FIXME

* drop buf asap

* Okay can't do that actually

* tests: add nonce test

* normal tests work?

* docs: fix doc warning, fix incorrect refrences to 'webrtc'

* chore: json isn't a doc test

* tests: better gateway auth test

* testing tests

* update voice heartbeat, fix the new test issue

* committed too much

* fix: unused import

* fix: use ip discovery address as string, not as Vec<u8>

* chore: less obnoxious logging

* chore: better unimplemented voice modes handling

* chore: remove unused variable

* chore: use matches macro

* add voice examples, make gateway ones clearer

* rename voice example

* chore: remove unused VoiceHandler

* fix: implement gateway Reconnect and InvalidSession

* Typo

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>

* Fix a bunch of typos

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>

* fix: error handling while loading native certs

* fix: guh

* use be for nonce bytes

* fix: refactor gw and vgw closures

* remove outdated docs

---------

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>
2024-04-16 17:18:21 +02:00
Flori 64feb91680 License change (#477) 2024-01-31 23:59:42 +01:00
Dirk Stolle c5bfac66e5 Fix a few typos (#471) 2024-01-31 22:27:53 +01:00
bitfl0wer b8ba92cf07 Include license header everywhere 2024-01-30 17:19:34 +01:00
bitfl0wer 196a36a5fe Write documentation for observe 2024-01-21 20:13:00 +01:00
bitfl0wer 48fddb7378 rustfmt 2024-01-21 17:07:30 +01:00
bitfl0wer 39b1f1fa72 Replace use of Arc<RwLock<T>> with Shared<T> 2024-01-21 17:07:19 +01:00
bitfl0wer 92654989e8 Define type alias `Shared` 2024-01-21 17:06:43 +01:00
kozabrada123 7a878d03ac Revert "Mess w/ the tests to see if it really works"
This reverts commit 7b975e3c95.
2024-01-19 16:05:34 +01:00
kozabrada123 7b975e3c95 Mess w/ the tests to see if it really works 2024-01-19 15:53:24 +01:00
kozabrada123 1f5a6e5266 feat: switch safina_timer for tokio, fix sleep duration overflow in examples 2024-01-19 15:48:59 +01:00
kozabrada123 f97f9dafe5 fix error 2024-01-19 15:06:27 +01:00
kozabrada123 77b3a42b1c feat: fix heartbeat time on WASM 2024-01-19 14:55:23 +01:00
bitfl0wer 022bf9f320 add wasm friendly task spawning 2023-11-22 14:23:36 +01:00
bitfl0wer f8979b7feb Remove 'handle', add wasm friendly task spawning 2023-11-22 14:23:33 +01:00
bitfl0wer e629334f3f Add FIXME comments for wasm compatibility 2023-11-21 17:10:19 +01:00
bitfl0wer 5bd4b627c5 Revert "Spawn local gateway task on wasm32"
This reverts commit 3c419e8310.
2023-11-20 15:14:34 +01:00
bitfl0wer 509733bfb8 Revert "Refactor heartbeat task to support WebAssembly"
This reverts commit 8c2364b8d0.
2023-11-20 15:14:28 +01:00
bitfl0wer 8c2364b8d0 Refactor heartbeat task to support WebAssembly 2023-11-20 14:57:45 +01:00
bitfl0wer 3c419e8310 Spawn local gateway task on wasm32 2023-11-20 14:47:13 +01:00
bitfl0wer 7956a0e3cb Fix build on wasm32 2023-11-20 00:07:16 +01:00
bitfl0wer 1203e20358 Implement wasm Backend 2023-11-19 22:23:24 +01:00
bitfl0wer 8f0d8813eb Better feature locking, add wasm.rs 2023-11-19 22:04:18 +01:00
bitfl0wer 73342d5dd7 reorganize files 2023-11-19 21:21:34 +01:00
bitfl0wer 6fd6bdcbbc Give tungstenite types distinct names 2023-11-19 21:15:10 +01:00
bitfl0wer b3e7876ccf feature lock backend_tungstenite 2023-11-19 19:18:25 +01:00
bitfl0wer a4d5ebb689 Resolve merge conflicts 2023-11-19 19:12:29 +01:00
bitfl0wer 79e70c43a2 Merge branch 'websockets-backend' into feature/wasm32-unknown 2023-11-19 18:35:35 +01:00
bitfl0wer 0e16e55d64 Fix references to heartbeat_thread_communicator 2023-11-19 18:27:49 +01:00
Vincent Junge 5bd8f32a6a remove superfluous return 2023-11-19 17:47:48 +01:00
Vincent Junge c0ce540da6 for got unwrap :3 2023-11-19 17:18:08 +01:00
Vincent Junge dd9945068f removed leftover type aliases 2023-11-19 17:15:00 +01:00
Vincent Junge 0f446f43b4 removed outdated comment 2023-11-19 17:13:52 +01:00
Vincent Junge 4f207d55d9 prepare for platform-dependant websockets backend 2023-11-19 17:08:53 +01:00
bitfl0wer 19f8403bcf Make HBHandler<T,S> struct instead of trait
Make HeartbeatHandler a generic struct instead of a struct with a trait.
Reduces redundant code
2023-11-19 17:07:08 +01:00
bitfl0wer 70812c529a Move Heartbeathandler code together 2023-11-19 16:44:38 +01:00
bitfl0wer f4ae80fee9 temp: impl heartbeathandlercapable 2023-11-19 16:43:21 +01:00
bitfl0wer b3ebdd69fc Add TODO comment 2023-11-19 16:42:48 +01:00
bitfl0wer 50cd93aae1 Add kill send to WasmGateway 2023-11-19 16:42:05 +01:00
bitfl0wer 926a9fc90e TEMP: Compile wasm dependencies&code per default
TODO: Check todos before merging into dev
2023-11-19 12:52:11 +01:00