Updating game data to mid season patch and made card gallery nicer

This commit is contained in:
2026-07-17 09:42:50 -04:00
parent 7b0f2ce1a5
commit 5aff9910c1
709 changed files with 1485 additions and 547 deletions
+138
View File
@@ -0,0 +1,138 @@
import os
import re
import requests
import time
from concurrent.futures import ThreadPoolExecutor
# Configuration
DOCS_DIR = r"..\chrono.docs"
CLOUD_CARDS_DIR = r"Cloud\wwwroot\cards"
STANDALONE_CARDS_DIR = r"Standalone\wwwroot\cards"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
def get_card_names():
card_names = []
# Search for all .md files in chrono.docs
for root, dirs, files in os.walk(DOCS_DIR):
for file in files:
if file.endswith(".md"):
# Remove .md extension
card_names.append(file[:-3])
return card_names
def slugify(card_name):
# Manual overrides for slugs that don't follow the standard pattern
overrides = {
"APEX Starcruise": "apex-starcruiser",
"Consummate Conspirator": "consomme-conspirator",
"Librarian's Assistant": "librarian-assistant",
"Violet Inquisitioner": "violet-inquisitor",
"Breakdown": "break-down",
"Da'Kad, Heretic Crusher": "da-kad-heretic-crusher",
"Shae'Fan, Remembered": "shae-fan-remembered",
"Possessed Prawn": "possessed-prawn-card",
"P.O.G.O": "p-o-g-o",
"A'kon, Starry Diviner": "a-kon-starry-diviner",
"B.O.O.F.": "b-o-o-f",
"Raiz, Pacifist's Conclusion": "raiz-pacifists-conclusion",
"Spirit's Lament": "spirits-lament",
"Overmind's Guilt": "overminds-guilt",
"Entropy's End": "entropys-end",
"Vorkon, Eternal Source": "vor-kon-eternal-source",
"Ta'kan the Tattle": "ta-kan-the-tattle",
}
# Fix potential encoding issues in card_name (e.g. smart quotes)
# If the script is run in an environment where the filenames were read as mangled
# we want to ensure we use the correct name for the filename and slug lookup.
# Note: '’' is the UTF-8 bytes for '' interpreted as Windows-1252
if isinstance(card_name, str):
card_name = card_name.replace("’", "'").replace("", "'")
if card_name in overrides:
return overrides[card_name]
# Convert to lowercase, replace spaces/special chars with hyphens
slug = card_name.lower()
slug = re.sub(r'[^a-z0-9]+', '-', slug)
slug = slug.strip('-')
return slug
def download_full_art(card_name):
# Fix potential encoding issues in card_name (e.g. smart quotes)
if isinstance(card_name, str):
card_name = card_name.replace("’", "'").replace("", "'")
slug = slugify(card_name)
url = f"https://www.playchrono.com/card/{slug}"
print(f"Processing {card_name} ({url})...")
try:
response = requests.get(url, headers={"User-Agent": USER_AGENT}, timeout=10)
if response.status_code != 200:
print(f" [ERROR] Failed to fetch page for {card_name}: {response.status_code}")
return
# Look for all data-lightbox-src and data-lightbox-alt pairs
# We want the ones that end with "Full Art" and match our card name
pattern = r'data-lightbox-src="([^"]+)"\s+data-lightbox-alt="([^"]+)"'
matches = re.findall(pattern, response.text)
full_art_url = None
for src, alt in matches:
if "Full Art" in alt and (card_name.lower() in alt.lower()):
full_art_url = src
break
# Fallback to the first "Full Art" if no exact match (sometimes names might slightly differ)
if not full_art_url:
for src, alt in matches:
if "Full Art" in alt:
full_art_url = src
break
# Absolute fallback to any data-lightbox-src with the pattern if still nothing
if not full_art_url:
match = re.search(r'data-lightbox-src="(https://cdn\.playchrono\.com/latest/en_us/img/cards/set/1/[^"]+\.png)"', response.text)
if match:
full_art_url = match.group(1)
if not full_art_url:
print(f" [INFO] No full art found for {card_name}")
return
print(f" [FOUND] {full_art_url} for {card_name}")
# Download image
img_response = requests.get(full_art_url, headers={"User-Agent": USER_AGENT}, timeout=10)
if img_response.status_code == 200:
filename = f"fa{card_name}.png"
# Save to Cloud
os.makedirs(CLOUD_CARDS_DIR, exist_ok=True)
with open(os.path.join(CLOUD_CARDS_DIR, filename), "wb") as f:
f.write(img_response.content)
# Save to Standalone
os.makedirs(STANDALONE_CARDS_DIR, exist_ok=True)
with open(os.path.join(STANDALONE_CARDS_DIR, filename), "wb") as f:
f.write(img_response.content)
print(f" [SUCCESS] Saved {filename}")
else:
print(f" [ERROR] Failed to download image for {card_name}: {img_response.status_code}")
except Exception as e:
print(f" [ERROR] Exception for {card_name}: {e}")
def main():
card_names = get_card_names()
print(f"Found {len(card_names)} cards to process.")
# Use ThreadPoolExecutor for faster downloads
with ThreadPoolExecutor(max_workers=5) as executor:
executor.map(download_full_art, card_names)
if __name__ == "__main__":
main()
+1 -2
View File
@@ -1,6 +1,5 @@
using Model;
using Microsoft.EntityFrameworkCore;
using Cloud.Models; using Cloud.Models;
using Microsoft.EntityFrameworkCore;
using Model; using Model;
namespace Cloud; namespace Cloud;
+1 -1
View File
@@ -12,4 +12,4 @@ public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
.Options; .Options;
return new AppDbContext(options); return new AppDbContext(options);
} }
} }
+3 -3
View File
@@ -16,13 +16,13 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MudBlazor" Version="9.6.0" /> <PackageReference Include="MudBlazor" Version="9.6.0"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AdditionalFiles Include="Components\Layout\MainLayout.razor" /> <AdditionalFiles Include="Components\Layout\MainLayout.razor"/>
<AdditionalFiles Include="Components\Layout\NavMenu.razor" /> <AdditionalFiles Include="Components\Layout\NavMenu.razor"/>
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
+1 -2
View File
@@ -1,4 +1,3 @@
@using System.Text.RegularExpressions @using System.Text.RegularExpressions
@namespace Chrono.Components @namespace Chrono.Components
@@ -12,7 +11,7 @@
{ {
<div class="detail-image"> <div class="detail-image">
<img src="@Card.ImagePath" alt="@Card.Name" <img src="@Card.ImagePath" alt="@Card.Name"
onerror="this.style.display='none';this.parentElement.style.display='none'"/> onerror="this.src='@Card.SmallImagePath';this.onerror=null;"/>
</div> </div>
} }
<div class="detail-info"> <div class="detail-info">
+4 -2
View File
@@ -26,7 +26,7 @@
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 16px; border-radius: 16px;
padding: 0; padding: 0;
max-width: 720px; max-width: 850px;
width: 92vw; width: 92vw;
max-height: 88vh; max-height: 88vh;
overflow-y: auto; overflow-y: auto;
@@ -76,13 +76,15 @@
} }
.detail-image { .detail-image {
flex: 0 0 260px; flex: 0 0 320px;
} }
.detail-image img { .detail-image img {
width: 100%; width: 100%;
border-radius: var(--radius); border-radius: var(--radius);
box-shadow: var(--shadow); box-shadow: var(--shadow);
max-height: 80vh;
object-fit: contain;
} }
/* ── No-image layout ── */ /* ── No-image layout ── */
+2 -2
View File
@@ -12,12 +12,12 @@
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> <div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="nav flex-column"> <nav class="nav flex-column">
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <NavLink class="nav-link" href="home">
<i class="bi bi-house-door-fill nav-icon"></i> Home <i class="bi bi-house-door-fill nav-icon"></i> Home
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="cards"> <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<i class="bi bi-collection-fill nav-icon"></i> Cards <i class="bi bi-collection-fill nav-icon"></i> Cards
</NavLink> </NavLink>
</div> </div>
+5 -2
View File
@@ -1,5 +1,6 @@
@page "/"
@page "/cards" @page "/cards"
@using Model @using Chrono.Components
@using Shared.Services @using Shared.Services
@inject AnalyticsService AnalyticsService @inject AnalyticsService AnalyticsService
@@ -28,7 +29,8 @@
<i class="bi bi-person-fill"></i> Immortalized <i class="bi bi-person-fill"></i> Immortalized
</button> </button>
<div class="tab link-toggle @(agentLink ? "active" : "")" @onclick="ToggleAgentLink" title="Link Agents and Immortalized cards"> <div class="tab link-toggle @(agentLink ? "active" : "")" @onclick="ToggleAgentLink"
title="Link Agents and Immortalized cards">
<i class="bi bi-link-45deg"></i> <i class="bi bi-link-45deg"></i>
<span>Linked</span> <span>Linked</span>
<span class="toggle-switch @(agentLink ? "on" : "off")"></span> <span class="toggle-switch @(agentLink ? "on" : "off")"></span>
@@ -272,6 +274,7 @@
seen.Add(card.Name); seen.Add(card.Name);
} }
} }
return result; return result;
} }
+36 -17
View File
@@ -1,6 +1,5 @@
@page "/deck-builder" @page "/deck-builder"
@page "/deck-builder/{Id:guid}" @page "/deck-builder/{Id:guid}"
@using Model
@rendermode InteractiveServer @rendermode InteractiveServer
@inject NavigationManager Nav @inject NavigationManager Nav
@inject AppDbContext Db @inject AppDbContext Db
@@ -11,8 +10,10 @@
<a href="/my-decks" class="btn btn-sm btn-outline-secondary"> <a href="/my-decks" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> My Decks <i class="bi bi-arrow-left"></i> My Decks
</a> </a>
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..." maxlength="80"/> <input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..."
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)" maxlength="20"/> maxlength="80"/>
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)"
maxlength="20"/>
<span class="validity-badge @(IsValid ? "badge-valid" : "badge-invalid")"> <span class="validity-badge @(IsValid ? "badge-valid" : "badge-invalid")">
<i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i> <i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i>
@ValidationMessage @ValidationMessage
@@ -42,13 +43,16 @@
<button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'> <button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'>
<i class="bi bi-grid-3x3-gap-fill"></i> All <i class="bi bi-grid-3x3-gap-fill"></i> All
</button> </button>
<button class="tab agent @(categoryFilter == "Agent" ? "active" : "")" @onclick='() => categoryFilter = "Agent"'> <button class="tab agent @(categoryFilter == "Agent" ? "active" : "")"
@onclick='() => categoryFilter = "Agent"'>
<i class="bi bi-person-fill"></i> Agents <i class="bi bi-person-fill"></i> Agents
</button> </button>
<button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")" @onclick='() => categoryFilter = "Immortalized"'> <button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")"
@onclick='() => categoryFilter = "Immortalized"'>
<i class="bi bi-star-fill"></i> Immortalized <i class="bi bi-star-fill"></i> Immortalized
</button> </button>
<button class="tab spell @(categoryFilter == "Spell" ? "active" : "")" @onclick='() => categoryFilter = "Spell"'> <button class="tab spell @(categoryFilter == "Spell" ? "active" : "")"
@onclick='() => categoryFilter = "Spell"'>
<i class="bi bi-wand"></i> Spells <i class="bi bi-wand"></i> Spells
</button> </button>
</div> </div>
@@ -56,7 +60,8 @@
<div class="filter-bar"> <div class="filter-bar">
<div class="search-wrapper"> <div class="search-wrapper">
<i class="bi bi-search search-icon"></i> <i class="bi bi-search search-icon"></i>
<input @bind="search" @bind:event="oninput" class="form-control search-input" placeholder="Search cards..."/> <input @bind="search" @bind:event="oninput" class="form-control search-input"
placeholder="Search cards..."/>
@if (search.Length > 0) @if (search.Length > 0)
{ {
<button class="search-clear" @onclick='() => search = ""'><i class="bi bi-x-lg"></i></button> <button class="search-clear" @onclick='() => search = ""'><i class="bi bi-x-lg"></i></button>
@@ -73,7 +78,8 @@
@for (var c = 1; c <= 6; c++) @for (var c = 1; c <= 6; c++)
{ {
var cols = c; var cols = c;
<button class="col-btn @(gridColumns == cols ? "active" : "")" @onclick="() => gridColumns = cols">@cols</button> <button class="col-btn @(gridColumns == cols ? "active" : "")"
@onclick="() => gridColumns = cols">@cols</button>
} }
</div> </div>
</div> </div>
@@ -108,7 +114,8 @@
<div class="deck-panel"> <div class="deck-panel">
<div class="deck-status-bar"> <div class="deck-status-bar">
<span class="card-count @(deckCards.Count == 40 ? "count-ok" : deckCards.Count > 40 ? "count-over" : "count-under")"> <span
class="card-count @(deckCards.Count == 40 ? "count-ok" : deckCards.Count > 40 ? "count-over" : "count-under")">
<i class="bi bi-stack"></i> @deckCards.Count<span class="count-denom">/40</span> <i class="bi bi-stack"></i> @deckCards.Count<span class="count-denom">/40</span>
</span> </span>
<button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck"> <button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck">
@@ -158,7 +165,8 @@
<div class="deck-row-controls"> <div class="deck-row-controls">
<button class="count-btn" @onclick="() => RemoveCard(cardData.Name)"></button> <button class="count-btn" @onclick="() => RemoveCard(cardData.Name)"></button>
<span class="count-display">@group.Count</span> <span class="count-display">@group.Count</span>
<button class="count-btn" @onclick="() => AddCard(cardData)" disabled="@(group.Count >= 3)">+</button> <button class="count-btn" @onclick="() => AddCard(cardData)" disabled="@(group.Count >= 3)">+
</button>
</div> </div>
</div> </div>
} }
@@ -182,6 +190,7 @@
<img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver" <img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver"
onerror="this.style.display='none'"/> onerror="this.style.display='none'"/>
} }
<span class="diver-name">@diver</span> <span class="diver-name">@diver</span>
<button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)"> <button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)">
<i class="bi bi-x"></i> <i class="bi bi-x"></i>
@@ -216,7 +225,8 @@
<div class="filter-bar mb-2"> <div class="filter-bar mb-2">
<div class="search-wrapper"> <div class="search-wrapper">
<i class="bi bi-search search-icon"></i> <i class="bi bi-search search-icon"></i>
<input @bind="diverSearch" @bind:event="oninput" class="form-control search-input" placeholder="Search..."/> <input @bind="diverSearch" @bind:event="oninput" class="form-control search-input"
placeholder="Search..."/>
</div> </div>
</div> </div>
<div class="diver-picker-grid"> <div class="diver-picker-grid">
@@ -287,8 +297,8 @@
{ {
var inDeck = deckCards.ToHashSet(); var inDeck = deckCards.ToHashSet();
var otherDiverSlot = activeDiverSlot == 0 var otherDiverSlot = activeDiverSlot == 0
? (divers.Count > 1 ? divers[1] : null) ? divers.Count > 1 ? divers[1] : null
: (divers.Count > 0 ? divers[0] : null); : divers.Count > 0 ? divers[0] : null;
return AllCards return AllCards
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized") .Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
@@ -310,17 +320,22 @@
var bucket = Math.Min(card.Cost ?? 0, 10); var bucket = Math.Min(card.Cost ?? 0, 10);
result[bucket] = result.GetValueOrDefault(bucket) + 1; result[bucket] = result.GetValueOrDefault(bucket) + 1;
} }
return result; return result;
} }
} }
private Dictionary<string, int> _deckCounts = new(); private Dictionary<string, int> _deckCounts = new();
private void RebuildDeckCounts() => private void RebuildDeckCounts()
{
_deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count()); _deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count());
}
private int CountInDeck(string name) => private int CountInDeck(string name)
_deckCounts.TryGetValue(name, out var c) ? c : 0; {
return _deckCounts.TryGetValue(name, out var c) ? c : 0;
}
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@@ -375,7 +390,10 @@
showDiverPicker = true; showDiverPicker = true;
} }
private void CloseDiverPicker() => showDiverPicker = false; private void CloseDiverPicker()
{
showDiverPicker = false;
}
private void SelectDiver(string name) private void SelectDiver(string name)
{ {
@@ -449,4 +467,5 @@
isSaving = false; isSaving = false;
} }
} }
} }
@@ -10,7 +10,7 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 100; z-index: 100;
box-shadow: 0 2px 12px rgba(0,0,0,0.25); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
} }
.deck-name-input { .deck-name-input {
@@ -79,8 +79,13 @@
animation: fade-in 0.2s ease-out; animation: fade-in 0.2s ease-out;
} }
.save-ok { color: #66bb6a; } .save-ok {
.save-error { color: #ef5350; } color: #66bb6a;
}
.save-error {
color: #ef5350;
}
/* ── Main Layout ── */ /* ── Main Layout ── */
.builder-layout { .builder-layout {
@@ -193,7 +198,9 @@
align-items: center; align-items: center;
} }
.search-clear:hover { color: var(--text-primary); } .search-clear:hover {
color: var(--text-primary);
}
.filter-select { .filter-select {
width: 130px; width: 130px;
@@ -239,8 +246,15 @@
padding: 0; padding: 0;
} }
.col-btn:hover { background: var(--bg-hover); color: var(--text-primary); } .col-btn:hover {
.col-btn.active { background: var(--accent); color: #fff; } background: var(--bg-hover);
color: var(--text-primary);
}
.col-btn.active {
background: var(--accent);
color: #fff;
}
/* ── Browser Grid ── */ /* ── Browser Grid ── */
.browser-grid { .browser-grid {
@@ -322,19 +336,19 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1.5px solid rgba(255,255,255,0.25); border: 1.5px solid rgba(255, 255, 255, 0.25);
box-shadow: 0 2px 6px rgba(0,0,0,0.4); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
} }
.maxed-overlay { .maxed-overlay {
position: absolute; position: absolute;
inset: 0; inset: 0;
background: rgba(0,0,0,0.5); background: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 1.4rem; font-size: 1.4rem;
color: rgba(255,255,255,0.45); color: rgba(255, 255, 255, 0.45);
} }
.browser-card-name { .browser-card-name {
@@ -368,7 +382,7 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 10; z-index: 10;
box-shadow: 0 2px 8px rgba(0,0,0,0.15); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
} }
.card-count { .card-count {
@@ -379,10 +393,23 @@
gap: 0.15rem; gap: 0.15rem;
} }
.count-denom { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); } .count-denom {
.count-ok { color: #66bb6a; } font-size: 0.78rem;
.count-over { color: #ef5350; } font-weight: 400;
.count-under { color: var(--text-secondary); } color: var(--text-muted);
}
.count-ok {
color: #66bb6a;
}
.count-over {
color: #ef5350;
}
.count-under {
color: var(--text-secondary);
}
/* ── Mana Curve ── */ /* ── Mana Curve ── */
.mana-curve { .mana-curve {
@@ -451,18 +478,22 @@
opacity: 0.7; opacity: 0.7;
} }
.deck-empty i { font-size: 2rem; } .deck-empty i {
font-size: 2rem;
}
.deck-row { .deck-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
padding: 0.3rem 0.75rem; padding: 0.3rem 0.75rem;
border-bottom: 1px solid rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.04);
transition: background 0.12s ease; transition: background 0.12s ease;
} }
.deck-row:hover { background: var(--bg-hover); } .deck-row:hover {
background: var(--bg-hover);
}
.deck-row-img { .deck-row-img {
width: 26px; width: 26px;
@@ -523,7 +554,10 @@
color: var(--accent); color: var(--accent);
} }
.count-btn:disabled { opacity: 0.3; cursor: not-allowed; } .count-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.count-display { .count-display {
font-size: 0.82rem; font-size: 0.82rem;
@@ -556,7 +590,9 @@
font-size: 0.72rem; font-size: 0.72rem;
} }
.divers-section { padding-bottom: 0.5rem; } .divers-section {
padding-bottom: 0.5rem;
}
.diver-slot { .diver-slot {
display: flex; display: flex;
@@ -621,10 +657,15 @@
transition: all 0.12s ease; transition: all 0.12s ease;
} }
.diver-remove:hover { color: #ef5350; background: rgba(239, 83, 80, 0.1); } .diver-remove:hover {
color: #ef5350;
background: rgba(239, 83, 80, 0.1);
}
/* ── Notes Section ── */ /* ── Notes Section ── */
.notes-section { padding-bottom: 1rem; } .notes-section {
padding-bottom: 1rem;
}
.notes-input { .notes-input {
margin: 0 0.75rem; margin: 0 0.75rem;
@@ -648,7 +689,7 @@
.modal-backdrop { .modal-backdrop {
position: fixed; position: fixed;
inset: 0; inset: 0;
background: rgba(0,0,0,0.6); background: rgba(0, 0, 0, 0.6);
z-index: 1040; z-index: 1040;
backdrop-filter: blur(2px); backdrop-filter: blur(2px);
} }
@@ -669,13 +710,19 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.75rem; gap: 0.75rem;
box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(108, 99, 255, 0.1); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(108, 99, 255, 0.1);
animation: modal-enter 0.18s ease-out; animation: modal-enter 0.18s ease-out;
} }
@keyframes modal-enter { @keyframes modal-enter {
from { opacity: 0; transform: translate(-50%, -52%) scale(0.97); } from {
to { opacity: 1; transform: translate(-50%, -50%) scale(1); } opacity: 0;
transform: translate(-50%, -52%) scale(0.97);
}
to {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
} }
.diver-modal-header { .diver-modal-header {
+4 -4
View File
@@ -1,7 +1,6 @@
@page "/login" @page "/login"
@rendermode InteractiveServer @rendermode InteractiveServer
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous] @attribute [AllowAnonymous]
@using Microsoft.AspNetCore.Components.Authorization
@inject IJSRuntime JS @inject IJSRuntime JS
@inject NavigationManager Nav @inject NavigationManager Nav
@inject AuthenticationStateProvider AuthStateProvider @inject AuthenticationStateProvider AuthStateProvider
@@ -75,7 +74,7 @@
try try
{ {
await JS.InvokeVoidAsync("passkeyLogin"); await JS.InvokeVoidAsync("passkeyLogin");
Nav.NavigateTo("/", forceLoad: true); Nav.NavigateTo("/", true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -94,7 +93,7 @@
try try
{ {
await JS.InvokeVoidAsync("passkeyEnroll"); await JS.InvokeVoidAsync("passkeyEnroll");
Nav.NavigateTo("/", forceLoad: true); Nav.NavigateTo("/", true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -107,4 +106,5 @@
} }
private record StatusResponse(bool Enrolled, bool Authenticated); private record StatusResponse(bool Enrolled, bool Authenticated);
} }
@@ -9,7 +9,7 @@
.login-card { .login-card {
background: #fff; background: #fff;
border-radius: 12px; border-radius: 12px;
box-shadow: 0 4px 24px rgba(0,0,0,0.10); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
padding: 2.5rem 2rem; padding: 2.5rem 2rem;
width: 100%; width: 100%;
max-width: 380px; max-width: 380px;
+8 -4
View File
@@ -1,7 +1,6 @@
@page "/my-decks" @page "/my-decks"
@rendermode InteractiveServer
@using Cloud.Models
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@rendermode InteractiveServer
@inject AppDbContext Db @inject AppDbContext Db
@inject NavigationManager Nav @inject NavigationManager Nav
@@ -100,11 +99,15 @@
<div class="modal-backdrop" @onclick="CancelDelete"></div> <div class="modal-backdrop" @onclick="CancelDelete"></div>
<div class="confirm-modal"> <div class="confirm-modal">
<h5>Delete Deck</h5> <h5>Delete Deck</h5>
<p>Delete <strong>@(string.IsNullOrEmpty(deckToDelete.Name) ? "Untitled Deck" : deckToDelete.Name)</strong>? This cannot be undone.</p> <p>Delete <strong>@(string.IsNullOrEmpty(deckToDelete.Name) ? "Untitled Deck" : deckToDelete.Name)</strong>?
This cannot be undone.</p>
<div class="d-flex gap-2 justify-content-end"> <div class="d-flex gap-2 justify-content-end">
<button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button> <button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button>
<button class="btn btn-danger" @onclick="DeleteDeck" disabled="@deleting"> <button class="btn btn-danger" @onclick="DeleteDeck" disabled="@deleting">
@if (deleting) { <span class="spinner-border spinner-border-sm me-1"></span> } @if (deleting)
{
<span class="spinner-border spinner-border-sm me-1"></span>
}
Delete Delete
</button> </button>
</div> </div>
@@ -179,4 +182,5 @@
await LoadDecks(); await LoadDecks();
} }
} }
} }
@@ -1,8 +1,10 @@
@inject NavigationManager Nav @inject NavigationManager Nav
@code { @code {
protected override void OnInitialized() protected override void OnInitialized()
{ {
Nav.NavigateTo("/login", forceLoad: true); Nav.NavigateTo("/login", true);
} }
} }
+12 -11
View File
@@ -1,4 +1,5 @@
using System.Security.Claims; using System.Security.Claims;
using Cloud.Models;
using Fido2NetLib; using Fido2NetLib;
using Fido2NetLib.Objects; using Fido2NetLib.Objects;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
@@ -6,7 +7,6 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Cloud.Models;
namespace Cloud.Controllers; namespace Cloud.Controllers;
@@ -17,9 +17,9 @@ public class AuthController : ControllerBase
{ {
private const string RegOptionsKey = "fido2.reg.options"; private const string RegOptionsKey = "fido2.reg.options";
private const string AssertOptionsKey = "fido2.assert.options"; private const string AssertOptionsKey = "fido2.assert.options";
private readonly AppDbContext _db;
private readonly IFido2 _fido2; private readonly IFido2 _fido2;
private readonly AppDbContext _db;
public AuthController(IFido2 fido2, AppDbContext db) public AuthController(IFido2 fido2, AppDbContext db)
{ {
@@ -55,9 +55,9 @@ public class AuthController : ControllerBase
AuthenticatorSelection = new AuthenticatorSelection AuthenticatorSelection = new AuthenticatorSelection
{ {
ResidentKey = ResidentKeyRequirement.Required, ResidentKey = ResidentKeyRequirement.Required,
UserVerification = UserVerificationRequirement.Required, UserVerification = UserVerificationRequirement.Required
}, },
AttestationPreference = AttestationConveyancePreference.None, AttestationPreference = AttestationConveyancePreference.None
}); });
HttpContext.Session.SetString(RegOptionsKey, options.ToJson()); HttpContext.Session.SetString(RegOptionsKey, options.ToJson());
@@ -65,7 +65,8 @@ public class AuthController : ControllerBase
} }
[HttpPost("register/complete")] [HttpPost("register/complete")]
public async Task<IActionResult> RegisterComplete([FromBody] AuthenticatorAttestationRawResponse attestationResponse) public async Task<IActionResult> RegisterComplete(
[FromBody] AuthenticatorAttestationRawResponse attestationResponse)
{ {
var json = HttpContext.Session.GetString(RegOptionsKey); var json = HttpContext.Session.GetString(RegOptionsKey);
if (json is null) return BadRequest("Session expired. Please retry enrollment."); if (json is null) return BadRequest("Session expired. Please retry enrollment.");
@@ -84,7 +85,7 @@ public class AuthController : ControllerBase
{ {
AttestationResponse = attestationResponse, AttestationResponse = attestationResponse,
OriginalOptions = options, OriginalOptions = options,
IsCredentialIdUniqueToUserCallback = isUnique, IsCredentialIdUniqueToUserCallback = isUnique
}); });
var credential = new PasskeyCredential var credential = new PasskeyCredential
@@ -93,7 +94,7 @@ public class AuthController : ControllerBase
PublicKey = result.PublicKey, PublicKey = result.PublicKey,
SignCount = result.SignCount, SignCount = result.SignCount,
UserHandle = result.User.Id, UserHandle = result.User.Id,
AaGuid = result.AaGuid.ToString(), AaGuid = result.AaGuid.ToString()
}; };
_db.PasskeyCredentials.Add(credential); _db.PasskeyCredentials.Add(credential);
await _db.SaveChangesAsync(); await _db.SaveChangesAsync();
@@ -120,7 +121,7 @@ public class AuthController : ControllerBase
var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams
{ {
AllowedCredentials = existingKeys, AllowedCredentials = existingKeys,
UserVerification = UserVerificationRequirement.Required, UserVerification = UserVerificationRequirement.Required
}); });
HttpContext.Session.SetString(AssertOptionsKey, options.ToJson()); HttpContext.Session.SetString(AssertOptionsKey, options.ToJson());
@@ -152,7 +153,7 @@ public class AuthController : ControllerBase
OriginalOptions = options, OriginalOptions = options,
StoredPublicKey = stored.PublicKey, StoredPublicKey = stored.PublicKey,
StoredSignatureCounter = (uint)stored.SignCount, StoredSignatureCounter = (uint)stored.SignCount,
IsUserHandleOwnerOfCredentialIdCallback = isOwner, IsUserHandleOwnerOfCredentialIdCallback = isOwner
}); });
stored.SignCount = result.SignCount; stored.SignCount = result.SignCount;
@@ -186,7 +187,7 @@ public class AuthController : ControllerBase
return Ok(new return Ok(new
{ {
enrolled = hasCredentials, enrolled = hasCredentials,
authenticated = User.Identity?.IsAuthenticated ?? false, authenticated = User.Identity?.IsAuthenticated ?? false
}); });
} }
@@ -216,4 +217,4 @@ public class AuthController : ControllerBase
await _db.SaveChangesAsync(); await _db.SaveChangesAsync();
return Ok(new { message = "All credentials deleted." }); return Ok(new { message = "All credentials deleted." });
} }
} }
+2 -2
View File
@@ -1,7 +1,7 @@
using Cloud.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Cloud.Models;
namespace Cloud.Controllers; namespace Cloud.Controllers;
@@ -107,4 +107,4 @@ public class DecksController : ControllerBase
return StatusCode(500); return StatusCode(500);
} }
} }
} }
+1 -1
View File
@@ -9,4 +9,4 @@ public class PasskeyCredential
public required byte[] UserHandle { get; set; } public required byte[] UserHandle { get; set; }
public string AaGuid { get; set; } = string.Empty; public string AaGuid { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
} }
+1 -1
View File
@@ -9,4 +9,4 @@ public class UserDeck
public string? Notes { get; set; } public string? Notes { get; set; }
public string? Season { get; set; } public string? Season { get; set; }
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
} }
+3 -4
View File
@@ -1,8 +1,7 @@
using Fido2NetLib;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Cloud; using Cloud;
using Cloud.Components; using Cloud.Components;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Shared.Pages; using Shared.Pages;
using Shared.Services; using Shared.Services;
@@ -81,4 +80,4 @@ app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode() .AddInteractiveServerRenderMode()
.AddAdditionalAssemblies(typeof(Home).Assembly); .AddAdditionalAssemblies(typeof(Home).Assembly);
app.Run(); app.Run();
+4 -1
View File
@@ -9,6 +9,9 @@
"Fido2": { "Fido2": {
"ServerDomain": "localhost", "ServerDomain": "localhost",
"ServerName": "Chrono CCG", "ServerName": "Chrono CCG",
"Origins": [ "https://localhost:7001", "http://localhost:5000" ] "Origins": [
"https://localhost:7001",
"http://localhost:5000"
]
} }
} }

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Some files were not shown because too many files have changed in this diff Show More