Commit Graph

1503 Commits

Author SHA1 Message Date
bitfl0wer ac8352e968
Merge branch 'pr/xystrive/521-1' into mfa 2024-07-26 23:50:40 +02:00
Flori 274b9ab0ca
More accurate "GatewayHello::default()" (#534)
Replaces the derived `std::default::Default` with

```rs
impl std::default::Default for GatewayHello {
    fn default() -> Self {
        Self {
            // "HELLO" opcode is 10
            op: 10,
            d: Default::default(),
        }
    }
}

impl std::default::Default for HelloData {
    fn default() -> Self {
        Self {
            // Discord docs mention 45000 seconds - discord.sex mentions 41250. Defaulting to 45s
            heartbeat_interval: 45000,
        }
    }
}
```
2024-07-26 23:37:28 +02:00
bitfl0wer d4f6a7e98a
More accurate "GatewayHello::default()" 2024-07-26 23:28:23 +02:00
Flori 537b0253bb
Theme colors patch (#533)
Related to #523, changes `theme_colors` property on `User` and
`PublicUser` to be of type `(u32, u32)`
2024-07-26 17:48:40 +02:00
bitfl0wer 9dbb5ea77b
impl sqlx::Type for ThemeColors 2024-07-26 17:40:42 +02:00
bitfl0wer ffcf15d058
Custom ThemeColors type with sqlx::Encode and sqlx::Decode impls 2024-07-26 17:30:43 +02:00
bitfl0wer 111a8c42f5
change theme_colors from Vec<u32> to (u32, u32) 2024-07-26 14:54:55 +02:00
kozabrada123 4292ab88e9
Fix #525 (pr #532) 2024-07-26 10:02:11 +02:00
xystrive d188fe49b5
refactor: comments 2024-07-25 13:23:16 +01:00
xystrive 6ef5221c2c
feat: add skeleton structure for MFA endpoints tests 2024-07-25 13:21:18 +01:00
xystrive cd637fbb6b
feat: add endpoints for Verify MFA Login and Send MFA SMS 2024-07-25 13:17:59 +01:00
xystrive bf2608fb39
feat: add SuspendedUser error value on ChorusError 2024-07-25 13:16:14 +01:00
xystrive 530ed90171
feat: add Request/Response objects for MFA verification endpoints 2024-07-25 13:12:13 +01:00
kozabrada123 a27b488f61
Publically reexport Subscriber as Observer (#530)
Fixes the compile errors in the `voice_simple` example, updates the docs
in the `gateway_observers` example and adds a public reexport of
`Subscriber` as `Observer`, to make development easier and introduce
less breaking changes to our public api

to reduce the external dependencies needed for development with
`chorus`, we could also add some other reexports, potentially
`async_trait::async_trait`
2024-07-25 11:49:44 +02:00
kozabrada123 d829537713 remove cargo lock from example 2024-07-25 11:31:16 +02:00
kozabrada123 b9bc37fcd4 Readd Observer trait as reexport 2024-07-25 11:29:35 +02:00
kozabrada123 832576dbf4 Update documentation in gateway_observers example 2024-07-25 11:28:22 +02:00
kozabrada123 539460a552 Fix voice_simple example 2024-07-25 11:27:30 +02:00
bitfl0wer feb2b1b64c
Bump browser_version according to https://www.useragents.me/#most-common-desktop-useragents 2024-07-24 21:55:10 +02:00
Flori e8469c8e4f
Use cargo nextest (#529)
This PR switches the `linux` job from `cargo test` to `cargo nextest
run` for > 50% time reduction in the test execution step of the CI
pipeline. Also, the "check common non default feature configurations"
step has been moved from the `linux` job to it's own job, to parallelize
the CI pipeline further and reduce the time that CI needs to run to
completion.
2024-07-24 16:24:26 +02:00
bitfl0wer d15dfc302d
Revert: nextest on wasm 2024-07-24 16:17:00 +02:00
bitfl0wer 31509b9945
forgor installing nextest 2024-07-24 16:12:06 +02:00
bitfl0wer f32b3060cf
Cargo nextest on wasm, Parallelize "Check common non-default feat. cfg." 2024-07-24 16:09:33 +02:00
bitfl0wer cc7ed62cf2
Merge branch 'dev' into nextest 2024-07-24 15:59:21 +02:00
bitfl0wer 7bb35e5ed8
Increase limit integer size to match spacebars' possibilities 2024-07-24 15:57:12 +02:00
bitfl0wer f0fc6eab4d
Fix testcase that relied on false behavior implemented by older spacebar servers 2024-07-24 15:55:49 +02:00
bitfl0wer dd85a7de17
Fix/Correct UnavailableGuild object 2024-07-24 15:55:29 +02:00
bitfl0wer 6bc6651e80
Remove redundant "build" step
I mean the bloody thing already gets built with "cargo test", so...
2024-07-24 14:06:10 +02:00
bitfl0wer 0bfab58f2f
Use cargo nextest 2024-07-24 14:00:40 +02:00
bitfl0wer 6cd3c1081b
Use cargo nextest 2024-07-24 13:58:19 +02:00
bitfl0wer 7a2666bde2
Update CONTRIBUTING.md 2024-07-24 13:37:07 +02:00
Flori 1285d702d7
Derives (#526)
Adds about one billion (+- a few hundred million) missing derives for
all sorts of types.

The biggest change in this PR is, how structs holding a property
`Shared<T>` types implement `PartialEq`. In previous versions of this
crate, if a `Shared<T>` was part of a struct, this or these properties
would be ignored in == comparisons. This is because `Shared<T>` is
defined as `Arc<RwLock<T>>` - meaning you'd have to lock the `RwLock` to
make a comparison. From now on, instead of ignoring these properties or
locking the inner `RwLock`, the pointer values of the `Arc<T>`'s get
compared. This is a cheap and exact way of ensuring `Eq` for types,
which have an inner `Shared<T>`.
2024-07-20 18:07:20 +02:00
bitfl0wer 76146b0e8c
Fix: Compile error with no default features 2024-07-20 17:54:49 +02:00
bitfl0wer 88efef6015
Fix: Turn unconditional import of sqlx::types::Json into conditional one 2024-07-20 17:30:21 +02:00
bitfl0wer 0beb4484ca
Fix: Wrong function name 2024-07-20 17:25:33 +02:00
bitfl0wer 599969e2c7
Merge branch 'one-billion-derives' of https://github.com/polyphony-chat/chorus into one-billion-derives 2024-07-20 17:21:52 +02:00
bitfl0wer 98b129aca0
Provide alternative implementations for PartialEq for some types when sqlx feature is enabled 2024-07-20 17:18:23 +02:00
bitfl0wer cd0230e64d
Provide alternative implementations for PartialEq for some types when sqlx feature is enabled 2024-07-20 16:54:47 +02:00
bitfl0wer 491cd255de
Add one BILLION derives 2024-07-18 23:04:35 +02:00
Flori b0667a33fb
Replace `Observer` and `GatewayEvent` with `pubserve` crate (#524)
This PR replaces our internal `Observer` trait with a more generic
version, as offered by our `pubserve` crate.

This also has the added benefit of removing the... creative logic used
in `Observer::unsubscribe()` which did not check the memory the internal
`Arc` points to, but rather some weird

```rs
self.observers
            .retain(|obs| format!("{:?}", obs) != to_remove);
```

which was written ages ago by a version of me that was still at the very
beginning of learning Rust
2024-07-13 18:03:02 +02:00
bitfl0wer ebcb6b65e4
Fix voice, voice_udp features 2024-07-13 14:53:04 +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
xystrive 317dbe1ed1 fix: according to changes made to `ChorusUser` object field 4920c91e52 2024-07-05 17:15:24 +01:00
xystrive ee19cb762f fix: concatenate `Instance`'s api url with endpoint 2024-07-05 17:06:16 +01:00
xystrive c3c506bc1b fix: typo in `ChorusError::MfaRequired` `Display` message 2024-07-05 17:04:05 +01:00
xystrive 8f995a9f63 refactor: change `ChorusUser` new method calls according to changes done 2024-07-04 19:09:28 +01:00
xystrive 6ef33c01c7 refactor: change `User` object assignements according to changes done in `ChorusUser` 2024-07-04 19:08:38 +01:00
xystrive a3aa4625f9 feat: add handling for MFA Required response errors 2024-07-04 18:37:33 +01:00
xystrive 2c4e069269 refactor: remove mfa_token argument from `ChorusRequest` `new` method 2024-07-04 18:34:50 +01:00