small debug changes

This commit is contained in:
lda committed 2025-05-18 20:39:14 +07:00
1 parent 4a461ecb4e
commit b0cb29d911
1 file changed
+13 -3
+13 -3
View File
@@ -1,9 +1,9 @@
use std::collections::HashMap;
use actix_cors::Cors;
use actix_web::{App, HttpResponse, HttpServer, Responder, get, http::header, web};
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, get, http::header, web};
use chrono::{NaiveDate, TimeDelta};
use fancy_regex::{self, Regex};
use fancy_regex::Regex;
use icalendar::{Calendar, CalendarComponent, Component};
use reqwest::Client;
mod funny_timer;
@@ -13,10 +13,18 @@ const ICS_URL: &str = "https://calendar.google.com/calendar/ical/i7p4ol56gi8sqe0
#[get("/filtered-ics")]
async fn filtered_ics(
req: HttpRequest,
now: web::Data<NaiveDate>,
query: web::Query<HashMap<String, String>>,
) -> impl Responder {
let cumah = funny_timer::LdaTimer::new("total time idfk");
println!(
"got hit from {}, path is obviously {}",
req.peer_addr()
.map(|s| s.to_string())
.unwrap_or("deadass dont know".into()),
req.path()
);
let now: NaiveDate = **now;
let client = Client::new();
let ics_url = query.get("url").map_or(ICS_URL, String::as_str);
@@ -110,7 +118,9 @@ fn filter_events_by_date_and_regex(
let summary = event.get_summary()?;
let kill = if let Some(reg) = &pattern {
reg.is_match(summary).inspect_err(|e|eprintln!("{e}")).unwrap_or(false)
reg.is_match(summary)
.inspect_err(|e| eprintln!("{e}"))
.unwrap_or(false)
// where is the
} else {
summary.contains("CLASS 2") || (2..=8).any(|c| summary.contains(&format!("G{c}")))