Commit Graph

1491 Commits

Author SHA1 Message Date
Flori e4dd31ef78
sqlx related improvements (#542)
* Bump sqlx to 0.8.0

* Update sqlx syntax to 0.8.0, change MySql for sqlx:: Any

* Update sqlx syntax to 0.8.0, change MySql for sqlx:: Any

* Modify chorus_macros::SqlxBitflagDerive to use sqlx::Any over sqlx::MySql (broken!)

* Fix: `cannot infer type for type parameter `DB` declared on the trait...`

* Change remaining impls of sqlx traits for MySql to sqlx::Any

* Alter chorus_macros to correctly derive SqlxBitFlag for sqlx::Any

* rustc/clippy>=v1.80.0: Do not warn when encountering cfg(tarpaulin_include)

* Port compare_* methods to sqlx v0.8.0
2024-08-04 13:08:56 +02:00
Flori ab82a5d49a
Update MSRV (#540)
* Update msrv
2024-08-02 21:12:38 +02:00
Flori 2bd9fbaa9c
bump versions of packages to latest compatible versions (#536) 2024-07-28 12:35:26 +02:00
bitfl0wer f2f45b4b86
bump versions of packages to latest compatible versions 2024-07-28 12:28:56 +02:00
Flori 582173234f
Manually implement std::default::Default for GatewayHeartbeat and Gat… (#535)
Manually implement std::default::Default for GatewayHeartbeat and
GatewayHeartbeatAck with the correct opcodes.
2024-07-28 11:49:49 +02:00
bitfl0wer 7bba7c6fcb
Manually implement std::default::Default for GatewayHeartbeat and GatewayHeartbeatAck 2024-07-27 15:31:47 +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
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
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
Quat3rnion d59161619c
Add custom deserializer for PermissionOverwriteType (#512)
* Add custom deserializer for PermissionOverwriteType
2024-06-27 20:36:39 +02:00
Quat3rnion 39e7f89c78
Backend/guilds (#509)
* Fix SQL encode/decode for GuildFeatures

* Use distinct PermissionFlags type

* Add Emoji schema types, modify GuildBan with feature lock

* Add Schemas for pruning guild members

* Add schemas for interfacing with stickers backend routes

* Add schemas for interfacing with vanity-url backend routes

* Add schema for interfacing with guilds/id/welcome-screen route

* Make all Option<Vec> types Vec types with #[serde(default)]

* Add various types to support guilds/* api routes

* Add missing enums and structs for searching messages

* Use proper distinct types

* Add EmbedType enum

* Use distinct PermissionFlags type

* Changes supporting backend for VoiceState

* Changes supporting backend for AuditLog's
2024-06-27 08:45:51 +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
Quat3rnion b4a8082f29
Update and add some types in support of the backend (#507) 2024-06-19 19:59:39 +02:00
kozabrada123 a7fc00df29
Bump chorus macros to 0.4.0 (#506)
- Bumps chorus macros to 0.4.0, followup to #505
- Makes builds within the repo use the local path and published releases
use a set version of the macros crate
2024-06-18 17:59:41 +02:00
kozabrada123 b3e62b2c33 always update to latest release of macros 2024-06-18 17:48:57 +02:00