chore: cargo fmt across workspace; add analytics domain to CSP
Build and Deploy / build-and-push (push) Successful in 4m46s
Build and Deploy / build-and-push (push) Successful in 4m46s
- Apply cargo fmt to solitaire_engine, solitaire_server formatting. - solitaire_server/src/lib.rs: add https://analytics.aleshym.co to script-src, img-src, and connect-src so the analytics beacon loads without a CSP violation. - docs and README updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -249,11 +249,11 @@ fn build_router_inner(state: AppState, rate_limit: bool) -> Router {
|
||||
|
||||
const CSP: &str = concat!(
|
||||
"default-src 'self'; ",
|
||||
"script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'; ",
|
||||
"script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' https://analytics.aleshym.co; ",
|
||||
"style-src 'self' 'unsafe-inline'; ",
|
||||
"font-src 'self'; ",
|
||||
"img-src 'self' data:; ",
|
||||
"connect-src 'self'; ",
|
||||
"img-src 'self' data: https://analytics.aleshym.co; ",
|
||||
"connect-src 'self' https://analytics.aleshym.co; ",
|
||||
"object-src 'none'; ",
|
||||
"frame-ancestors 'none'",
|
||||
);
|
||||
|
||||
@@ -196,14 +196,11 @@ async fn update_leaderboard_if_opted_in(
|
||||
user_id: &str,
|
||||
payload: &SyncPayload,
|
||||
) -> Result<(), AppError> {
|
||||
let opted_in = sqlx::query!(
|
||||
"SELECT leaderboard_opt_in FROM users WHERE id = ?",
|
||||
user_id
|
||||
)
|
||||
.fetch_optional(pool)
|
||||
.await?
|
||||
.map(|r| r.leaderboard_opt_in)
|
||||
.unwrap_or(0);
|
||||
let opted_in = sqlx::query!("SELECT leaderboard_opt_in FROM users WHERE id = ?", user_id)
|
||||
.fetch_optional(pool)
|
||||
.await?
|
||||
.map(|r| r.leaderboard_opt_in)
|
||||
.unwrap_or(0);
|
||||
|
||||
if opted_in != 1 {
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user