moved core functions to web-base crate

This commit is contained in:
JMARyA 2022-11-17 15:01:46 +01:00
parent 9b989745e0
commit 873b91f5fd
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
7 changed files with 29 additions and 127 deletions

View file

@ -28,7 +28,7 @@ pub async fn message_post(r: HttpRequest, f: Form<MessageForm>) -> impl Responde
#[get("/message")]
pub async fn message_page(r: HttpRequest) -> impl Responder {
let config: &web::Data<config::Config> = r.app_data().unwrap();
let host = pages::func::get_host(&r);
let host = web_base::func::get_host(&r);
let resp = format!(
r#"
<div class="container" style="margin-top: 25px"><h1>Message</h1>
@ -50,7 +50,7 @@ pub async fn mirrors(r: HttpRequest) -> impl Responder {
let config: &web::Data<config::Config> = r.app_data().unwrap();
if let Ok(mirror_file) = std::fs::File::open("/config/mirrors.txt") {
let content = std::io::read_to_string(mirror_file).unwrap();
if pages::func::is_browser(&r) {
if web_base::func::is_browser(&r) {
let resp = format!(
r#"
<div style="margin: 25px;">
@ -71,9 +71,9 @@ pub async fn mirrors(r: HttpRequest) -> impl Responder {
#[get("/public_key")]
pub async fn public_key(r: HttpRequest) -> impl Responder {
if pages::func::is_browser(&r) {
if web_base::func::is_browser(&r) {
let config: &web::Data<config::Config> = r.app_data().unwrap();
let host = format!("http://{}", pages::func::get_host(&r));
let host = format!("http://{}", web_base::func::get_host(&r));
let key = std::io::read_to_string(std::fs::File::open("/config/pub.key").unwrap()).unwrap();
let pgp = gnupg::GnuPG::new().unwrap();