Show user info on cookies page

O01eg
Feb 2, 2025, 3:08 PM
OMLX22X64ZF3C7XD6MAR4GJB77UWAHADMH5VX2SC6VYTVJ5UCR5QC

Dependencies

  • [2] W2AVMCLO Log in with Mastodon
  • [3] KDYHFAE3 Add and remove cookies
  • [4] LWCZDLBI Add buttons to accept and remove cookies
  • [5] 2MPJPGRY Populate cookies jar
  • [6] HDHALX3U Add Cookies Policy page
  • [7] FUCFD4UV Add log in and log out support
  • [8] D3RL62X5 Implement revoking delegation
  • [9] WEVOADLS Require to accept cookies policy for log in
  • [10] JG2BQCRD Implement query for delegation
  • [*] 6NYILMKI Add page for slow game
  • [*] IXY6NZLM Start to use migrations files for PostgreSQL database

Change contents

  • replacement in src/pages/slow_game.rs at line 665
    [3.3329][3.3329:3392]()
    log::error!("Pool RW execute insert error {}", e);
    [3.3329]
    [3.3392]
    log::error!("Pool RW execute insert query delegation error: {}", e);
  • replacement in src/pages/log_in.rs at line 41
    [2.519][3.134:146](),[3.134][3.134:146]()
    if !jar
    [2.519]
    [3.146]
    if jar
  • replacement in src/pages/log_in.rs at line 44
    [3.214][3.214:261]()
    .map_or(false, |x| x.value() == "yes")
    [3.214]
    [3.261]
    .is_none_or(|x| x.value() != "yes")
  • replacement in src/pages/log_in.rs at line 69
    [2.747][2.747:759]()
    if !jar
    [2.747]
    [2.759]
    // ToDo: skip this check if player accepted them
    if jar
  • replacement in src/pages/log_in.rs at line 73
    [2.821][2.821:868]()
    .map_or(false, |x| x.value() == "yes")
    [2.821]
    [2.868]
    .is_none_or(|x| x.value() != "yes")
  • replacement in src/pages/cookies_policy.rs at line 5
    [3.914][3.6676:6737]()
    use crate::pages::{insert_security_headers, request_to_jar};
    [3.914]
    [3.914]
    use crate::pages::{insert_security_headers, request_to_jar, CommonAuthInfo};
  • replacement in src/pages/cookies_policy.rs at line 9
    [3.345][3.345:392]()
    struct CookieInfo {
    i_accept_cookie: bool,
    [3.345]
    [3.392]
    struct CookieInfo<'a> {
    pub common_auth_info: CommonAuthInfo<'a>,
    pub i_accept_cookie: bool,
  • edit in src/pages/cookies_policy.rs at line 16
    [2.11205]
    [3.395]
    let user = jar
    .private(&data.cookies_key)
    .get("auth")
    .map(|x| x.value().to_string());
  • edit in src/pages/cookies_policy.rs at line 25
    [3.486]
    [3.486]
    common_auth_info: CommonAuthInfo {
    user: user.map(Into::into),
    },
  • replacement in src/pages/cookies_policy.rs at line 31
    [3.603][3.603:659]()
    .map_or(false, |x| x.value() == "yes"),
    [3.603]
    [3.659]
    .is_some_and(|x| x.value() == "yes"),
  • file addition: 20240731_1_users_accepted_cookies.sql (----------)
    [13.15]
    -- Create field to store if player accepted cookies
    DO $$
    BEGIN
    IF NOT EXISTS (
    SELECT 1 FROM pg_class c
    INNER JOIN pg_namespace n ON n.oid = c.relnamespace
    INNER JOIN pg_attribute a ON a.attrelid = c.oid
    WHERE c.relname = 'users' AND n.nspname = 'auth' AND a.attname = 'accept_cookies'
    ) THEN
    ALTER TABLE auth.users ADD COLUMN accept_cookies BOOLEAN NULL;
    END IF;
    END
    $$;