Conversation
Owner
Author
|
this is quite a WIP branch, but it works at this point, and i dont want to lose my local changes (for the 3rd time), hence the upload :D testers are welcome! |
…makefile, don't forget though
Merged
b6c200c to
84bb86e
Compare
Collaborator
|
as DioxusLabs/dioxus#5089 has been fixed, it's time to see how it works! hasn't been released yet though, but here's the diff/patch to apply so you can try this out. don't forget to run diff --git a/Cargo.toml b/Cargo.toml
index 4c24204..a28e84b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,3 +43,6 @@ server_state_save = ["server", "dep:ciborium"]
[build-dependencies]
humantime = "2.3.0"
+
+[patch.crates-io]
+dioxus = { git = "https://github.com/dioxuslabs/dioxus" }
diff --git a/src/app/actions.rs b/src/app/actions.rs
index 7e7936c..909db1f 100644
--- a/src/app/actions.rs
+++ b/src/app/actions.rs
@@ -46,19 +46,16 @@ pub async fn handle_join(mut auth: Signal<AuthState>, toast_api: Toasts) {
return;
};
- let _ok_none = crate::backend::endpoints::join(u.clone()).await;
- match crate::backend::endpoints::auth_state().await {
- Ok(uname) => {
- popup_normal(toast_api, format!("Üdv, {}", uname));
+ match crate::backend::endpoints::join(u.clone()).await {
+ Ok(_) => {
+ popup_normal(toast_api, format!("Üdv, {u}"));
auth.write().joined = true; // TODO auth.reset(_somefield)
auth.write().password = String::new();
auth.write().show_password_prompt = false;
}
- Err(e) => {
- popup_error(
- toast_api,
- format!("Hiba: {}", e.message.unwrap_or("ismeretlen hiba".into())),
- );
+ Err(http_err) => {
+ error!("couldn't join: {http_err}");
+ popup_error(toast_api, format!("Hiba: {http_err}"));
}
}
}
@@ -220,11 +217,8 @@ pub fn handle_logout(
popup_normal(toast_api, format!("Viszlát, {}", auth.read().username));
auth.set(AuthState::default());
}
- Err(e) => {
- popup_error(
- toast_api,
- format!("Hiba: {}", e.message.unwrap_or("ismeretlen hiba".into())),
- );
+ Err(http_err) => {
+ popup_error(toast_api, format!("Hiba: {http_err}"));
}
}
});
diff --git a/src/backend/endpoints.rs b/src/backend/endpoints.rs
index e599de9..a0382f2 100644
--- a/src/backend/endpoints.rs
+++ b/src/backend/endpoints.rs
@@ -51,8 +51,6 @@ pub async fn auth_state() -> Result<String, HttpError> {
/// We'll return a `SetCookie` header if the login is successful.
///
/// This will set a cookie in the user's browser that can be used for subsequent authenticated requests.
-///
-/// WARN: **always** returns `Some(Ok(SetHeader { data: None }))`, see <https://github.com/DioxusLabs/dioxus/issues/5089>
#[post("/api/join", cookies: TypedHeader<Cookie>)]
pub async fn join(username: String) -> Result<SetHeader<SetCookie>, HttpError> {
check_admin_pwd()?;
@@ -89,8 +87,6 @@ pub async fn join(username: String) -> Result<SetHeader<SetCookie>, HttpError> {
/// otherwise preserve team progress for future relogins
///
/// returns empty, expired `sid` `SetCookie` header => browser deletes the valid one => user's now deauthed
-///
-/// WARN: **always** returns `Some(Ok(SetHeader { data: None }))`, see <https://github.com/DioxusLabs/dioxus/issues/5089>
#[post("/api/logout", cookies: TypedHeader<Cookie>)]
pub async fn logout(wipe_progress: Option<bool>) -> Result<SetHeader<SetCookie>, HttpError> {
check_admin_pwd()?;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #21
set_admin_passwordendpoint