cargo fix

This commit is contained in:
emilis 2026-02-17 23:27:12 +00:00
parent 0fd0f8f5c9
commit 6850da7555
No known key found for this signature in database
23 changed files with 47 additions and 97 deletions

View File

@ -24,7 +24,6 @@ use proc_macro2::Span;
use quote::{ToTokens, quote}; use quote::{ToTokens, quote};
use syn::{parse::Parse, parse_macro_input}; use syn::{parse::Parse, parse_macro_input};
use crate::ref_and_mut::RefAndMut;
mod all; mod all;
mod checks; mod checks;

View File

@ -13,7 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{ use core::{
fmt::Display,
num::NonZeroU8, num::NonZeroU8,
ops::{Deref, Not}, ops::{Deref, Not},
}; };
@ -30,7 +29,7 @@ use crate::{
message::{CharacterIdentity, Identification, PublicIdentity, night::ActionPrompt}, message::{CharacterIdentity, Identification, PublicIdentity, night::ActionPrompt},
player::{PlayerId, RoleChange}, player::{PlayerId, RoleChange},
role::{ role::{
Alignment, HunterMut, HunterRef, Killer, KillingWolfOrder, MAPLE_WOLF_ABSTAIN_LIMIT, Alignment, Killer, KillingWolfOrder, MAPLE_WOLF_ABSTAIN_LIMIT,
Powerful, PreviousGuardianAction, Role, RoleTitle, Powerful, PreviousGuardianAction, Role, RoleTitle,
}, },
team::Team, team::Team,

View File

@ -236,7 +236,7 @@ impl axum::response::IntoResponse for ServerError {
fn into_response(self) -> axum::response::Response { fn into_response(self) -> axum::response::Response {
use axum::{Json, http::StatusCode}; use axum::{Json, http::StatusCode};
use crate::cbor::Cbor;
( (
match self { match self {

View File

@ -29,13 +29,12 @@ use crate::{
error::GameError, error::GameError,
game::{ game::{
GameTime, Village, GameTime, Village,
kill::{self, KillOutcome},
night::changes::{ChangesLookup, NightChange}, night::changes::{ChangesLookup, NightChange},
}, },
message::{ message::{
dead::{DeadChat, DeadChatMessage}, dead::DeadChat,
night::{ night::{
ActionPrompt, ActionPromptTitle, ActionResponse, ActionResult, ActionType, Visits, ActionPrompt, ActionPromptTitle, ActionResponse, ActionResult, Visits,
}, },
}, },
role::RoleTitle, role::RoleTitle,

View File

@ -12,7 +12,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{num::NonZeroU8, ops::Not}; use core::ops::Not;
use super::Result; use super::Result;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@ -15,17 +15,14 @@
use core::num::NonZeroU8; use core::num::NonZeroU8;
use crate::{ use crate::{
aura::{Aura, AuraTitle}, aura::Aura,
bag::DrunkRoll, bag::DrunkRoll,
diedto::DiedTo, diedto::DiedTo,
error::GameError, error::GameError,
game::night::{ game::night::{
ActionComplete, CurrentResult, Night, NightState, ResponseOutcome, changes::NightChange, ActionComplete, CurrentResult, Night, NightState, ResponseOutcome, changes::NightChange,
}, },
message::{ message::night::{ActionPrompt, ActionResponse, ActionResult},
CharacterIdentity,
night::{ActionPrompt, ActionResponse, ActionResult, ActionType},
},
player::Protection, player::Protection,
role::{ role::{
Alignment, AlignmentEq, Killer, Powerful, PreviousGuardianAction, RoleBlock, RoleTitle, Alignment, AlignmentEq, Killer, Powerful, PreviousGuardianAction, RoleBlock, RoleTitle,

View File

@ -15,7 +15,7 @@
use core::{num::NonZeroU8, ops::Not}; use core::{num::NonZeroU8, ops::Not};
use crate::{ use crate::{
aura::{Aura, AuraTitle}, aura::Aura,
diedto::DiedTo, diedto::DiedTo,
error::GameError, error::GameError,
game::{ game::{

View File

@ -1,6 +1,6 @@
use std::{ use std::{
fs::File, fs::File,
io::{Read, Write}, io::Write,
}; };
const STYLESHEET_PATH: &str = "../style/faction.scss"; const STYLESHEET_PATH: &str = "../style/faction.scss";

View File

@ -20,7 +20,7 @@ use leptos_router::{
components::{ProtectedRoute, Route, Router, Routes}, components::{ProtectedRoute, Route, Router, Routes},
path, path,
}; };
use leptos_use::storage::{UseStorageOptions, use_local_storage, use_local_storage_with_options}; use leptos_use::storage::use_local_storage;
use reactive_stores::Store; use reactive_stores::Store;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -29,8 +29,8 @@ use crate::{
components::Nav, components::Nav,
pages::{GamePage, Main, NotFound, Signin, Signup, UserSettings}, pages::{GamePage, Main, NotFound, Signin, Signup, UserSettings},
storage::{ storage::{
LocalStorage, SessionStorage, Stored, Stored,
user::{AuthContext, AuthContextStoreFields, PasswordlessUser, UserSession, UserToken}, user::{AuthContext, AuthContextStoreFields},
}, },
}, },
state::{InitOrUpdateStore, SessionState}, state::{InitOrUpdateStore, SessionState},

View File

@ -2,23 +2,19 @@ pub mod big;
mod host; mod host;
mod player; mod player;
use codee::{HybridEncoder, binary::MsgpackSerdeCodec}; use codee::binary::MsgpackSerdeCodec;
use leptos::prelude::*; use leptos::prelude::*;
use leptos_router::hooks; use leptos_router::hooks;
use leptos_use::{ use leptos_use::{
ReconnectLimit, UseEventSourceOptions, UseEventSourceReturn, UseWebSocketOptions, ReconnectLimit, UseWebSocketOptions,
UseWebSocketReturn, core::ConnectionReadyState, use_event_source, UseWebSocketReturn, core::ConnectionReadyState, use_websocket_with_options,
use_event_source_with_options, use_websocket, use_websocket_with_options,
}; };
use reactive_stores::Store; use reactive_stores::Store;
use werewolves_proto::message::{ use werewolves_proto::message::{
ClientMessage, ClientMessage,
host::{HostMessage, ServerToHostMessage}, host::HostMessage,
};
use werewolves_proto::{
cbor_leptos::CborEncoding,
message::{IntoClientResponse, WrappedServerMessage},
}; };
use werewolves_proto::message::{IntoClientResponse, WrappedServerMessage};
use crate::{ use crate::{
ConsoleLogError, ConsoleLogError,

View File

@ -1,8 +1,5 @@
use leptos::{ev::MouseEvent, prelude::*}; use leptos::prelude::*;
use werewolves_proto::{ use werewolves_proto::message::{Identification, PlayerState};
message::{Identification, PlayerState, PublicIdentity},
player::PlayerId,
};
use crate::app::components::{Equals, IdentificationInline, Sample, TutorialBox}; use crate::app::components::{Equals, IdentificationInline, Sample, TutorialBox};

View File

@ -1,13 +1,13 @@
use core::ops::Not; use core::ops::Not;
use std::{collections::HashMap, sync::Arc}; use std::collections::HashMap;
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use leptos::{ev::MouseEvent, prelude::*}; use leptos::{ev::MouseEvent, prelude::*};
use werewolves_proto::{ use werewolves_proto::{
aura::AuraTitle, aura::AuraTitle,
game::{Category, GameSettings, SetupSlot}, game::{Category, GameSettings, SetupSlot},
message::{PlayerState, host::HostMessage}, message::PlayerState,
role::{Role, RoleTitle}, role::RoleTitle,
}; };
use crate::app::{ use crate::app::{

View File

@ -2,19 +2,16 @@ werewolves_macros::include_path!("werewolves/src/app/pages/game/player");
use core::{ use core::{
hash::Hash, hash::Hash,
num::{self, NonZeroU8}, num::NonZeroU8,
ops::{Deref, Not}, ops::Deref,
}; };
use std::collections::HashSet; use std::collections::HashSet;
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use leptos::{ use leptos::prelude::*;
ev::{Event, MouseEvent, SubmitEvent, Targeted},
prelude::*,
};
use werewolves_proto::{ use werewolves_proto::{
message::{ message::{
ClientDeadChat, ClientMessage, ServerToClientMessage as Srv2Client, UpdateSelf, ClientDeadChat, ClientMessage, ServerToClientMessage as Srv2Client,
dead::DeadChatMessage, dead::DeadChatMessage,
}, },
role::RoleTitle, role::RoleTitle,

View File

@ -3,12 +3,12 @@ use core::ops::Not;
use chrono::Utc; use chrono::Utc;
use gloo::history::History; use gloo::history::History;
use leptos::{ev::MouseEvent, prelude::*}; use leptos::{ev::MouseEvent, prelude::*};
use werewolves_proto::player::{Password, Session, Username}; use werewolves_proto::player::{Password, Username};
use crate::{ use crate::{
app::{ app::{
components::ErrorBox, components::ErrorBox,
storage::user::{AuthContext, PasswordlessUser, UserSession, UserToken}, storage::user::{AuthContext, UserToken},
}, },
auth::Signin, auth::Signin,
}; };

View File

@ -3,25 +3,21 @@ use core::ops::Not;
use chrono::Utc; use chrono::Utc;
use gloo::history::History; use gloo::history::History;
use leptos::{ use leptos::{
ev::{Event, MouseEvent}, ev::MouseEvent,
prelude::*, prelude::*,
}; };
use leptos_meta::*;
use rand::distr::SampleString; use rand::distr::SampleString;
use reactive_stores::Store; use reactive_stores::Store;
use werewolves_proto::{ use werewolves_proto::{
cbor_leptos::CborPost, cbor_leptos::CborPost,
error::ServerError, error::ServerError,
player::{Password, PlayerId, Session, Username}, player::{Password, PlayerId, Username},
}; };
use crate::{ use crate::{
app::{ app::{
components::{ErrorBox, input::TextInput}, components::{ErrorBox, input::TextInput},
storage::{ storage::user::{AuthContext, AuthContextStoreFields, PasswordlessUser, UserToken},
LocalStorage,
user::{AuthContext, AuthContextStoreFields, PasswordlessUser, UserSession, UserToken},
},
}, },
auth::Signin, auth::Signin,
db::AppState, db::AppState,

View File

@ -4,7 +4,7 @@ use core::fmt::Debug;
use gloo::storage::Storage; use gloo::storage::Storage;
use leptos::{ use leptos::{
prelude::{ArcReadSignal, ArcWriteSignal, Effect, Signal, WriteSignal}, prelude::{Signal, WriteSignal},
server::codee::string::JsonSerdeCodec, server::codee::string::JsonSerdeCodec,
}; };
use serde::{Serialize, de::DeserializeOwned}; use serde::{Serialize, de::DeserializeOwned};

View File

@ -1,9 +1,6 @@
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use leptos::{ use leptos::prelude::{Action, Get, Set};
prelude::{Action, ArcRwSignal, Get, GetUntracked, Set}, use reactive_stores::Store;
server::codee::string::JsonSerdeCodec,
};
use reactive_stores::{Field, Patch, Store};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use werewolves_proto::{ use werewolves_proto::{
limited::FixedLenString, limited::FixedLenString,

View File

@ -13,7 +13,7 @@ use werewolves_proto::{
error::{DatabaseError, ServerError}, error::{DatabaseError, ServerError},
limited::FixedLenString, limited::FixedLenString,
player::{Password, ProfileUpdate, Session}, player::{Password, ProfileUpdate, Session},
token::{self, TOKEN_LEN}, token::{self},
}; };
use crate::db::DatabaseResult; use crate::db::DatabaseResult;

View File

@ -9,19 +9,13 @@ mod ssr {
use axum::{ use axum::{
body::Body, body::Body,
extract::{FromRef, State}, extract::State,
http::{HeaderMap, HeaderValue, Request, StatusCode, Uri, header}, http::{Request, Uri, header},
response::{IntoResponse, Response}, response::{IntoResponse, Response},
}; };
use futures::StreamExt; use futures::StreamExt;
use leptos::{ use leptos::prelude::RenderHtml;
IntoView,
config::LeptosOptions,
prelude::{Render, RenderHtml},
server_fn::codec::IntoRes,
tachys::ssr::StreamBuilder,
};
use leptos_axum::{LeptosRoutes, ResponseOptions};
use werewolves::db::AppState; use werewolves::db::AppState;
pub async fn server_fn_handler( pub async fn server_fn_handler(
@ -38,7 +32,7 @@ mod ssr {
} }
pub async fn handle_http_static( pub async fn handle_http_static(
uri: Uri, _uri: Uri,
state: State<AppState>, state: State<AppState>,
req: Request<Body>, req: Request<Body>,
) -> Response { ) -> Response {

View File

@ -14,20 +14,18 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{net::SocketAddr, str::FromStr}; use core::{net::SocketAddr, str::FromStr};
use anyhow::anyhow;
use axum::{ use axum::{
extract::{ConnectInfo, Path, State, WebSocketUpgrade, ws::WebSocket}, extract::{ConnectInfo, Path, State, WebSocketUpgrade},
response::Response, response::Response,
}; };
use axum_extra::{ use axum_extra::{
TypedHeader, TypedHeader,
headers::{self, Authorization, authorization::Bearer}, headers::{self},
}; };
use codee::{Decoder, HybridDecoder, HybridEncoder}; use codee::HybridDecoder;
use colored::Colorize; use colored::Colorize;
use futures::FutureExt; use futures::FutureExt;
use uuid::Uuid; use uuid::Uuid;
use werewolves_proto::{error::GameError, message::ServerToClientMessage};
use werewolves_proto::{ use werewolves_proto::{
error::ServerError, game::GameId, message::WrappedServerMessage, token::TokenString, error::ServerError, game::GameId, message::WrappedServerMessage, token::TokenString,
}; };

View File

@ -11,7 +11,6 @@ pub mod runner;
use core::{ use core::{
fmt::Display, fmt::Display,
hash::BuildHasherDefault, hash::BuildHasherDefault,
sync::atomic::{AtomicUsize, Ordering},
}; };
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
@ -24,7 +23,7 @@ use axum_extra::headers;
use colored::Colorize; use colored::Colorize;
use tokio::{ use tokio::{
sync::{ sync::{
Mutex, RwLock, RwLock,
broadcast::{self, Receiver, Sender}, broadcast::{self, Receiver, Sender},
mpsc::{self, UnboundedSender}, mpsc::{self, UnboundedSender},
}, },

View File

@ -12,29 +12,15 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{net::SocketAddr, time::Duration}; use core::time::Duration;
use std::sync::Arc;
use anyhow::anyhow; use anyhow::anyhow;
use axum::{ use axum::extract::ws::{self, Message, WebSocket};
extract::{
ConnectInfo, Path, State, WebSocketUpgrade,
ws::{self, Message, WebSocket},
},
response::Response,
};
use axum_extra::{
TypedHeader,
headers::{Authorization, authorization::Bearer},
};
use chrono::Utc; use chrono::Utc;
use codee::{HybridDecoder, HybridEncoder}; use codee::{HybridDecoder, HybridEncoder};
use colored::Colorize;
use tokio::sync::{broadcast::Receiver, mpsc::UnboundedSender}; use tokio::sync::{broadcast::Receiver, mpsc::UnboundedSender};
use werewolves_proto::{ use werewolves_proto::{
LogError, LogError,
error::ServerError,
game::GameId,
loc, loc,
message::{IntoClientResponse, WrappedServerMessage}, message::{IntoClientResponse, WrappedServerMessage},
}; };
@ -45,10 +31,7 @@ use werewolves_proto::{
use crate::{ use crate::{
db::{Database, user::User}, db::{Database, user::User},
server::{ server::runner::{ClientUpdate, IdentifiedClientMessage},
XForwardedFor,
runner::{ClientUpdate, HostOrClientMessage, IdentifiedClientMessage},
},
}; };
pub async fn player_handler( pub async fn player_handler(

View File

@ -4,7 +4,6 @@ use axum::{
response::IntoResponse, response::IntoResponse,
}; };
use fast_qr::convert::{Builder, Shape, svg::SvgBuilder}; use fast_qr::convert::{Builder, Shape, svg::SvgBuilder};
use tower_http::normalize_path::NormalizePath;
const DEFAULT_BASE_URL: &str = "https://wolf.emilis.dev/"; const DEFAULT_BASE_URL: &str = "https://wolf.emilis.dev/";
pub const BASE_URL: &str = const { pub const BASE_URL: &str = const {