Split database usage in pages

O01eg
Sep 16, 2022, 10:33 AM
LTQCLSBUUATO4LYIXEW6R2QF6EZ7ETGXGSHWXP2U3JQOTU7QQGSQC

Dependencies

  • [2] 6CFNBL5L Add headers for better security
  • [3] YXH3KDBR Add initial webfinger
  • [4] 6NYILMKI Add page for slow game
  • [5] C6F7SJZI Add players count to slow game's page
  • [6] HZDCKIXQ Use constants for templates
  • [7] DGGFYSEG Use non-escaped template for Atom XML
  • [8] ZRU62WXD Send email with change game password link
  • [9] XS5FAAN4 Add well-known host-meta page
  • [10] 5UYVIBUM Update game password from page
  • [11] ZE5UFPX4 Add TTL cache for CSRF
  • [12] WW3KRXX6 Add page for reset game password
  • [13] FVYTV3D2 Add custom notes to new games feed
  • [14] AMBIOSDG Add info about status of the game
  • [15] EVP2FSBH Split index page
  • [16] OJO4B4QO Add login form and empty handler
  • [17] DNFB7TNI Add new pages and links to slow games and reset game password
  • [18] K74N3DFC Display different status of games
  • [19] 556ZESEO Add RSS for new games
  • [20] TRBYOQBI Check CSRF and user existence
  • [21] 4JK5O45H Start support for XMPP game password change
  • [22] 3GGMBQ2N Update dependencies and add list of slow games
  • [23] WLWTNO4Y Create form to request game password change link
  • [24] G3VK7RIB Add FreeOrion forum's URL to slow game's
  • [25] GUAEZDLE Add turns info to slow game's page
  • [26] I6SOPEQF Create and store reset password token
  • [27] 65A3LIWU Use handlebars to render index
  • [28] I7JG43BJ Rename cache to use yet another
  • [29] HTYEGVBU Add data to reset password page
  • [30] CMA5SKJ3 Copy turns Atom generator
  • [31] RAXDAROS Split base URL to protocol and domain
  • [32] LPK5YJ2D Show slow game's status and notes
  • [33] WVHXYKCV Add postgresql pools
  • [*] 4MZ4VIR7 Initial commit

