Commit Graph

1359 Commits

Author SHA1 Message Date
bitfl0wer b5923c30e2 Replace Arc, Rwlock with Shared 2024-01-21 20:24:17 +01:00
bitfl0wer 196a36a5fe Write documentation for observe 2024-01-21 20:13:00 +01:00
bitfl0wer bae0ce8b1f Add documentation for into_shared 2024-01-21 17:15:11 +01:00
bitfl0wer 400d4c74cf Rename to_shared to into_shared 2024-01-21 17:10:24 +01:00
bitfl0wer 22e8ca2a97 Define public method `to_shared` for dyn Composite 2024-01-21 17:07:54 +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 163db42536 Minor instance updates (#465)
make Instance::from_url_bundle pub, update Instance docs
2024-01-20 13:15:13 +01:00
Flori 841a46f1ce merge main into dev (#464) 2024-01-19 21:55:29 +01:00
Flori 21a59b4d8a Update README.md 2024-01-19 21:55:05 +01:00
bitfl0wer e15c947d33 Merge branch 'main' of https://github.com/polyphony-chat/chorus 2024-01-19 21:50:44 +01:00
bitfl0wer bb1d565b55 bump version to 0.14.0 2024-01-19 21:50:42 +01:00
Flori bc2dbb8017 Version 0.14.0 (#463)
## Fixes

- Fix gateway heartbeat on WASM: #460

## Changes

- Update `GuildDefaults` to use new enums
- Make new enums derive `sqlx::Type`
- Feature lock UpdateMessage implementations

## Package changes

- Bump package version, especially reqwest from 0.11.22->0.11.23 -
removes need for custom git branch in Cargo.toml
2024-01-19 21:50:26 +01:00
Flori 65d9de88fe Fix gateway heartbeat on WASM (#460)
It turns out `std::time::Instant::now()` panics WASM (see #459) and
breaks the heartbeat handler.

This pr attempts to fix that by replacing `std::time::Instant` with
`wasmtimer::std::Instant` and `safina_timer::sleep_until` with
`wasmtimer::tokio::sleep_until`.
2024-01-19 17:24:48 +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 796bea7492 right 2024-01-19 15:31:40 +01:00
kozabrada123 1baa14f857 fix: gateway simple example 2024-01-19 15:21:53 +01:00
kozabrada123 85602de91c fix tests 2024-01-19 15:14:50 +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
Flori ba5d263fba bump package versions (#458) 2024-01-11 19:51:27 +01:00
bitfl0wer 9c7f430b06 bump package versions 2024-01-11 19:36:36 +01:00
bitfl0wer cceff86de1 bump reqwest to 0.11.23 2024-01-11 19:30:40 +01:00
bitfl0wer a7c66ca823 Revert last commit 2023-12-17 22:16:53 +01:00
bitfl0wer db476e94ee Add MANAGE_ENCRYPTION permission 2023-12-17 20:47:52 +01:00
Flori 2fc94c84d5 merge backend branch into dev (#454) 2023-12-15 00:22:46 +01:00
Flori 75f33606c9 Well known required (#456)
Title: Add User Authentication Feature

Description:

This pull request introduces user authentication functionality to our
web application. The main goal of this feature is to ensure that each
action performed on the platform is tied to a valid, logged-in user,
thus providing accountability and maintaining data security.

Changes:

New models: Added the User model to represent users in our system. This
model includes fields: username, password_hash, email etc.

User seriliazer and views: Implemented serializers and API views for
user registration, login, and logout.

Authentication Middlewares: Added middlewares to check for a valid
session or token before allowing access to certain views.

Tests: Included comprehensive test coverage for the new feature. Tests
were implemented to verify user registration, login, and logout
functionality, as well as checking authentication enforcement on
applicable views.

    Documentation: Updated API documentation related to User endpoints.

This feature is expected to improve the overall security of our
application by properly managing user sessions and actions.

Note: You will see references to some helper tools like make_password
and check_password methods, these are security measures to ensure we are
not storing plain text passwords in the database.

This PR follows our Python coding standards and is fully linted and
tested.

Requesting review and feedback. If all points are clear and no issues
are detected during the review, we would appreciate it if this PR could
be merged at the earliest convenience.

Related Issue: #123
2023-12-15 00:22:36 +01:00
bitfl0wer 1c4721a70f Refactor instance creation 2023-12-15 00:10:33 +01:00
Flori e6c627afbc Update docs (#453) 2023-12-10 18:51:32 +01:00
bitfl0wer 40d7da96cd Update documentation and examples 2023-12-10 18:40:03 +01:00
bitfl0wer 9ca29c6560 Update cargo lock 2023-12-10 18:37:38 +01:00
bitfl0wer b607dee673 Merge branch 'dev' 2023-12-03 22:37:28 +01:00
bitfl0wer f74a8b2068 Bump version 2023-12-03 22:35:45 +01:00
Flori 266a3d1dd3 QoL Updates (#452)
- Make register and login not take an instance by ownership
- Add README information to `lib.rs`
- Add more derives to ChorusUser and Instance
- Impl From reqwest::Error for ChorusError
- Add support for .well-known #449 
- Remove "limited: bool" as an argument for `Instance::new` in favour of
dynamic instance limit checking #450
2023-12-03 22:31:21 +01:00
bitfl0wer 39f7aa2a7a Remove limited argument from Instance 2023-12-03 21:44:08 +01:00
bitfl0wer bd1793fdb1 Make get_limits_config part of public api 2023-12-03 21:42:41 +01:00
bitfl0wer f5774ae047 Remove "limited" parameter 2023-12-03 21:34:44 +01:00
Flori 2c44232b05 Get URLs from .well-known (#451)
Closes #449.

+ `Instance::from_root_url(root_url: &str, limited: bool)`: Creates a
new Instance by trying to get the relevant instance urls (UrlBundle)
from a root url. Shorthand for
`Instance::new(UrlBundle::from_root_domain(root_domain).await?)`
+ `UrlBundle::from_root_url(url: &str)`: Performs a few HTTP requests to
try and retrieve a UrlBundle from an instance's root URL. The method
tries to retrieve the UrlBundle via these three strategies, in order:
- GET: $url/.well-known/spacebar -> Retrieve UrlBundle via
$wellknownurl/api/policies/instance/domains
    - GET: $url/api/policies/instance/domains
    - GET: $url/policies/instance/domains
    
The URL stored at .well-known/spacebar is the instance's API endpoint.
The API stores the CDN and WSS URLs under the
$api/policies/instance/domains endpoint. If all three of the above
approaches fail, it is very likely that the instance is misconfigured,
unreachable, or that a wrong URL was provided.
+ Add clippy warnings for: `clippy::todo,
    clippy::unimplemented,
    clippy::dbg_macro,
    clippy::print_stdout,
    clippy::print_stderr`
2023-12-03 16:05:58 +01:00
bitfl0wer 2c0f71793d wasm-safari CI seems to be bugged - disabling for now 2023-12-03 15:57:03 +01:00
bitfl0wer 3a4fd470df Try giving macos-safari its own cache key to fix CI 2023-12-03 15:06:09 +01:00
bitfl0wer c0004d732c Change macOS Safari test strategy to no-fail-fast 2023-12-03 14:18:14 +01:00
bitfl0wer 0125c38bd0 Rename from_root_domain to from_root_url 2023-12-03 13:39:23 +01:00
bitfl0wer b5ff7e3347 Add Instance::from_root_domain(), change documentation wording 2023-12-03 13:37:32 +01:00
bitfl0wer 1a52975dbd Add test if an example well-known response gets parsed correctly. 2023-12-03 13:33:24 +01:00
bitfl0wer b246e08aca Write test to check basic functionality of UrlBundle::from_root_domain() 2023-12-03 13:29:38 +01:00
bitfl0wer c835bf1123 check for dbg! println! eprintln! in production code 2023-12-03 13:28:50 +01:00
bitfl0wer 410eef1edd impl from_api_url 2023-12-03 13:16:34 +01:00