fixes to make it build again

master
Ondřej Hruška 4 years ago
parent 827d4d4044
commit 0d626ea092
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 1423
      Cargo.lock
  2. 29
      Cargo.toml
  3. 5
      src/main.rs
  4. 10
      src/session.rs
  5. 4
      src/store/mod.rs
  6. 1
      templates/index.html.tera

1423
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -9,22 +9,23 @@ edition = "2018"
[dependencies]
#rocket-download-response = "0.4.9"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version="1.0", features= ["preserve_order"] }
serde_yaml = "0.8.11"
json_dotpath = "0.1.2"
titlecase = "0.10.0"
rand = "0.7.2"
serde = { version = "1", features = ["derive"] }
serde_json = { version="1", features= ["preserve_order"] }
serde_yaml = "0.8.16"
json_dotpath = "1.0.3"
titlecase = "1.1.0"
rand = "0.8.3"
rocket_session = "0.1.1"
rocket_session = "0.2"
#rocket_session = { path = "../rocket-session" }
# special data structure that preserves order
indexmap = { version="1.3.0", features=["serde-1"] }
indexmap = { version="1.6.1", features=["serde-1"] }
rocket = { version="0.4.2", default-features = false}
rocket_contrib = { version="0.4.2", features = ["json", "serve", "tera_templates"]}
rocket = { version="0.4.6", default-features = false}
rocket_contrib = { version="0.4.6", features = ["json", "serve", "tera_templates"]}
ifmt = "0.2.0"
parking_lot = "0.10.0"
lazy_static = "1.4.0"
linked-hash-map = "0.5.2"
ifmt = "0.3"
parking_lot = "0.11"
lazy_static = "1.4"
linked-hash-map = "0.5"

@ -25,14 +25,11 @@ use crate::store::form::{
use crate::store::Store;
use parking_lot::RwLock;
//use crate::session::Session;
use rocket::request::Form;
use rocket::response::Redirect;
use rocket::State;
use std::env;
use std::time::Duration;
use crate::session::SessionAccess;
//use crate::session::SessionAccess;
#[derive(Serialize, Debug)]
pub struct ListContext<'a> {
@ -193,7 +190,7 @@ fn main() {
rocket::ignite()
.attach(Template::fairing())
.attach(Session::fairing(Duration::from_secs(3600)))
.attach(Session::fairing())
.manage(RwLock::new(store))
.mount("/", StaticFiles::from(cwd.join("templates/static/")))
.mount(

@ -25,7 +25,7 @@ pub trait SessionAccess {
impl<'a> SessionAccess for Session<'a> {
fn get<T: DeserializeOwned>(&self, path: &str) -> Option<T> {
self.tap(|data| data.dot_get(path))
self.tap(|data| data.dot_get(path).unwrap_or_default())
}
fn get_or<T: DeserializeOwned>(&self, path: &str, def: T) -> T {
@ -41,19 +41,19 @@ impl<'a> SessionAccess for Session<'a> {
}
fn take<T: DeserializeOwned>(&self, path: &str) -> Option<T> {
self.tap(|data| data.dot_take(path))
self.tap(|data| data.dot_take(path).unwrap_or_default())
}
fn replace<O: DeserializeOwned, N: Serialize>(&self, path: &str, new: N) -> Option<O> {
self.tap(|data| data.dot_replace(path, new))
self.tap(|data| data.dot_replace(path, new).unwrap_or_default())
}
fn set<T: Serialize>(&self, path: &str, value: T) {
self.tap(|data| data.dot_set(path, value));
self.tap(|data| data.dot_set(path, value)).unwrap();
}
fn remove(&self, path: &str) -> bool {
self.tap(|data| data.dot_remove(path))
self.tap(|data| { data.dot_remove(path).is_ok() })
}
}

@ -165,7 +165,7 @@ impl Store {
let group = index.free_enums.get_mut(group.as_str()).unwrap();
if let Some(value) = card.dot_get::<String>(&key) {
if let Some(value) = card.dot_get::<String>(&key).unwrap_or_default() {
if !value.is_empty() {
group.insert(value.to_string());
}
@ -179,7 +179,7 @@ impl Store {
let group = index.free_tags.get_mut(group.as_str()).unwrap();
group.extend(card.dot_get_or_default::<Vec<String>>(&key));
group.extend(card.dot_get_or_default::<Vec<String>>(&key).unwrap());
}
}

@ -11,7 +11,6 @@
{%- endblock %}
{% block content -%}
COUNT {{count}}
<table class="cards-table">
<thead>

Loading…
Cancel
Save