mirror of
https://github.com/13hannes11/ics-proxy.git
synced 2024-09-06 08:01:41 +02:00
fix names of code
This commit is contained in:
31
src/main.rs
31
src/main.rs
@@ -1,21 +1,28 @@
|
|||||||
use actix_web::{get, App, HttpResponse, HttpServer, Responder};
|
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer, Responder};
|
||||||
|
|
||||||
#[get("/events.ics")]
|
async fn make_ics_request(req: HttpRequest) -> impl Responder {
|
||||||
async fn hello() -> impl Responder {
|
let id = req.match_info().get("id").unwrap_or("World");
|
||||||
let res = match reqwest::blocking::get("https://cloud.timeedit.net/uu/web/schema/ri6QX6089X8061QQ88Z4758Z08y37424838828461554904Y684XX09894Q8721784ZnX6503.ics") {
|
|
||||||
Ok(r) => match r.text() {
|
let body = match id {
|
||||||
Ok(res) => res,
|
"1" => {
|
||||||
Err(_) => "".to_string(),
|
let res = match reqwest::blocking::get("https://cloud.timeedit.net/uu/web/schema/ri6QX6089X8061QQ88Z4758Z08y37424838828461554904Y684XX09894Q8721784ZnX6503.ics") {
|
||||||
},
|
Ok(r) => match r.text() {
|
||||||
Err(_) => "".to_string(),
|
Ok(res) => res,
|
||||||
|
Err(_) => "".to_string(),
|
||||||
|
},
|
||||||
|
Err(_) => "".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
|
res
|
||||||
|
}
|
||||||
|
_ => "".to_string(),
|
||||||
};
|
};
|
||||||
|
HttpResponse::Ok().content_type("text/calendar").body(body)
|
||||||
HttpResponse::Ok().content_type("text/calendar").body(res)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(|| App::new().service(hello))
|
HttpServer::new(|| App::new().route("/{id}/events.ics", web::get().to(make_ics_request)))
|
||||||
.bind("127.0.0.1:8080")?
|
.bind("127.0.0.1:8080")?
|
||||||
.run()
|
.run()
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user