Change contents

  • replacement in src/pages/slow_games.rs at line 5
    [5.1750][5.1750:1770]()
    use crate::WebData;
    [5.1750]
    [5.1770]
    use crate::{DataBaseRo, WebData};
  • replacement in src/pages/slow_games.rs at line 19
    [5.590][5.1771:1843](),[5.1771][5.1771:1843](),[5.1843][5.591:643]()
    pub async fn slow_games(data: web::Data<WebData<'_>>) -> HttpResponse {
    let dbclient = match data.pool_ro.get().await {
    [5.590]
    [5.643]
    pub async fn slow_games(
    data: web::Data<WebData<'_>>,
    data_ro: web::Data<DataBaseRo>,
    ) -> HttpResponse {
    let dbclient = match data_ro.0.get().await {
  • replacement in src/pages/slow_game.rs at line 5
    [4.746][4.746:766]()
    use crate::WebData;
    [4.746]
    [4.766]
    use crate::{DataBaseRo, WebData};
  • replacement in src/pages/slow_game.rs at line 21
    [4.916][4.916:1012]()
    pub async fn slow_game(path: web::Path<String>, data: web::Data<WebData<'_>>) -> HttpResponse {
    [4.916]
    [4.1012]
    pub async fn slow_game(
    path: web::Path<String>,
    data: web::Data<WebData<'_>>,
    data_ro: web::Data<DataBaseRo>,
    ) -> HttpResponse {
  • replacement in src/pages/slow_game.rs at line 32
    [4.1197][4.1197:1249]()
    let dbclient = match data.pool_ro.get().await {
    [4.1197]
    [4.1249]
    let dbclient = match data_ro.0.get().await {
  • replacement in src/pages/reset_game_pwd.rs at line 6
    [5.483][5.0:20](),[5.664][5.0:20]()
    use crate::WebData;
    [5.483]
    [5.846]
    use crate::{DataBaseRo, DataBaseRw, WebData};
  • edit in src/pages/reset_game_pwd.rs at line 30
    [5.169]
    [5.169]
    data_ro: web::Data<DataBaseRo>,
  • replacement in src/pages/reset_game_pwd.rs at line 39
    [5.1253][5.1253:1305]()
    let dbclient = match data.pool_ro.get().await {
    [5.1253]
    [5.1305]
    let dbclient = match data_ro.0.get().await {
  • edit in src/pages/reset_game_pwd.rs at line 101
    [5.579]
    [5.579]
    data_rw: web::Data<DataBaseRw>,
  • replacement in src/pages/reset_game_pwd.rs at line 119
    [5.1123][5.1123:1175]()
    let dbclient = match data.pool_rw.get().await {
    [5.1123]
    [5.1175]
    let dbclient = match data_rw.0.get().await {
  • replacement in src/pages/query_reset_game_pwd.rs at line 6
    [5.646][5.646:666]()
    use crate::WebData;
    [5.646]
    [5.1091]
    use crate::{DataBaseRo, DataBaseRw, WebData};
  • edit in src/pages/query_reset_game_pwd.rs at line 102
    [5.427]
    [5.1676]
    data_ro: web::Data<DataBaseRo>,
    data_rw: web::Data<DataBaseRw>,
  • replacement in src/pages/query_reset_game_pwd.rs at line 124
    [5.937][5.937:992]()
    let dbclient_ro = match data.pool_ro.get().await {
    [5.937]
    [5.992]
    let dbclient_ro = match data_ro.0.get().await {
  • replacement in src/pages/query_reset_game_pwd.rs at line 152
    [5.2115][5.0:55]()
    let dbclient_rw = match data.pool_rw.get().await {
    [5.2115]
    [5.55]
    let dbclient_rw = match data_rw.0.get().await {
  • edit in src/pages/mod.rs at line 32
    [5.144][5.475:559](),[5.475][5.475:559]()
    pub pool_ro: deadpool_postgres::Pool,
    pub pool_rw: deadpool_postgres::Pool,
  • edit in src/pages/mod.rs at line 42
    [2.246]
    [2.246]
    pub struct DataBaseRo(pub deadpool_postgres::Pool);
    pub struct DataBaseRw(pub deadpool_postgres::Pool);
  • replacement in src/pages/atom/turns.rs at line 4
    [5.1506][5.1506:1526]()
    use crate::WebData;
    [5.1506]
    [5.143]
    use crate::{DataBaseRo, WebData};
  • replacement in src/pages/atom/turns.rs at line 24
    [5.494][5.494:591]()
    pub async fn atom_turns(path: web::Path<String>, data: web::Data<WebData<'_>>) -> HttpResponse {
    [5.494]
    [5.591]
    pub async fn atom_turns(
    path: web::Path<String>,
    data: web::Data<WebData<'_>>,
    data_ro: web::Data<DataBaseRo>,
    ) -> HttpResponse {
  • replacement in src/pages/atom/turns.rs at line 35
    [5.776][5.776:828]()
    let dbclient = match data.pool_ro.get().await {
    [5.776]
    [5.828]
    let dbclient = match data_ro.0.get().await {
  • replacement in src/pages/atom/games.rs at line 4
    [5.138][5.138:158]()
    use crate::WebData;
    [5.138]
    [5.158]
    use crate::{DataBaseRo, WebData};
  • replacement in src/pages/atom/games.rs at line 25
    [5.511][5.511:635]()
    pub async fn atom_games(data: web::Data<WebData<'_>>) -> HttpResponse {
    let dbclient = match data.pool_ro.get().await {
    [5.511]
    [5.635]
    pub async fn atom_games(
    data: web::Data<WebData<'_>>,
    data_ro: web::Data<DataBaseRo>,
    ) -> HttpResponse {
    let dbclient = match data_ro.0.get().await {
  • replacement in src/main.rs at line 23
    [5.739][5.744:764](),[3.1363][5.744:764](),[5.1626][5.744:764](),[5.1187][5.744:764]()
    use pages::WebData;
    [3.1363]
    [5.94]
    use pages::{DataBaseRo, DataBaseRw, WebData};
  • edit in src/main.rs at line 139
    [5.462][5.1865:1899](),[5.1865][5.1865:1899]()
    pool_ro,
    pool_rw,
  • edit in src/main.rs at line 159
    [5.554]
    [5.2213]
    let data_ref_ro = web::Data::new(DataBaseRo(pool_ro));
    let data_ref_rw = web::Data::new(DataBaseRw(pool_rw));
  • edit in src/main.rs at line 178
    [5.1948]
    [5.601]
    .app_data(data_ref_ro.clone())
    .app_data(data_ref_rw.clone())