diff --git a/crates/app/src/assets.rs b/crates/app/src/assets.rs index 08a328d..120f7e9 100644 --- a/crates/app/src/assets.rs +++ b/crates/app/src/assets.rs @@ -180,7 +180,8 @@ macro_rules! vendor_icon { let writer = &mut ICONS.write().await; writer.insert($name.to_string(), $icon.to_string()); - let file_path = PathBufD::current().extend(&[$icons_dir.clone(), $name.to_string()]); + let file_path = + PathBufD::current().extend(&[$icons_dir.clone(), format!("{}.svg", $name.to_string())]); std::fs::write(file_path, $icon).unwrap(); }}; } diff --git a/crates/app/src/public/css/style.css b/crates/app/src/public/css/style.css index e41edac..5533a96 100644 --- a/crates/app/src/public/css/style.css +++ b/crates/app/src/public/css/style.css @@ -427,6 +427,7 @@ input[type="checkbox"] { background-repeat: no-repeat; width: 1em !important; height: 1em; + min-width: 1em; outline: none; border: solid 1px var(--color-super-lowered); padding: 0; diff --git a/crates/app/src/public/html/auth/register.lisp b/crates/app/src/public/html/auth/register.lisp index 739e538..5cedb18 100644 --- a/crates/app/src/public/html/auth/register.lisp +++ b/crates/app/src/public/html/auth/register.lisp @@ -70,7 +70,7 @@ ("href" "{{ config.policies.privacy }}") (text "Privacy policy")))) (div - ("class" "flex gap-2") + ("class" "flex items-center gap-2") (input ("type" "checkbox") ("name" "policy_consent") diff --git a/crates/app/src/public/html/developer/app.lisp b/crates/app/src/public/html/developer/app.lisp index b9012ec..2850ef5 100644 --- a/crates/app/src/public/html/developer/app.lisp +++ b/crates/app/src/public/html/developer/app.lisp @@ -129,7 +129,7 @@ (pre ("class" "hidden red w-full") (code ("id" "scope_error_message") ("style" "white-space: pre-wrap"))) (details - (summary ("class" "button lowered small") (icon (text "circle-help")) (text "Help")) + (summary ("class" "button lowered small") (icon (text "circle-question-mark")) (text "Help")) (div ("class" "card flex flex-col gap-1") (span ("class" "fade") (text "Scopes should be separated by a single space.")) diff --git a/crates/app/src/public/html/developer/home.lisp b/crates/app/src/public/html/developer/home.lisp index 3a9543f..aefd55d 100644 --- a/crates/app/src/public/html/developer/home.lisp +++ b/crates/app/src/public/html/developer/home.lisp @@ -92,7 +92,7 @@ ("class" "card-nest") (div ("class" "card small flex items-center gap-2") - (icon (text "circle-help")) + (icon (text "circle-question-mark")) (str (text "developer:label.guides_and_help"))) (div diff --git a/crates/app/src/public/html/timelines/search.lisp b/crates/app/src/public/html/timelines/search.lisp index dc6c42d..ef739fe 100644 --- a/crates/app/src/public/html/timelines/search.lisp +++ b/crates/app/src/public/html/timelines/search.lisp @@ -53,7 +53,7 @@ ("title" "Search help") ("href" "{{ config.manuals.search_help }}") ("target" "_blank") - (text "{{ icon \"circle-help\" }}")) + (text "{{ icon \"circle-question-mark\" }}")) (text "{%- endif %}")))) (text "{%- endif %}") (text "{% for post in list %} {% if post[2].read_access == \"Everybody\" -%} {% if post[0].context.repost and post[0].context.repost.reposting -%} {{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true) }} {% else %} {{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], poll=post[5]) }} {%- endif %} {%- endif %} {% endfor %} {% if profile -%} {{ components::pagination(page=page, items=list|length, key=\"&profile=\" ~ profile.id, value=\"&query=\" ~ query) }} {% else %} {{ components::pagination(page=page, items=list|length, key=\"&query=\" ~ query) }} {%- endif %}")))) diff --git a/crates/app/src/routes/api/v1/auth/mod.rs b/crates/app/src/routes/api/v1/auth/mod.rs index cff7d20..a332dd8 100644 --- a/crates/app/src/routes/api/v1/auth/mod.rs +++ b/crates/app/src/routes/api/v1/auth/mod.rs @@ -123,10 +123,6 @@ pub async fn register_request( // } user.invite_code = invite_code.id; - - if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await { - return (None, Json(e.into())); - } } // push initial token @@ -135,21 +131,36 @@ pub async fn register_request( // return match data.create_user(user).await { - Ok(_) => ( - Some([( - "Set-Cookie", - format!( - "__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}", - initial_token, - 60 * 60 * 24 * 365 - ), - )]), - Json(ApiReturn { - ok: true, - message: initial_token, - payload: (), - }), - ), + Ok(_) => { + // mark invite as used + if data.0.0.security.enable_invite_codes { + let invite_code = match data.get_invite_code_by_code(&props.invite_code).await { + Ok(c) => c, + Err(e) => return (None, Json(e.into())), + }; + + if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await { + return (None, Json(e.into())); + } + } + + // ... + ( + Some([( + "Set-Cookie", + format!( + "__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}", + initial_token, + 60 * 60 * 24 * 365 + ), + )]), + Json(ApiReturn { + ok: true, + message: initial_token, + payload: (), + }), + ) + } Err(e) => (None, Json(e.into())), } } diff --git a/crates/core/src/database/auth.rs b/crates/core/src/database/auth.rs index 4fb78f7..4037db7 100644 --- a/crates/core/src/database/auth.rs +++ b/crates/core/src/database/auth.rs @@ -266,7 +266,7 @@ impl DataManager { let res = execute!( &conn, - "INSERT INTO users VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)", + "INSERT INTO users VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23)", params![ &(data.id as i64), &(data.created as i64),