update deps and make everything work again

This commit is contained in:
Adam 2025-02-16 00:01:38 -05:00
parent 320bf27ae9
commit caf33ac6df
9 changed files with 418 additions and 290 deletions

View file

@ -1,2 +1,5 @@
[build] [build]
rustflags = ["--cfg", "tokio_unstable"] rustflags = ["--cfg", "tokio_unstable"]
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

680
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,13 +13,14 @@ serde_json = "1"
leptos = { version = "0", features = ["csr", "nightly"] } leptos = { version = "0", features = ["csr", "nightly"] }
leptos_meta = { version = "0" } leptos_meta = { version = "0" }
leptos_router = { version = "0", features = ["nightly"] } leptos_router = { version = "0", features = ["nightly"] }
getrandom = { version = "0.3", features = ["wasm_js"] }
console_error_panic_hook = "0" console_error_panic_hook = "0"
console_log = "1" console_log = "1"
log = "0" log = "0"
# Leptos-use # Leptos-use
leptos-use = { version = "0", features = ["use_media_query"] } leptos-use = { version = "0", features = ["use_media_query"] }
codee = "0" codee = "0.2"
# UI stuff # UI stuff
thaw = { version = "0.4.0-beta", features = ["csr", "nightly"] } thaw = { version = "0.4.0-beta", features = ["csr", "nightly"] }

View file

@ -2,7 +2,7 @@ use crate::card_loader::*;
use crate::User; use crate::User;
use lib::*; use lib::*;
use rand::prelude::IteratorRandom; use rand::prelude::IteratorRandom;
use rand::thread_rng; use rand::rng;
use std::{ use std::{
collections::HashMap, collections::HashMap,
sync::{Arc, RwLock}, sync::{Arc, RwLock},
@ -114,7 +114,7 @@ impl Game {
// Draw first black card // Draw first black card
let current_black = black.swap_remove( let current_black = black.swap_remove(
(0..black.len()) (0..black.len())
.choose(&mut thread_rng()) .choose(&mut rng())
.expect("No black cards to draw from!"), .expect("No black cards to draw from!"),
); );
@ -289,7 +289,7 @@ impl Game {
fn draw_one_black(&mut self) -> Option<Arc<CardBlackWithID>> { fn draw_one_black(&mut self) -> Option<Arc<CardBlackWithID>> {
let deck = &mut self.black; let deck = &mut self.black;
if let Some(index) = (0..deck.len()).choose(&mut thread_rng()) { if let Some(index) = (0..deck.len()).choose(&mut rng()) {
Some(deck.swap_remove(index)) Some(deck.swap_remove(index))
} else { } else {
tracing::error!("Tried to draw white card that doesn't exist!"); tracing::error!("Tried to draw white card that doesn't exist!");
@ -301,7 +301,7 @@ impl Game {
fn draw_one_white(&mut self) -> Option<Arc<CardWhiteWithID>> { fn draw_one_white(&mut self) -> Option<Arc<CardWhiteWithID>> {
let deck = &mut self.white; let deck = &mut self.white;
if let Some(index) = (0..deck.len()).choose(&mut thread_rng()) { if let Some(index) = (0..deck.len()).choose(&mut rng()) {
Some(deck.swap_remove(index)) Some(deck.swap_remove(index))
} else { } else {
tracing::error!("Tried to draw white card that doesn't exist!"); tracing::error!("Tried to draw white card that doesn't exist!");

View file

@ -156,7 +156,7 @@ impl IncomingMessageHandler {
} }
/// This runs when a connection closes /// This runs when a connection closes
async fn handle_close(&self, close_frame: Option<CloseFrame<'static>>, addr: SocketAddr) { async fn handle_close(&self, close_frame: Option<CloseFrame>, addr: SocketAddr) {
// Process close frame // Process close frame
if let Some(cf) = close_frame { if let Some(cf) = close_frame {
tracing::info!( tracing::info!(

View file

@ -133,7 +133,7 @@ async fn main() -> Result<()> {
// Router // Router
let app = Router::new() let app = Router::new()
.route("/websocket", get(websocket_connection_handler)) .route("/websocket", get(websocket_connection_handler))
.nest_service("/", ServeDir::new("dist")) .fallback_service(ServeDir::new("dist"))
.layer(ServiceBuilder::new().layer(CompressionLayer::new())) .layer(ServiceBuilder::new().layer(CompressionLayer::new()))
.layer(GovernorLayer { .layer(GovernorLayer {
config: governor_conf, config: governor_conf,

View file

@ -1,5 +1,5 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use rand::prelude::SliceRandom; use rand::prelude::IndexedRandom;
use std::{ use std::{
collections::HashSet, collections::HashSet,
fs::File, fs::File,
@ -40,8 +40,8 @@ impl NameGenerator {
loop { loop {
name = format!( name = format!(
"{} {}", "{} {}",
self.first_names.choose(&mut rand::thread_rng()).unwrap(), self.first_names.choose(&mut rand::rng()).unwrap(),
self.last_names.choose(&mut rand::thread_rng()).unwrap(), self.last_names.choose(&mut rand::rng()).unwrap(),
); );
if !reserved_names.contains(&name) { if !reserved_names.contains(&name) {

View file

@ -35,7 +35,7 @@ impl OutgoingMessageHandler {
} }
fn serialize<T: Serialize>(&self, message: T) -> Message { fn serialize<T: Serialize>(&self, message: T) -> Message {
let msg = Message::Text(to_string::<T>(&message).unwrap()); let msg = Message::Text(to_string::<T>(&message).unwrap().into());
return msg; return msg;
} }
pub fn to_user<T: Serialize>(_channel: tokio::sync::mpsc::Sender<Message>, _message: T) { pub fn to_user<T: Serialize>(_channel: tokio::sync::mpsc::Sender<Message>, _message: T) {

View file

@ -29,7 +29,7 @@ fn spam_games() {
game_name: "ligma".to_string(), game_name: "ligma".to_string(),
game_packs: packs.clone(), game_packs: packs.clone(),
}) })
.unwrap(), .unwrap().into(),
)) ))
.unwrap(); .unwrap();
} }