Checkers-Draughts Game Revisited: Publishing, Voice Buttons and Player Update
Some updates to the online Draughts game wrt publishing on Azure, UI improvement wrt voice buttons (make all 3 light green) and restrict a player to one login at a time globally.
Links
- The game draughts at sportronics
- Blogs AI at sportronics
Publishing Issue
Publishing to Azure failed because the previous Azure subscription was no longer available.
Was prompted to Re-enter credentials. Did so but still kept saying that.
Root cause
The deployment configuration still referenced the old subscription context.
Solution
- Switched publishing to the current active Azure subscription.
- Updated the publish context/profile to use the correct subscription and target resources.
- Re-ran publish using the current subscription context.
Just had to clear the old subscription reference as circled in green on right!
Outcome
Publishing proceeded successfully after moving to the current subscription.
Nb: AI tools went around in circles on this for a couple of hours before suggesting this solution!
Changes related to voice buttons
- Aligned the voice-related buttons to use the same class:
game-voice-button.- Talk button
- Mute/Unmute button
- Toggle Voice-in-Chat button
- Updated voice button styling to use a light-green gradient override via button CSS variables for these 3 buttons
- Ensured Talk button text is visible by wrapping
@TalkButtonTextin a<span>so it layers above the button overlay. - Kept all three controls on one line in the chat/voice row: Send, Talk, and Mute/Unmute.
- Better when used on phone
Result
- Voice buttons now share consistent styling.
- The brown default button shading is overridden for voice buttons.
- Talk button text displays correctly.
- Layout is cleaner and consistent for chat/voice actions.
Nb: AI Tools had to be “dragged screaming” as to where the specific button color shading was implemented! At one stage it said it was a browser setting!
Changes with respect to Players’ logins
Core Direction
Wanted to restrict players’ logins to one instance per player only. Had to move away from session based contexts although AI kept bringing things back to that. Had to explicitly state that don’t want session based logins. Want to directly validate with the database each time. Moved to a database-authoritative login model.
Important: Login validity is not based on server session/cookie validation as the source of truth.
It is validated against database state.
What Changed
1) DB-first authentication state
- Added
Users.IsLoggedInas the account lock flag. - Added
LoginContextstable for active login contexts. - Added startup reset/health checks and schema validation.
2) Context-based login (tab-aware)
- Added a DB auth provider (
DbAuthenticationStateProvider). - Login now creates a DB login context and stores
contextIdinsessionStorage. - Auth state is resolved using DB lookups (
contextId->LoginContexts->Users).
3) No reliance on cookie/session as authority
- UI/auth checks now validate against DB context state.
- Mixed legacy cookie paths were removed/disabled from active flow.
- Logout clears DB context and updates DB login state.
4) Concurrency/exclusivity behavior
- If user already marked logged in with active context, second login is blocked.
- Added stale-lock repair logic (if
IsLoggedIn=truebut no active context, unlock and allow login).
5) Login/Logout UI flow updates
Login.razormoved from server form-post auth to provider-based DB login.- Added
/logoutpage to perform DB-context logout. - Header logout now uses DB provider signout path.
6) Admin download auth alignment
- Admin DB download endpoint now validates admin via DB context (
contextId) instead of cookie role. - Download path now resolves actual SQLite file from active EF connection string (works in Azure path scenarios).
Seeding/Startup Reliability
auth.jsonpath resolution hardened (multiple candidate paths).- Duplicate user-name handling added during seed.
- Startup sync now aligns users/groups from
auth.json(groups-first flow). - Schema health gate added to fail fast on missing required tables/columns.
Current Validation Principle
Authoritative validation = Database state
Users.IsLoggedInLoginContexts.IsActive+ContextId
Not authoritative
- Cookie/session identity alone
Also
New: Fred,John,Harry,Mary,Sue,Libby all in Global Group.
Can play each other.
At startup auth.json is checked for missing groups and users and db is updated for any missing.
And finally
When logged in can see who else in your group is logged in, Note: Depends upon polling in 10 second periods. Could improve on that mechanism!
And logging extended to show most events including game start and result. Viewable only by Admin. (In the game URL replace /player by /admin)
| Topic | Subtopic | |
| Next: > | Checkers-Draughts Game Revisited | Game features summary |
| < Prev: | Athletics Certificate Generator | Final Version plus summary |
| This Category Links | ||
| Category: | Application Dev Index: | Application Dev |