Commit Graph

93 Commits

Author SHA1 Message Date
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
kozabrada123 9304af2594 Ignore unused imports for pub use (#484) 2024-03-15 17:08:46 +01:00
kozabrada123 2d72442522 Minor docs updates, add Get Private Channels (#483)
* feat: add get_private_channels

* minor docs update and reorder
2024-03-15 16:13:51 +01:00
bitfl0wer b8ba92cf07 Include license header everywhere 2024-01-30 17:19:34 +01:00
kozabrada123 0dfd622661 Fix failing build w/o client and move ratelimits (#426)
* Fix failing build without client feature

* Feature lock Updateable and Composite
2023-08-30 15:26:19 +02:00
bitfl0wer 4bbb22eb31 Replace `belongs_to: Rc<RefCell<Instance>>` with `Arc<RwLock<Instance>>` to make `ChorusUser` `Send` 2023-08-28 18:12:17 +02:00
bitfl0wer ea66edc68d Fix guild ban test failing 2023-08-26 17:45:27 +02:00
bitfl0wer aee50036a0 Add delete_role + test 2023-08-26 16:54:24 +02:00
bitfl0wer 116f1312e7 Disambiguate function name 2023-08-26 16:22:18 +02:00
bitfl0wer 1709e85a4b Add delete_guild_ban 2023-08-25 17:28:02 +02:00
bitfl0wer 07ebaf6119 Add Get Guild Ban/s, add audit_log_reason to create_ban 2023-08-25 17:26:01 +02:00
bitfl0wer cd70a5b388 Add modify guild member profile route 2023-08-25 17:11:00 +02:00
bitfl0wer cce5b507bc Add modify_current_member route 2023-08-25 16:54:41 +02:00
bitfl0wer 7b55590fd0 Add modify_member route 2023-08-25 16:47:28 +02:00
bitfl0wer 516a1467fa Add some more routes 2023-08-25 01:35:57 +02:00
bitfl0wer 2b69aba2ca Merge branch 'main' into guild-routes 2023-08-25 01:11:28 +02:00
bitfl0wer d73c1963fc Start refactoring ChorusRequest to ChorusRequest::new() 2023-08-25 00:02:26 +02:00
bitfl0wer e9318ea4dc start adding auditlogreason to routes that take it 2023-08-24 22:30:13 +02:00
bitfl0wer eb163d278a Change UserMeta to ChorusUser 2023-08-24 21:46:02 +02:00
bitfl0wer facb91fc20 Merge branch 'main' into guild-routes 2023-08-24 21:41:22 +02:00
bitfl0wer fb7e33c0ec Change `UserMeta` to `ChorusUser` 2023-08-24 21:06:28 +02:00
bitfl0wer 5ed2f0f2c3 add get guild preview route 2023-08-24 21:05:39 +02:00
bitfl0wer a13f766758 Add search() and search_messages() 2023-08-22 14:00:39 +02:00
bitfl0wer 7eee08459b Add Guild::modify(); 2023-08-20 23:13:34 +02:00
bitfl0wer cb216c462d Add create_ban
Closes "Create Guild Ban #299"
2023-08-20 18:49:10 +02:00
kozabrada123 905b7af618 Add content type specification 2023-08-18 11:41:06 +02:00
bitfl0wer 0396e318d3 Change bearer_auth to header("Authorization" 2023-08-17 22:26:07 +02:00
bitfl0wer 116c829f28 Rename update to modify 2023-08-16 14:05:51 +02:00
kozabrada123 e0d7df417c Fix trailing /s (#180) 2023-08-12 16:48:33 +02:00
kozabrada123 c0bc2ee9e2 Fix missing references to the best of my ability 2023-07-31 10:28:18 +02:00
kozabrada123 60393a5686 Docs 2023-07-31 10:01:25 +02:00
kozabrada123 1ce9bf08cd Guilds + Channels 2023-07-30 09:04:31 +02:00
kozabrada123 83d4ffc4e8 Moar docs 2023-07-29 10:23:04 +02:00
kozabrada123 8eb2e2008c Remove the todos from the last commit 2023-07-28 18:57:35 +02:00
kozabrada123 d0547cb1f0 Better docs 2023-07-28 18:45:40 +02:00
kozabrada123 18ac7b5708 Rustdoc warnings + misc changes 2023-07-10 18:06:45 +02:00
Flori 69b7c2445c Ratelimiter overhaul (#144)
* Rename limits and limit to have better names

* Remove empty lines

* Remove handle_request (moved to requestlimiter)

* Start working on new ratelimiter

* Make limits Option, add "limited?" to constructor

* Add missing logic to send_request

* Rename Limits

* Create Ratelimits and Limit Struct

* Define Limit

* Import Ratelimits

* Define get_rate_limits

* Remove unused import

* + check_rate_limits & limits_config_to_ratelimits

* Remove Absolute Limits
These limits are not meant to be tracked anyways.

* add ratelimits is_exhausted

* Add error handling and send request checking

* change limits to option ratelimits

* Add strum

* Change Ratelimits to Hashmap

* Remove ratelimits in favor of hashmap

* Change code from struct to hashmap

* start working on update rate limits

* Remove wrong import

* Rename ChorusLibError to ChorusError

* Documented the chorus errors

* Made error documentation docstring

* Make ReceivedErrorCodeError have error string

* Remove unneeded import

* Match changes in errors.rs

* Improve update_rate_limits and can_send_request

* add ratelimits.to_hash_map()

* use instances' client instead of new client

* add LimitsConfiguration to instance

* improve update_limits, change a method name

* Fix un-updated errors

* Get LimitConfiguration in a sane way

* Move common.rs into ratelimiter::ChorusRequest

* Delete common.rs

* Make instance.rs use overhauled errors

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* update ratelimiter implementation across all files

* Fix remaining errors post-refactor

* Changed Enum case to be correct

* Use result

* Re-add missing body to request

* Remove unneeded late initalization

* Change visibility from pub to pub(crate)
I feel like these core methods don't need to be exposed as public API.

* Remove unnecessary import

* Fix clippy warnings

* Add docstring

* Change Error names across all files

* Update Cargo.toml

Strum is not needed

* Update ratelimits.rs

* Update ratelimits.rs

* Bug/discord instance info unavailable (#146)

* Change text to be more ambigous

* Use default Configuration instead of erroring out

* Emit warning log if instance config cant be gotten

* Remove import

* Update src/instance.rs

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>

* Add missing closing bracket

* Put limits and limits_configuration as one struct

* Derive Hash

* remove import

* rename limits and limits_configuration

* Save clone call

* Change LimitsConfiguration to RateLimits
`LimitsConfiguration` is in no way related to whether the instance has API rate limits enabled or not. Therefore, it has been replaced with what it should have been all along.

* Add ensure_limit_in_map(), add `window` to `Limit`

* Remove unneeded var

* Remove import

* Clean up unneeded things
Dead code warnings have been supressed, but flagged as FIXME so they don't get forgotten. Anyone using tools like TODO Tree in VSCode can still see that they are there, however, they will not be shown as warnings anymore

* Remove nested submodule `limit`

* Add doc comments

* Add more doc comments

* Add some log messages to some methods

---------

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-09 18:38:02 +02:00
Vincent Junge d52acd9093 always use Snowflakes in args 2023-06-22 18:55:19 +02:00
Vincent Junge f98180cd03 ChorusResult type alias 2023-06-21 21:39:22 +02:00
Flori Weber 62f6bfa363 Change send_request() calls to pass &mut Instance 2023-06-20 22:42:42 +02:00
kozabrada123 cd98de286f Change Option<ChorusLibError> to Result<(), ChorusLibError> 2023-06-20 18:26:30 +02:00
Vincent Junge 9c7031abde UrlBundle remove getters 2023-06-20 12:29:52 +02:00
Flori Weber ec3a531f48 apply clippy suggestions 2023-06-19 19:01:18 +02:00
Vincent Junge c06778fc71 Fix clippy::await_holding_refcell_ref false positives 2023-06-19 16:46:58 +02:00
bitfl0wer 7a3524a1ab run cargo fix 2023-06-12 18:59:06 +02:00
bitfl0wer 9bbe9fc470 run cargo fix 2023-06-12 18:58:53 +02:00
bitfl0wer 44224cb478 Refactor limited requester
The requester does not need to be instantiated anymore, which makes things easier to read imo.
2023-06-12 18:51:54 +02:00
Flori Weber 6db823cb48 Refactor roles.rs to use api::common 2023-06-11 20:04:40 +02:00
Flori Weber 893d1be98a Refactor member.rs to use api::common 2023-06-11 19:30:15 +02:00
Flori Weber d10f268ae5 Refactor guilds.rs to use api:common 2023-06-11 19:26:34 +02:00