Add well-known host-meta page

O01eg
Apr 22, 2022, 7:59 AM
XS5FAAN46G4BLUIFVKX5FJEX5H6SDPH3F35QO4E6PPOP4A6XQ7VAC

Dependencies

  • [2] WLWTNO4Y Create form to request game password change link
  • [3] DNFB7TNI Add new pages and links to slow games and reset game password
  • [*] EVP2FSBH Split index page
  • [*] WVHXYKCV Add postgresql pools
  • [*] 4MZ4VIR7 Initial commit
  • [*] HZDCKIXQ Use constants for templates

Change contents

  • file addition: well_known.rs (----------)
    [5.17]
    use actix_web::{web, HttpResponse};
    use crate::WebData;
    pub async fn host_meta(data: web::Data<WebData<'_>>) -> HttpResponse {
    HttpResponse::Ok()
    .insert_header(("Content-Type", "application/xrd+xml"))
    .insert_header((
    "Date",
    chrono::Utc::now()
    .format("%a, %d %b %Y %H:%M:%S GMT")
    .to_string(),
    ))
    .body(format!(r#"<?xml version="1.0"?>
    <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
    <Link rel="lrdd" type="application/xrd+xml" template="{}://{}/.well-known/webfinger?resource={{uri}}"/>
    </XRD>
    "#, data.base_proto, data.base_domain))
    }
  • edit in src/pages/mod.rs at line 12
    [3.2194]
    [6.413]
    pub mod well_known;
  • edit in src/main.rs at line 21
    [8.1626]
    [6.744]
    use pages::well_known::host_meta;
  • edit in src/main.rs at line 176
    [8.2461]
    [2.1998]
    .route("/.well-known/host-meta", web::get().to(host_meta))