2025-03-15 11:03:35 -04:00
|
|
|
mod account_json;
|
|
|
|
|
pub use account_json::{AccountProvider, AccountInfo};
|
|
|
|
|
|
|
|
|
|
mod garage_data;
|
|
|
|
|
pub use garage_data::SelectedGarage;
|
|
|
|
|
|
|
|
|
|
mod initial_data;
|
|
|
|
|
pub use initial_data::setup_directory;
|
|
|
|
|
|
|
|
|
|
mod inventory;
|
|
|
|
|
pub use inventory::UnlockedParts;
|
|
|
|
|
|
|
|
|
|
mod traits;
|
2025-04-01 19:38:03 -04:00
|
|
|
pub use traits::{UserProvider, User, UserToken, UserSlots, UserSlotData, VehicleData, UserInfo, UserLoginInfo, ExtraUserInfo, UserAuthenticator};
|
|
|
|
|
|
|
|
|
|
pub const TOKEN_SECRET_FILENAME: &str = "token_secret.key";
|
2025-03-15 11:03:35 -04:00
|
|
|
|
|
|
|
|
pub const USERS_DIR: &str = "accounts";
|
|
|
|
|
pub const USER_FILE: &str = "user.json";
|
|
|
|
|
pub const GARAGE_DIR: &str = "vehicles";
|
|
|
|
|
|
|
|
|
|
pub type UserImpl = AccountProvider;
|
|
|
|
|
|
|
|
|
|
fn __must_impl<T: UserProvider<()>>() {}
|
|
|
|
|
|
|
|
|
|
fn __test_impl() {
|
|
|
|
|
__must_impl::<UserImpl>();
|
|
|
|
|
}
|
2025-03-15 17:21:18 -04:00
|
|
|
|
|
|
|
|
pub fn since_windows_epoch(since_unix_epoch: i64) -> i64 {
|
|
|
|
|
use chrono::TimeZone;
|
|
|
|
|
let windows_epoch = chrono::Utc.from_utc_datetime(&chrono::NaiveDateTime::parse_from_str("1601-01-01 00:00:00", "%Y-%m-%d %H:%M:%S").unwrap());
|
|
|
|
|
let time_in = chrono::DateTime::<chrono::Utc>::from_timestamp(since_unix_epoch, 0).unwrap();
|
|
|
|
|
//let time_in = chrono::Utc.from_utc_datetime(&chrono::NaiveDateTime::from_timestamp(since_unix_epoch, 0));
|
|
|
|
|
time_in.signed_duration_since(windows_epoch).num_milliseconds() * 10_000
|
|
|
|
|
}
|