don't bother trying to make app name configurable actually

This commit is contained in:
xenofem 2022-04-27 00:44:35 -04:00
parent b84cb24ab9
commit c41430bcdc
2 changed files with 3 additions and 5 deletions

View file

@ -13,6 +13,8 @@ use actix_web::{
use actix_web_actors::ws; use actix_web_actors::ws;
use time::OffsetDateTime; use time::OffsetDateTime;
const APP_NAME: &'static str = "transbeam";
pub struct UploadedFile { pub struct UploadedFile {
name: String, name: String,
size: usize, size: usize,
@ -43,10 +45,6 @@ fn storage_dir() -> PathBuf {
PathBuf::from(std::env::var("STORAGE_DIR").unwrap_or_else(|_| String::from("storage"))) PathBuf::from(std::env::var("STORAGE_DIR").unwrap_or_else(|_| String::from("storage")))
} }
fn app_name() -> String {
std::env::var("APP_NAME").unwrap_or_else(|_| String::from("transbeam"))
}
#[get("/upload")] #[get("/upload")]
async fn upload_socket( async fn upload_socket(
req: HttpRequest, req: HttpRequest,

View file

@ -167,7 +167,7 @@ impl Uploader {
let writer = super::zip::ZipGenerator::new(files, Box::new(writer)); let writer = super::zip::ZipGenerator::new(files, Box::new(writer));
let size = writer.total_size(); let size = writer.total_size();
self.writer = Some(Box::new(writer)); self.writer = Some(Box::new(writer));
let download_filename = super::app_name() let download_filename = super::APP_NAME.to_owned()
+ &now.format(FILENAME_DATE_FORMAT)? + &now.format(FILENAME_DATE_FORMAT)?
+ ".zip"; + ".zip";
let modtime = now; let modtime = now;