feat: support tmp token

This commit is contained in:
2022-03-15 18:24:31 +08:00
parent e4fbbb1b7b
commit d9aec4d613
5 changed files with 82 additions and 24 deletions

15
src/api/systemlog.rs Normal file
View File

@@ -0,0 +1,15 @@
use crate::api::{CurrentUser, API};
use crate::random_hasher::RandomHasher;
use chrono::SubsecRound;
use rocket::serde::json::{json, Value};
use rocket::State;
#[get("/systemlog")]
pub fn get_systemlog(user: CurrentUser, rh: &State<RandomHasher>) -> API<Value> {
Ok(json!({
"tmp_token": rh.get_tmp_token(),
"salt": look!(rh.salt),
"start_time": rh.start_time.round_subsecs(0),
"custom_title": user.custom_title,
}))
}