|
@@ -6,14 +6,12 @@ mod vcs;
|
|
|
extern crate chrono;
|
|
|
|
|
|
use actix_web::middleware::Logger;
|
|
|
-use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder};
|
|
|
+use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
|
|
|
use fern;
|
|
|
-use log::error;
|
|
|
-use std::{env, fs, io};
|
|
|
+use std::{env, io};
|
|
|
|
|
|
use articles_repository::{ArticlesRepository, FsRepository};
|
|
|
use config::Configuration;
|
|
|
-use pulldown_cmark::{html, Options, Parser};
|
|
|
use theme::Theme;
|
|
|
|
|
|
#[get("")]
|
|
@@ -22,7 +20,7 @@ async fn show_articles_list() -> impl Responder {
|
|
|
|
|
|
const CONTENT_FOLDER: &str = "./content";
|
|
|
let exe_dir = env::current_dir()
|
|
|
- .and_then(|dir| io::Result::Ok(dir.to_str().unwrap_or("").to_string()))
|
|
|
+ .and_then(|dir| Ok(dir.to_str().unwrap_or("").to_string()))
|
|
|
.unwrap();
|
|
|
log::trace!("Estimated content repository: {exe_dir}/{CONTENT_FOLDER}");
|
|
|
|
|
@@ -36,7 +34,7 @@ async fn show_article(path: web::Path<(String,)>) -> impl Responder {
|
|
|
let p = format!("./content/{}", &path.0);
|
|
|
|
|
|
let exe_dir = env::current_dir()
|
|
|
- .and_then(|dir| io::Result::Ok(dir.to_str().unwrap_or("").to_string()))
|
|
|
+ .and_then(|dir| Ok(dir.to_str().unwrap_or("").to_string()))
|
|
|
.unwrap();
|
|
|
|
|
|
let theme_path = format!("{}/www/themes/default", exe_dir);
|
|
@@ -56,9 +54,9 @@ async fn show_article(path: web::Path<(String,)>) -> impl Responder {
|
|
|
}
|
|
|
|
|
|
#[actix_web::main]
|
|
|
-async fn main() -> std::io::Result<()> {
|
|
|
- if !std::env::vars().any(|(k, _)| k == "RUST_LOG") {
|
|
|
- std::env::set_var("RUST_LOG", "trace");
|
|
|
+async fn main() -> io::Result<()> {
|
|
|
+ if !env::vars().any(|(k, _)| k == "RUST_LOG") {
|
|
|
+ env::set_var("RUST_LOG", "trace");
|
|
|
}
|
|
|
|
|
|
let config = Configuration::default();
|
|
@@ -74,7 +72,7 @@ async fn main() -> std::io::Result<()> {
|
|
|
))
|
|
|
})
|
|
|
.level(log::LevelFilter::Info)
|
|
|
- .chain(std::io::stdout())
|
|
|
+ .chain(io::stdout())
|
|
|
.apply();
|
|
|
|
|
|
HttpServer::new(|| {
|
|
@@ -85,10 +83,7 @@ async fn main() -> std::io::Result<()> {
|
|
|
"/images",
|
|
|
"./www/themes/default/images",
|
|
|
))
|
|
|
- .service(actix_files::Files::new(
|
|
|
- "/js",
|
|
|
- "./www/themes/default/js",
|
|
|
- ))
|
|
|
+ .service(actix_files::Files::new("/js", "./www/themes/default/js"))
|
|
|
.service(
|
|
|
web::scope("/a")
|
|
|
.service(show_article)
|