remove extra deps and stuff

master
rascul 2 years ago
parent 8afb12d070
commit 7cdf928494

@ -4,7 +4,7 @@ mod routes;
mod wot_log; mod wot_log;
use actix_files::Files; use actix_files::Files;
use actix_web::{guard, middleware, web, App, HttpResponse, HttpServer}; use actix_web::{middleware, web, App, HttpServer};
use handlebars::Handlebars; use handlebars::Handlebars;
use log::info; use log::info;

@ -2,8 +2,7 @@ use std::fs::File;
use std::io::{BufReader, Read}; use std::io::{BufReader, Read};
use std::path::PathBuf; use std::path::PathBuf;
use actix_web::http::header; use actix_web::{get, HttpResponse};
use actix_web::{get, HttpRequest, HttpResponse};
use actix_web::web::{Data, Path}; use actix_web::web::{Data, Path};
use handlebars::Handlebars; use handlebars::Handlebars;
@ -13,13 +12,11 @@ use serde_json::json;
use crate::Result; use crate::Result;
#[get("/+{id}")] #[get("/+{id}")]
pub async fn get(req: HttpRequest, id: Path<String>, hb: Data<Handlebars<'_>>) -> Result<HttpResponse> { pub async fn get(id: Path<String>, hb: Data<Handlebars<'_>>) -> Result<HttpResponse> {
println!("HIHIHI");
let mut path = PathBuf::from("replays"); let mut path = PathBuf::from("replays");
let id: String = id.into_inner(); let id: String = id.into_inner();
path.push(&id); path.push(&id);
let file: File = File::open(&path)?; let file: File = File::open(&path)?;
info!("loaded file: {:?}", path);
let mut buffer = BufReader::new(file); let mut buffer = BufReader::new(file);
let mut file_contents = String::new(); let mut file_contents = String::new();
buffer.read_to_string(&mut file_contents)?; buffer.read_to_string(&mut file_contents)?;

Loading…
Cancel
Save