Add Cookies Policy page

O01eg
Sep 16, 2022, 11:16 AM
HDHALX3UK5VSU7WBDWSVF37QG5OBCIOLFGP5PQTGBQFOARZOKWMQC

Dependencies

  • [2] RPAQDOZ4 Move atom pages to separate module
  • [3] 6NYILMKI Add page for slow game
  • [*] GZNMGW5M Move footer to separate file
  • [*] 3GGMBQ2N Update dependencies and add list of slow games
  • [*] 65A3LIWU Use handlebars to render index
  • [*] EVP2FSBH Split index page
  • [*] HZDCKIXQ Use constants for templates
  • [*] 4MZ4VIR7 Initial commit
  • [*] DGGFYSEG Use non-escaped template for Atom XML
  • [*] ZRU62WXD Send email with change game password link
  • [*] DNFB7TNI Add new pages and links to slow games and reset game password

Change contents

  • edit in src/templates/sub/footer.html at line 4
    [6.300]
    [5.209]
    <a href="cookies-policy.html">Cookies Policy</a>
  • file addition: cookies-policy.html (----------)
    [7.12]
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <link rel="alternate" type="application/rss+xml" href="static/rss.xml" title="Multiplayer FreeOrion server news" />
    <link rel="stylesheet" type="text/css" href="static/style.css" />
    <title>Cookies policy</title>
    </head>
    <body>
    <div class="navi">
    <a href="slow-games.html">Slow games corner</a>
    </div>
    <div class="content">
    <h1>Cookies policy</h1>
    Site uses only mandatory cookies to check agreement to accept cookies and user authentication. Cookies don't send to third parties.
    </div>
    {{> footer}}
    </body>
    </html>
  • edit in src/pages/mod.rs at line 8
    [2.14]
    [8.51]
    pub mod cookies_policy;
  • edit in src/pages/mod.rs at line 22
    [3.2969]
    [9.1270]
    pub const COOKIES_POLICY: &str = "cookies-policy";
  • file addition: cookies_policy.rs (----------)
    [8.17]
    use actix_web::{web, HttpResponse};
    use crate::pages::insert_security_headers;
    use crate::pages::templates::COOKIES_POLICY;
    use crate::WebData;
    pub async fn cookies_policy(data: web::Data<WebData<'_>>) -> HttpResponse {
    let body = match data.handlebars.render(COOKIES_POLICY, &()) {
    Ok(b) => b,
    Err(e) => {
    log::error!("Render index error: {}", e);
    return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
    }
    };
    insert_security_headers(HttpResponse::Ok()).body(body)
    }
  • edit in src/main.rs at line 14
    [2.208]
    [8.398]
    use pages::cookies_policy::cookies_policy;
  • edit in src/main.rs at line 116
    [9.2008]
    [11.245]
    handlebars
    .register_template_string(
    templates::COOKIES_POLICY,
    include_str!("templates/cookies-policy.html"),
    )
    .expect("cookies policy template");
  • edit in src/main.rs at line 139
    [3.3243]
    [12.1099]
    handlebars_xml
    .register_template_string(
    templates::sub::FOOTER,
    include_str!("templates/sub/footer.html"),
    )
    .expect("footer sub template");
  • edit in src/main.rs at line 196
    [13.2536]
    [9.2328]
    .route("/cookies-policy.html", web::get().to(cookies_policy))