Commit Graph

787 Commits

Author SHA1 Message Date
Flori 10dd34a82d
Delete clippy.yml 2023-07-17 12:36:45 +02:00
Flori 099153a4ed
Create rust-clippy.yml 2023-07-17 12:36:33 +02:00
Flori bfdf21f57f
Enable saving and loading LimitsConfiguration (#152)
Impl Serialize, Deserialize for LimitsConfiguration and children
2023-07-14 17:38:54 +02:00
kozabrada123 f705783822
Revert actions build back to debug (#151)
Cargo build --release is faster for builds, but test uses debug built libraries, so it rebuilds them
2023-07-14 12:12:39 +02:00
kozabrada123 a28a1bce03
Faster actions hopefully (#150) 2023-07-14 11:58:12 +02:00
SpecificProtagonist 05d51bd0bc
Deduplicate gateway dispatch event handling (#148)
deduplicate gateway dispatch event handling
2023-07-11 20:11:13 +02:00
Zert3x d5979e0024
Async Observer Trait (#147) 2023-07-11 19:20:27 +02:00
Flori 8c9ccdd997
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
kozabrada123 08ea9e2dfb
Merge pull request #143 from polyphony-chat/feature/use-log
Use log instead of prints
2023-07-01 17:44:44 +00:00
kozabrada123 ce359103da Use log instead of prints 2023-07-01 19:29:50 +02:00
Flori 028c7701a7
Merge pull request #137 from SpecificProtagonist/server-side-validation
Remove some client-side validation
2023-06-27 00:05:52 +02:00
Vincent Junge 2e9d4caee5
require password to log in 2023-06-25 22:34:05 +02:00
Vincent Junge 9ccc08b5e2
remove client side validation 2023-06-25 11:36:37 +02:00
kozabrada123 4316c04209
Merge pull request #136 from SpecificProtagonist/tokio-features
Correct tokio features
2023-06-24 08:23:07 +00:00
Vincent Junge 1b1aa564d2
fixed tokio features 2023-06-24 08:52:45 +02:00
Flori dbf4f634b4
Merge pull request #134 from polyphony-chat/bug/reactionsget-returns-generic-successfailure
Make ReactionMeta::get() return a Vec<PublicUser>
2023-06-23 13:34:05 +02:00
Flori Weber 1085cbb462
cargo fix 2023-06-23 12:54:15 +02:00
Flori Weber 70aaa238e3
Make ReactionMeta::get() return Vec<PublicUser> 2023-06-23 12:54:08 +02:00
Flori Weber f6d6daf1d2
Fix stupid multi line comments 2023-06-23 12:18:22 +02:00
Flori fe0c09b0e9
Merge pull request #130 from polyphony-chat/refactor/change-channel-modify
Refactor/change channel modify
2023-06-22 20:05:15 +02:00
Flori Weber 0aac291a3c
Remove wrongful match statement 2023-06-22 19:54:39 +02:00
Flori 55943bcf9a
Merge pull request #128 from SpecificProtagonist/deep_winter
Always use Snowflakes in args
2023-06-22 19:44:15 +02:00
Flori f554244143
Update src/api/channels/channels.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-06-22 19:42:07 +02:00
Flori Weber 1e0783e30e
Make Channel::modify() take &mut self 2023-06-22 18:56:16 +02:00
Flori Weber 4b31fb4ec7
Reflect changes to Channel::modify() in test 2023-06-22 18:55:26 +02:00
Vincent Junge f2709492de
always use Snowflakes in args 2023-06-22 18:55:19 +02:00
Flori 40edc2c7fe
Merge pull request #125 from SpecificProtagonist/result
ChorusResult type alias
2023-06-21 21:45:39 +02:00
Vincent Junge 4117bcff59
ChorusResult type alias 2023-06-21 21:39:22 +02:00
Flori 60c8150c2b
Merge pull request #126 from SpecificProtagonist/get-channel-messages
Get channel messages
2023-06-21 21:19:37 +02:00
Vincent Junge 8d7e49f3c2
get channel messages 2023-06-21 14:46:45 +02:00
Flori da9ba9761d
Merge pull request #123 from polyphony-chat/refactor/reuse-reqwest-client
Refactor/reuse reqwest client
2023-06-21 09:50:25 +02:00
Flori Weber e7eee4808e
Change send_request() calls to pass &mut Instance 2023-06-20 22:42:42 +02:00
Flori Weber 2233063d5f
Use Instance.client instead of creating a new one. 2023-06-20 22:42:08 +02:00
Flori Weber 27047ab909
Add reqwest::Client to chorus::Instance. 2023-06-20 22:41:31 +02:00
Flori Weber 3958f049ea
Change to single-line docstring 2023-06-20 22:36:39 +02:00
Flori Weber 0a523d54c1
Multiline docstring to single line docstring 2023-06-20 22:30:42 +02:00
Flori Weber 1fc38b25bf
Merge branch 'main' into refactor/reuse-reqwest-client 2023-06-20 22:21:08 +02:00
Flori Weber 915c9be4ad
Change docstring from multi- to singleline 2023-06-20 22:20:06 +02:00
Flori 6e50292f71
Merge pull request #122 from SpecificProtagonist/winter
More consistent use of snowflakes
2023-06-20 22:16:54 +02:00
Vincent Junge 9429bd7772
more consistent use of snowflakes 2023-06-20 22:03:29 +02:00
Flori 9725b165dd
Merge pull request #121 from polyphony-chat/fix/cannot-connect-to-discord
Remove unnecessary things
2023-06-20 21:54:53 +02:00
Flori 304cb6076a
Merge pull request #114 from SpecificProtagonist/snowflake
Simplify Snowflake
2023-06-20 18:57:25 +02:00
Flori dcacfacda9
Merge pull request #117 from SpecificProtagonist/gateway-event
Simplify GatewayEvent
2023-06-20 18:57:13 +02:00
Flori efd3a54c17
Merge pull request #119 from polyphony-chat/change/use-result-instead-of-option-err
Change Option<ChorusLibError> to Result<(), ChorusLibError>
2023-06-20 18:56:49 +02:00
kozabrada123 f2d3aa62e2 Update in tests too 2023-06-20 18:33:37 +02:00
kozabrada123 b8d7030ab1 Change Option<ChorusLibError> to Result<(), ChorusLibError> 2023-06-20 18:26:30 +02:00
Vincent Junge 04c3ee56e9
simplify GatewayEvent 2023-06-20 16:12:13 +02:00
Flori cafdc287d6
Merge pull request #115 from SpecificProtagonist/urlbundle
UrlBundle remove getters
2023-06-20 12:45:55 +02:00
Vincent Junge f614e93892
UrlBundle remove getters 2023-06-20 12:29:52 +02:00
Vincent Junge 29fcdfe641
simplyfy Snowflake 2023-06-20 12:21:22 +02:00