Update dependencies, disable registration and improve path handling

This commit is contained in:
Cameron Cordes
2021-02-02 13:57:51 -05:00
parent acad71701e
commit f20a8a5842
5 changed files with 328 additions and 291 deletions

View File

@@ -49,7 +49,7 @@ async fn login(creds: Json<LoginRequest>) -> impl Responder {
if let Some(user) = get_user(&creds.username, &creds.password) {
let claims = Claims {
sub: user.id.to_string(),
exp: (Utc::now() + Duration::days(3)).timestamp(),
exp: (Utc::now() + Duration::days(5)).timestamp(),
};
let token = encode(
&Header::default(),
@@ -287,7 +287,7 @@ async fn create_thumbnails() {
.map(|entry| (image::open(entry.path()), entry.path().to_path_buf()))
.filter(|(img, _)| img.is_ok())
.map(|(img, path)| (img.unwrap(), path))
.map(|(image, path)| (image.thumbnail(200, 200), path))
.map(|(image, path)| (image.thumbnail(200, u32::MAX), path))
.map(|(image, path)| {
let relative_path = &path.strip_prefix(&images).unwrap();
let thumb_path = Path::new(thumbnail_directory).join(relative_path);
@@ -332,7 +332,6 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(register)
.service(login)
.service(list_photos)
.service(get_image)