♻️ refactor
This commit is contained in:
parent
553de1bcf7
commit
7351ad9c5d
5 changed files with 5 additions and 10 deletions
|
@ -1,5 +1,4 @@
|
|||
use serde_json::Value;
|
||||
use std::fmt::format;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct GotifySettings {
|
||||
|
|
|
@ -12,7 +12,7 @@ pub async fn notify(msg: &str, title: &str, config: Data<Config>) {
|
|||
async fn gotify_notification(msg: &str, title: &str, config: config::GotifySettings) {
|
||||
info!("Sending gotify notification");
|
||||
let c = reqwest::Client::new();
|
||||
let res = c
|
||||
let _ = c
|
||||
.post(format!(
|
||||
"https://{}/message?token={}",
|
||||
config.host, config.token
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use reqwest::get;
|
||||
|
||||
pub fn is_browser(req: &actix_web::HttpRequest) -> bool {
|
||||
let ua = req
|
||||
.headers()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use crate::config;
|
||||
use crate::config::Config;
|
||||
use actix_web::web::Data;
|
||||
use actix_web::*;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use crate::pages::html_fn::build_site;
|
||||
use crate::{config, pages};
|
||||
use actix_web::http::header;
|
||||
use actix_web::web::{Form, Json};
|
||||
use actix_web::web::Form;
|
||||
use actix_web::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::Read;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct MessageForm {
|
||||
|
@ -21,9 +19,10 @@ pub async fn message_post(r: HttpRequest, f: Form<MessageForm>) -> impl Responde
|
|||
&format!("New Message from {}", f.msg_name.to_string()),
|
||||
"New Message",
|
||||
config.clone(),
|
||||
);
|
||||
)
|
||||
.await;
|
||||
return HttpResponse::Found()
|
||||
.header("Location", "/message")
|
||||
.append_header(("Location", "/message"))
|
||||
.finish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue