Updating game data to mid season patch and made card gallery nicer
@@ -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",
|
||||
"Vor’kon, 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,6 +1,5 @@
|
||||
using Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cloud.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model;
|
||||
|
||||
namespace Cloud;
|
||||
|
||||
@@ -12,4 +12,4 @@ public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
|
||||
.Options;
|
||||
return new AppDbContext(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MudBlazor" Version="9.6.0" />
|
||||
<PackageReference Include="MudBlazor" Version="9.6.0"/>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="Components\Layout\MainLayout.razor" />
|
||||
<AdditionalFiles Include="Components\Layout\NavMenu.razor" />
|
||||
<AdditionalFiles Include="Components\Layout\MainLayout.razor"/>
|
||||
<AdditionalFiles Include="Components\Layout\NavMenu.razor"/>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
@using System.Text.RegularExpressions
|
||||
@namespace Chrono.Components
|
||||
|
||||
@@ -12,7 +11,7 @@
|
||||
{
|
||||
<div class="detail-image">
|
||||
<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 class="detail-info">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
padding: 0;
|
||||
max-width: 720px;
|
||||
max-width: 850px;
|
||||
width: 92vw;
|
||||
max-height: 88vh;
|
||||
overflow-y: auto;
|
||||
@@ -76,13 +76,15 @@
|
||||
}
|
||||
|
||||
.detail-image {
|
||||
flex: 0 0 260px;
|
||||
flex: 0 0 320px;
|
||||
}
|
||||
|
||||
.detail-image img {
|
||||
width: 100%;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
max-height: 80vh;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* ── No-image layout ── */
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
||||
<nav class="nav flex-column">
|
||||
<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
|
||||
</NavLink>
|
||||
</div>
|
||||
<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
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@page "/"
|
||||
@page "/cards"
|
||||
@using Model
|
||||
@using Chrono.Components
|
||||
@using Shared.Services
|
||||
@inject AnalyticsService AnalyticsService
|
||||
|
||||
@@ -28,7 +29,8 @@
|
||||
<i class="bi bi-person-fill"></i> Immortalized
|
||||
</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>
|
||||
<span>Linked</span>
|
||||
<span class="toggle-switch @(agentLink ? "on" : "off")"></span>
|
||||
@@ -272,6 +274,7 @@
|
||||
seen.Add(card.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@page "/deck-builder"
|
||||
@page "/deck-builder/{Id:guid}"
|
||||
@using Model
|
||||
@rendermode InteractiveServer
|
||||
@inject NavigationManager Nav
|
||||
@inject AppDbContext Db
|
||||
@@ -11,8 +10,10 @@
|
||||
<a href="/my-decks" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left"></i> My Decks
|
||||
</a>
|
||||
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..." maxlength="80"/>
|
||||
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)" maxlength="20"/>
|
||||
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..."
|
||||
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")">
|
||||
<i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i>
|
||||
@ValidationMessage
|
||||
@@ -42,13 +43,16 @@
|
||||
<button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'>
|
||||
<i class="bi bi-grid-3x3-gap-fill"></i> All
|
||||
</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
|
||||
</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
|
||||
</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
|
||||
</button>
|
||||
</div>
|
||||
@@ -56,7 +60,8 @@
|
||||
<div class="filter-bar">
|
||||
<div class="search-wrapper">
|
||||
<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)
|
||||
{
|
||||
<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++)
|
||||
{
|
||||
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>
|
||||
@@ -108,7 +114,8 @@
|
||||
<div class="deck-panel">
|
||||
|
||||
<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>
|
||||
</span>
|
||||
<button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck">
|
||||
@@ -158,7 +165,8 @@
|
||||
<div class="deck-row-controls">
|
||||
<button class="count-btn" @onclick="() => RemoveCard(cardData.Name)">−</button>
|
||||
<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>
|
||||
}
|
||||
@@ -182,6 +190,7 @@
|
||||
<img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver"
|
||||
onerror="this.style.display='none'"/>
|
||||
}
|
||||
|
||||
<span class="diver-name">@diver</span>
|
||||
<button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)">
|
||||
<i class="bi bi-x"></i>
|
||||
@@ -216,7 +225,8 @@
|
||||
<div class="filter-bar mb-2">
|
||||
<div class="search-wrapper">
|
||||
<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 class="diver-picker-grid">
|
||||
@@ -287,8 +297,8 @@
|
||||
{
|
||||
var inDeck = deckCards.ToHashSet();
|
||||
var otherDiverSlot = activeDiverSlot == 0
|
||||
? (divers.Count > 1 ? divers[1] : null)
|
||||
: (divers.Count > 0 ? divers[0] : null);
|
||||
? divers.Count > 1 ? divers[1] : null
|
||||
: divers.Count > 0 ? divers[0] : null;
|
||||
|
||||
return AllCards
|
||||
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
|
||||
@@ -310,17 +320,22 @@
|
||||
var bucket = Math.Min(card.Cost ?? 0, 10);
|
||||
result[bucket] = result.GetValueOrDefault(bucket) + 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, int> _deckCounts = new();
|
||||
|
||||
private void RebuildDeckCounts() =>
|
||||
private void RebuildDeckCounts()
|
||||
{
|
||||
_deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
|
||||
private int CountInDeck(string name) =>
|
||||
_deckCounts.TryGetValue(name, out var c) ? c : 0;
|
||||
private int CountInDeck(string name)
|
||||
{
|
||||
return _deckCounts.TryGetValue(name, out var c) ? c : 0;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
@@ -375,7 +390,10 @@
|
||||
showDiverPicker = true;
|
||||
}
|
||||
|
||||
private void CloseDiverPicker() => showDiverPicker = false;
|
||||
private void CloseDiverPicker()
|
||||
{
|
||||
showDiverPicker = false;
|
||||
}
|
||||
|
||||
private void SelectDiver(string name)
|
||||
{
|
||||
@@ -449,4 +467,5 @@
|
||||
isSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
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 {
|
||||
@@ -79,8 +79,13 @@
|
||||
animation: fade-in 0.2s ease-out;
|
||||
}
|
||||
|
||||
.save-ok { color: #66bb6a; }
|
||||
.save-error { color: #ef5350; }
|
||||
.save-ok {
|
||||
color: #66bb6a;
|
||||
}
|
||||
|
||||
.save-error {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
/* ── Main Layout ── */
|
||||
.builder-layout {
|
||||
@@ -193,7 +198,9 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-clear:hover { color: var(--text-primary); }
|
||||
.search-clear:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.filter-select {
|
||||
width: 130px;
|
||||
@@ -239,8 +246,15 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.col-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
|
||||
.col-btn.active { background: var(--accent); color: #fff; }
|
||||
.col-btn:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.col-btn.active {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* ── Browser Grid ── */
|
||||
.browser-grid {
|
||||
@@ -322,19 +336,19 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1.5px solid rgba(255,255,255,0.25);
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.4);
|
||||
border: 1.5px solid rgba(255, 255, 255, 0.25);
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.maxed-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.4rem;
|
||||
color: rgba(255,255,255,0.45);
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
.browser-card-name {
|
||||
@@ -368,7 +382,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
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 {
|
||||
@@ -379,10 +393,23 @@
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.count-denom { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); }
|
||||
.count-ok { color: #66bb6a; }
|
||||
.count-over { color: #ef5350; }
|
||||
.count-under { color: var(--text-secondary); }
|
||||
.count-denom {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 400;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.count-ok {
|
||||
color: #66bb6a;
|
||||
}
|
||||
|
||||
.count-over {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
.count-under {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ── Mana Curve ── */
|
||||
.mana-curve {
|
||||
@@ -451,18 +478,22 @@
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.deck-empty i { font-size: 2rem; }
|
||||
.deck-empty i {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.deck-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
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;
|
||||
}
|
||||
|
||||
.deck-row:hover { background: var(--bg-hover); }
|
||||
.deck-row:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.deck-row-img {
|
||||
width: 26px;
|
||||
@@ -523,7 +554,10 @@
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.count-btn:disabled { opacity: 0.3; cursor: not-allowed; }
|
||||
.count-btn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.count-display {
|
||||
font-size: 0.82rem;
|
||||
@@ -556,7 +590,9 @@
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.divers-section { padding-bottom: 0.5rem; }
|
||||
.divers-section {
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.diver-slot {
|
||||
display: flex;
|
||||
@@ -621,10 +657,15 @@
|
||||
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 { padding-bottom: 1rem; }
|
||||
.notes-section {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.notes-input {
|
||||
margin: 0 0.75rem;
|
||||
@@ -648,7 +689,7 @@
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.6);
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 1040;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
@@ -669,13 +710,19 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
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;
|
||||
}
|
||||
|
||||
@keyframes modal-enter {
|
||||
from { opacity: 0; transform: translate(-50%, -52%) scale(0.97); }
|
||||
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -52%) scale(0.97);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.diver-modal-header {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/login"
|
||||
@rendermode InteractiveServer
|
||||
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@attribute [AllowAnonymous]
|
||||
@inject IJSRuntime JS
|
||||
@inject NavigationManager Nav
|
||||
@inject AuthenticationStateProvider AuthStateProvider
|
||||
@@ -75,7 +74,7 @@
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("passkeyLogin");
|
||||
Nav.NavigateTo("/", forceLoad: true);
|
||||
Nav.NavigateTo("/", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -94,7 +93,7 @@
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("passkeyEnroll");
|
||||
Nav.NavigateTo("/", forceLoad: true);
|
||||
Nav.NavigateTo("/", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -107,4 +106,5 @@
|
||||
}
|
||||
|
||||
private record StatusResponse(bool Enrolled, bool Authenticated);
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.login-card {
|
||||
background: #fff;
|
||||
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;
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/my-decks"
|
||||
@rendermode InteractiveServer
|
||||
@using Cloud.Models
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@rendermode InteractiveServer
|
||||
@inject AppDbContext Db
|
||||
@inject NavigationManager Nav
|
||||
|
||||
@@ -100,11 +99,15 @@
|
||||
<div class="modal-backdrop" @onclick="CancelDelete"></div>
|
||||
<div class="confirm-modal">
|
||||
<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">
|
||||
<button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button>
|
||||
<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
|
||||
</button>
|
||||
</div>
|
||||
@@ -179,4 +182,5 @@
|
||||
await LoadDecks();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
@inject NavigationManager Nav
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Nav.NavigateTo("/login", forceLoad: true);
|
||||
Nav.NavigateTo("/login", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Security.Claims;
|
||||
using Cloud.Models;
|
||||
using Fido2NetLib;
|
||||
using Fido2NetLib.Objects;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
@@ -6,7 +7,6 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cloud.Models;
|
||||
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
@@ -17,9 +17,9 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
private const string RegOptionsKey = "fido2.reg.options";
|
||||
private const string AssertOptionsKey = "fido2.assert.options";
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
private readonly IFido2 _fido2;
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
public AuthController(IFido2 fido2, AppDbContext db)
|
||||
{
|
||||
@@ -55,9 +55,9 @@ public class AuthController : ControllerBase
|
||||
AuthenticatorSelection = new AuthenticatorSelection
|
||||
{
|
||||
ResidentKey = ResidentKeyRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
},
|
||||
AttestationPreference = AttestationConveyancePreference.None,
|
||||
AttestationPreference = AttestationConveyancePreference.None
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(RegOptionsKey, options.ToJson());
|
||||
@@ -65,7 +65,8 @@ public class AuthController : ControllerBase
|
||||
}
|
||||
|
||||
[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);
|
||||
if (json is null) return BadRequest("Session expired. Please retry enrollment.");
|
||||
@@ -84,7 +85,7 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
AttestationResponse = attestationResponse,
|
||||
OriginalOptions = options,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique
|
||||
});
|
||||
|
||||
var credential = new PasskeyCredential
|
||||
@@ -93,7 +94,7 @@ public class AuthController : ControllerBase
|
||||
PublicKey = result.PublicKey,
|
||||
SignCount = result.SignCount,
|
||||
UserHandle = result.User.Id,
|
||||
AaGuid = result.AaGuid.ToString(),
|
||||
AaGuid = result.AaGuid.ToString()
|
||||
};
|
||||
_db.PasskeyCredentials.Add(credential);
|
||||
await _db.SaveChangesAsync();
|
||||
@@ -120,7 +121,7 @@ public class AuthController : ControllerBase
|
||||
var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams
|
||||
{
|
||||
AllowedCredentials = existingKeys,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(AssertOptionsKey, options.ToJson());
|
||||
@@ -152,7 +153,7 @@ public class AuthController : ControllerBase
|
||||
OriginalOptions = options,
|
||||
StoredPublicKey = stored.PublicKey,
|
||||
StoredSignatureCounter = (uint)stored.SignCount,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner
|
||||
});
|
||||
|
||||
stored.SignCount = result.SignCount;
|
||||
@@ -186,7 +187,7 @@ public class AuthController : ControllerBase
|
||||
return Ok(new
|
||||
{
|
||||
enrolled = hasCredentials,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,4 +217,4 @@ public class AuthController : ControllerBase
|
||||
await _db.SaveChangesAsync();
|
||||
return Ok(new { message = "All credentials deleted." });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Cloud.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cloud.Models;
|
||||
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
@@ -107,4 +107,4 @@ public class DecksController : ControllerBase
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ public class PasskeyCredential
|
||||
public required byte[] UserHandle { get; set; }
|
||||
public string AaGuid { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ public class UserDeck
|
||||
public string? Notes { get; set; }
|
||||
public string? Season { get; set; }
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using Fido2NetLib;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cloud;
|
||||
using Cloud.Components;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Pages;
|
||||
using Shared.Services;
|
||||
|
||||
@@ -81,4 +80,4 @@ app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode()
|
||||
.AddAdditionalAssemblies(typeof(Home).Assembly);
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@@ -9,6 +9,9 @@
|
||||
"Fido2": {
|
||||
"ServerDomain": "localhost",
|
||||
"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 |
|
After Width: | Height: | Size: 434 KiB |
|
After Width: | Height: | Size: 560 KiB |
|
After Width: | Height: | Size: 656 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 808 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 573 KiB |
|
After Width: | Height: | Size: 532 KiB |
|
After Width: | Height: | Size: 514 KiB |
|
After Width: | Height: | Size: 843 KiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 603 KiB |
|
After Width: | Height: | Size: 571 KiB |
|
After Width: | Height: | Size: 380 KiB |
|
After Width: | Height: | Size: 360 KiB |
|
After Width: | Height: | Size: 449 KiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 621 KiB |
|
After Width: | Height: | Size: 398 KiB |
|
After Width: | Height: | Size: 397 KiB |
|
After Width: | Height: | Size: 548 KiB |
|
After Width: | Height: | Size: 582 KiB |
|
After Width: | Height: | Size: 425 KiB |
|
After Width: | Height: | Size: 524 KiB |
|
After Width: | Height: | Size: 584 KiB |
|
After Width: | Height: | Size: 691 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 570 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 531 KiB |
|
After Width: | Height: | Size: 515 KiB |
|
After Width: | Height: | Size: 410 KiB |
|
After Width: | Height: | Size: 583 KiB |
|
After Width: | Height: | Size: 432 KiB |
|
After Width: | Height: | Size: 551 KiB |
|
After Width: | Height: | Size: 536 KiB |
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 512 KiB |
|
After Width: | Height: | Size: 611 KiB |
|
After Width: | Height: | Size: 577 KiB |
|
After Width: | Height: | Size: 466 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 515 KiB |
|
After Width: | Height: | Size: 517 KiB |
|
After Width: | Height: | Size: 511 KiB |
|
After Width: | Height: | Size: 588 KiB |
|
After Width: | Height: | Size: 564 KiB |
|
After Width: | Height: | Size: 706 KiB |
|
After Width: | Height: | Size: 571 KiB |
|
After Width: | Height: | Size: 549 KiB |
|
After Width: | Height: | Size: 562 KiB |
|
After Width: | Height: | Size: 509 KiB |
|
After Width: | Height: | Size: 551 KiB |
|
After Width: | Height: | Size: 544 KiB |
|
After Width: | Height: | Size: 654 KiB |
|
After Width: | Height: | Size: 689 KiB |
|
After Width: | Height: | Size: 567 KiB |
|
After Width: | Height: | Size: 428 KiB |
|
After Width: | Height: | Size: 477 KiB |
|
After Width: | Height: | Size: 480 KiB |
|
After Width: | Height: | Size: 484 KiB |
|
After Width: | Height: | Size: 542 KiB |
|
After Width: | Height: | Size: 443 KiB |
|
After Width: | Height: | Size: 398 KiB |
|
After Width: | Height: | Size: 479 KiB |
|
After Width: | Height: | Size: 799 KiB |
|
After Width: | Height: | Size: 376 KiB |
|
After Width: | Height: | Size: 538 KiB |
|
After Width: | Height: | Size: 797 KiB |
|
After Width: | Height: | Size: 415 KiB |
|
After Width: | Height: | Size: 525 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 466 KiB |
|
After Width: | Height: | Size: 649 KiB |
|
After Width: | Height: | Size: 401 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 592 KiB |