diff --git a/Cargo.lock b/Cargo.lock index 1e32238..fb3fed7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1899,15 +1899,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonvec" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -4791,7 +4782,6 @@ dependencies = [ "hmac", "httpsign", "jrd", - "jsonvec", "nodeinfo", "openssl", "reqwest", @@ -4887,6 +4877,7 @@ dependencies = [ "apb", "chrono", "console_error_panic_hook", + "cookie", "dashmap", "futures", "jrd", diff --git a/web/Cargo.toml b/web/Cargo.toml index fcda748..e66905a 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -13,6 +13,7 @@ repository = "https://git.alemi.dev/upub.git" [dependencies] lazy_static = "1.4" +cookie = "0.18" tracing = "0.1" tracing-subscriber = "0.3" tracing-subscriber-wasm = "0.1" diff --git a/web/src/app.rs b/web/src/app.rs index 16fc2da..c15a6ba 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -3,7 +3,7 @@ use leptos_router::*; use crate::prelude::*; use crate::CONTACT; -use leptos_use::{signal_debounced, storage::use_local_storage, use_cookie, use_element_size, use_window_scroll, utils::{FromToStringCodec, JsonCodec}, UseElementSizeReturn}; +use leptos_use::{signal_debounced, storage::use_local_storage, use_cookie_with_options, use_element_size, use_window_scroll, UseCookieOptions, utils::{FromToStringCodec, JsonCodec}, UseElementSizeReturn}; #[derive(Clone, Copy)] pub struct Feeds { @@ -44,8 +44,20 @@ impl Feeds { #[component] pub fn App() -> impl IntoView { - let (token, set_token) = use_cookie::("token"); - let (userid, set_userid) = use_cookie::("user_id"); + let (token, set_token) = use_cookie_with_options::( + "token", + UseCookieOptions::default() + .same_site(cookie::SameSite::Strict) + // .secure(true) + .path("/") + ); + let (userid, set_userid) = use_cookie_with_options::( + "user_id", + UseCookieOptions::default() + .same_site(cookie::SameSite::Strict) + // .secure(true) + .path("/") + ); let (config, set_config, _) = use_local_storage::("config"); let auth = Auth { token, userid };