update deps and make everything work again
This commit is contained in:
parent
320bf27ae9
commit
caf33ac6df
9 changed files with 418 additions and 290 deletions
|
@ -1,2 +1,5 @@
|
|||
[build]
|
||||
rustflags = ["--cfg", "tokio_unstable"]
|
||||
|
||||
[target.wasm32-unknown-unknown]
|
||||
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
|
||||
|
|
680
Cargo.lock
generated
680
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -13,13 +13,14 @@ serde_json = "1"
|
|||
leptos = { version = "0", features = ["csr", "nightly"] }
|
||||
leptos_meta = { version = "0" }
|
||||
leptos_router = { version = "0", features = ["nightly"] }
|
||||
getrandom = { version = "0.3", features = ["wasm_js"] }
|
||||
console_error_panic_hook = "0"
|
||||
console_log = "1"
|
||||
log = "0"
|
||||
|
||||
# Leptos-use
|
||||
leptos-use = { version = "0", features = ["use_media_query"] }
|
||||
codee = "0"
|
||||
codee = "0.2"
|
||||
|
||||
# UI stuff
|
||||
thaw = { version = "0.4.0-beta", features = ["csr", "nightly"] }
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::card_loader::*;
|
|||
use crate::User;
|
||||
use lib::*;
|
||||
use rand::prelude::IteratorRandom;
|
||||
use rand::thread_rng;
|
||||
use rand::rng;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, RwLock},
|
||||
|
@ -114,7 +114,7 @@ impl Game {
|
|||
// Draw first black card
|
||||
let current_black = black.swap_remove(
|
||||
(0..black.len())
|
||||
.choose(&mut thread_rng())
|
||||
.choose(&mut rng())
|
||||
.expect("No black cards to draw from!"),
|
||||
);
|
||||
|
||||
|
@ -289,7 +289,7 @@ impl Game {
|
|||
fn draw_one_black(&mut self) -> Option<Arc<CardBlackWithID>> {
|
||||
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))
|
||||
} else {
|
||||
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>> {
|
||||
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))
|
||||
} else {
|
||||
tracing::error!("Tried to draw white card that doesn't exist!");
|
||||
|
|
|
@ -156,7 +156,7 @@ impl IncomingMessageHandler {
|
|||
}
|
||||
|
||||
/// 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
|
||||
if let Some(cf) = close_frame {
|
||||
tracing::info!(
|
||||
|
|
|
@ -133,7 +133,7 @@ async fn main() -> Result<()> {
|
|||
// Router
|
||||
let app = Router::new()
|
||||
.route("/websocket", get(websocket_connection_handler))
|
||||
.nest_service("/", ServeDir::new("dist"))
|
||||
.fallback_service(ServeDir::new("dist"))
|
||||
.layer(ServiceBuilder::new().layer(CompressionLayer::new()))
|
||||
.layer(GovernorLayer {
|
||||
config: governor_conf,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::{Context, Result};
|
||||
use rand::prelude::SliceRandom;
|
||||
use rand::prelude::IndexedRandom;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
fs::File,
|
||||
|
@ -40,8 +40,8 @@ impl NameGenerator {
|
|||
loop {
|
||||
name = format!(
|
||||
"{} {}",
|
||||
self.first_names.choose(&mut rand::thread_rng()).unwrap(),
|
||||
self.last_names.choose(&mut rand::thread_rng()).unwrap(),
|
||||
self.first_names.choose(&mut rand::rng()).unwrap(),
|
||||
self.last_names.choose(&mut rand::rng()).unwrap(),
|
||||
);
|
||||
|
||||
if !reserved_names.contains(&name) {
|
||||
|
|
|
@ -35,7 +35,7 @@ impl OutgoingMessageHandler {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
pub fn to_user<T: Serialize>(_channel: tokio::sync::mpsc::Sender<Message>, _message: T) {
|
||||
|
|
|
@ -29,7 +29,7 @@ fn spam_games() {
|
|||
game_name: "ligma".to_string(),
|
||||
game_packs: packs.clone(),
|
||||
})
|
||||
.unwrap(),
|
||||
.unwrap().into(),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue