Compare commits
4 Commits
38851af678
...
6db54b237a
Author | SHA1 | Date |
---|---|---|
Anna | 6db54b237a | |
Anna | 4483b380d8 | |
Anna | f915e5d51f | |
Anna | d4c5eca2d5 |
File diff suppressed because it is too large
Load Diff
|
@ -14,13 +14,14 @@ hex = "0.4"
|
|||
lazy_static = "1"
|
||||
lodestone-scraper = { git = "https://git.anna.lgbt/anna/lodestone-scraper.git" }
|
||||
log = "0.4"
|
||||
mimalloc = "0.1"
|
||||
parking_lot = "0.12"
|
||||
prefixed-api-key = { git = "https://git.anna.lgbt/anna/prefixed-api-key.git" }
|
||||
rand = "0.8"
|
||||
regex = "1"
|
||||
reqwest = { version = "0.11", default-features = false }
|
||||
reqwest = { version = "0.12", default-features = false }
|
||||
rmp-serde = "1"
|
||||
rustyline = { version = "13", default-features = false }
|
||||
rustyline = { version = "14", default-features = false }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_bytes = "0.11"
|
||||
serde_repr = "0.1"
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::util::send;
|
|||
|
||||
pub async fn disband(state: Arc<RwLock<State>>, client_state: Arc<RwLock<ClientState>>, conn: &mut WsStream, number: u32, req: DisbandRequest) -> Result<()> {
|
||||
match client_state.read().await.get_rank(req.channel, &state).await? {
|
||||
Some(rank) if rank == Rank::Admin => {}
|
||||
Some(Rank::Admin) => {}
|
||||
_ => return send(conn, number, ErrorResponse::new(req.channel, "not in channel/not enough permissions")).await,
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ pub async fn register(state: Arc<RwLock<State>>, _client_state: Arc<RwLock<Clien
|
|||
None | Some(_) if generate => {
|
||||
let mut rand_bytes = [0; 32];
|
||||
rand::thread_rng().fill_bytes(&mut rand_bytes);
|
||||
let challenge = hex::encode(&rand_bytes);
|
||||
let challenge = hex::encode(rand_bytes);
|
||||
|
||||
sqlx::query!(
|
||||
// language=sqlite
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::util::send;
|
|||
|
||||
pub async fn update(state: Arc<RwLock<State>>, client_state: Arc<RwLock<ClientState>>, conn: &mut WsStream, number: u32, req: UpdateRequest) -> Result<()> {
|
||||
match client_state.read().await.get_rank(req.channel, &state).await? {
|
||||
Some(rank) if rank == Rank::Admin => {}
|
||||
Some(Rank::Admin) => {}
|
||||
_ => return send(conn, number, ErrorResponse::new(req.channel, "not in that channel")).await,
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ pub mod updater;
|
|||
pub mod logging;
|
||||
pub mod influx;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
pub type WsStream = WebSocketStream<TcpStream>;
|
||||
|
||||
pub struct State {
|
||||
|
@ -174,7 +177,7 @@ async fn main() -> Result<()> {
|
|||
quit_tx.blocking_send(()).ok();
|
||||
return;
|
||||
}
|
||||
"announce" => {
|
||||
"announce" | "say" => {
|
||||
if command.len() == 2 {
|
||||
let msg = command[1].to_string();
|
||||
announce_tx.blocking_send(msg).ok();
|
||||
|
|
|
@ -32,7 +32,7 @@ pub fn spawn(state: Arc<RwLock<State>>, mut rx: UnboundedReceiver<i64>) -> JoinH
|
|||
tokio::time::sleep(left).await;
|
||||
}
|
||||
|
||||
match update(&*state, &lodestone, id).await {
|
||||
match update(&state, &lodestone, id).await {
|
||||
Ok(()) => debug!("updated user {}", id),
|
||||
Err(e) => error!("error updating user {}: {:?}", id, e),
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ async fn update(state: &RwLock<State>, lodestone: &LodestoneScraper, lodestone_i
|
|||
if let Some(user) = client_state {
|
||||
trace!(" [updater] before user write");
|
||||
if let Some(user) = user.write().await.user.as_mut() {
|
||||
user.name = info.name.clone();
|
||||
user.name = info.name;
|
||||
user.world = info.world;
|
||||
}
|
||||
trace!(" [updater] after user write");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue