Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a3e51bade5 | |||
| 48959daae3 | |||
| ae952d70b0 | |||
| a62073511f |
@@ -51,3 +51,13 @@
|
|||||||
|
|
||||||
* NCWF-4 Token Issues ([#8](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/issues/8)) ([95eff42](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/95eff42dfe6d9c23ede08c7297614369a1b00d9f))
|
* NCWF-4 Token Issues ([#8](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/issues/8)) ([95eff42](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/95eff42dfe6d9c23ede08c7297614369a1b00d9f))
|
||||||
## [0.0.0](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/compare/0.2.6...0.0.0) (2026-06-06)
|
## [0.0.0](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/compare/0.2.6...0.0.0) (2026-06-06)
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/compare/0.2.7...0.0.0) (2026-06-10)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* route play-vs-bot to /vs-bot endpoint ([a620735](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/a62073511f2ac912ceb0f6b4730bef37545dd8ea))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/compare/0.2.8...0.0.0) (2026-06-10)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* bots ([#9](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/issues/9)) ([48959da](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/48959daae36e709ea7782ca04fdde699854f8e66))
|
||||||
|
|||||||
@@ -192,12 +192,12 @@
|
|||||||
<span class="dialog-brand">Join with a bot</span>
|
<span class="dialog-brand">Join with a bot</span>
|
||||||
<button type="button" class="dialog-close" (click)="closeJoinDialog()">×</button>
|
<button type="button" class="dialog-close" (click)="closeJoinDialog()">×</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="join-hint">Select one of your bots to enter this tournament. Its token will be rotated to authenticate the join.</p>
|
<p class="join-hint">Select an official (engine-backed) bot to enter this tournament. These are the bots that actually play their moves.</p>
|
||||||
|
|
||||||
@if (botsLoading) {
|
@if (botsLoading) {
|
||||||
<div class="dialog-loading"><span class="pulse"></span>Loading bots…</div>
|
<div class="dialog-loading"><span class="pulse"></span>Loading bots…</div>
|
||||||
} @else if (userBots.length === 0) {
|
} @else if (userBots.length === 0) {
|
||||||
<p class="join-empty">You have no bots yet. Go to <strong>Bots</strong> in the nav to create one first.</p>
|
<p class="join-empty">No official bots are available. The official-bots engine service must be running to register them.</p>
|
||||||
} @else {
|
} @else {
|
||||||
<div class="bot-pick-list">
|
<div class="bot-pick-list">
|
||||||
@for (bot of userBots; track bot.id) {
|
@for (bot of userBots; track bot.id) {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export class TournamentsComponent implements OnInit {
|
|||||||
this.joinDialogTournamentId = tournamentId;
|
this.joinDialogTournamentId = tournamentId;
|
||||||
this.joinError = null;
|
this.joinError = null;
|
||||||
this.botsLoading = true;
|
this.botsLoading = true;
|
||||||
this.botService.list()
|
this.botService.listOfficial()
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: bots => { this.userBots = bots; this.botsLoading = false; },
|
next: bots => { this.userBots = bots; this.botsLoading = false; },
|
||||||
@@ -176,30 +176,22 @@ export class TournamentsComponent implements OnInit {
|
|||||||
if (!this.joinDialogTournamentId || this.joiningBotId) return;
|
if (!this.joinDialogTournamentId || this.joiningBotId) return;
|
||||||
this.joiningBotId = bot.id;
|
this.joiningBotId = bot.id;
|
||||||
this.joinError = null;
|
this.joinError = null;
|
||||||
this.botService.rotateToken(bot.id).subscribe({
|
this.tournamentService.join(this.joinDialogTournamentId, bot.id, bot.name).subscribe({
|
||||||
next: token => {
|
next: () => {
|
||||||
this.tournamentService.joinWithBotToken(this.joinDialogTournamentId!, token).subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.joiningBotId = null;
|
|
||||||
const tid = this.joinDialogTournamentId!;
|
|
||||||
this.closeJoinDialog();
|
|
||||||
this.tournamentService.get(tid)
|
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
||||||
.subscribe(updated => {
|
|
||||||
this.created = this.created.map(x => x.id === tid ? updated : x);
|
|
||||||
this.started = this.started.map(x => x.id === tid ? updated : x);
|
|
||||||
if (this.selectedTournament?.id === tid) this.selectedTournament = updated;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
this.joiningBotId = null;
|
|
||||||
this.joinError = err.error?.message ?? err.error?.error ?? 'Failed to join tournament.';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.joiningBotId = null;
|
this.joiningBotId = null;
|
||||||
this.joinError = 'Failed to get bot token.';
|
const tid = this.joinDialogTournamentId!;
|
||||||
|
this.closeJoinDialog();
|
||||||
|
this.tournamentService.get(tid)
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe(updated => {
|
||||||
|
this.created = this.created.map(x => x.id === tid ? updated : x);
|
||||||
|
this.started = this.started.map(x => x.id === tid ? updated : x);
|
||||||
|
if (this.selectedTournament?.id === tid) this.selectedTournament = updated;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.joiningBotId = null;
|
||||||
|
this.joinError = err.error?.message ?? err.error?.error ?? 'Failed to join tournament.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,16 @@ import { Bot, BotWithToken } from '../models/bot.models';
|
|||||||
export class BotService {
|
export class BotService {
|
||||||
private readonly http = inject(HttpClient);
|
private readonly http = inject(HttpClient);
|
||||||
private readonly base = '/api/account/bots';
|
private readonly base = '/api/account/bots';
|
||||||
|
private readonly officialBase = '/api/account/official-bots';
|
||||||
|
|
||||||
list(): Observable<Bot[]> {
|
list(): Observable<Bot[]> {
|
||||||
return this.http.get<Bot[]>(this.base);
|
return this.http.get<Bot[]>(this.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listOfficial(): Observable<Bot[]> {
|
||||||
|
return this.http.get<Bot[]>(this.officialBase);
|
||||||
|
}
|
||||||
|
|
||||||
create(name: string): Observable<BotWithToken> {
|
create(name: string): Observable<BotWithToken> {
|
||||||
return this.http.post<BotWithToken>(this.base, { name });
|
return this.http.post<BotWithToken>(this.base, { name });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class GameApiService {
|
|||||||
? { white: playerInfo, black: botInfo }
|
? { white: playerInfo, black: botInfo }
|
||||||
: { white: botInfo, black: playerInfo };
|
: { white: botInfo, black: playerInfo };
|
||||||
|
|
||||||
return this.http.post<GameFull>(`${this.apiBase}${this.apiPath}`, payload);
|
return this.http.post<GameFull>(`${this.apiBase}${this.apiPath}/vs-bot`, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
getGame(gameId: string): Observable<GameFull> {
|
getGame(gameId: string): Observable<GameFull> {
|
||||||
|
|||||||
@@ -40,10 +40,8 @@ export class TournamentService {
|
|||||||
return this.http.post<Tournament>(`${this.base}/${id}/start`, null);
|
return this.http.post<Tournament>(`${this.base}/${id}/start`, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
joinWithBotToken(id: string, botToken: string): Observable<void> {
|
join(id: string, botId: string, botName: string): Observable<void> {
|
||||||
return this.http.post<void>(`${this.base}/${id}/join`, null, {
|
return this.http.post<void>(`${this.base}/${id}/join`, { botId, botName });
|
||||||
headers: new HttpHeaders({ Authorization: `Bearer ${botToken}` })
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
roundPairings(id: string, round: number): Observable<RoundPairings> {
|
roundPairings(id: string, round: number): Observable<RoundPairings> {
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=2
|
MINOR=3
|
||||||
PATCH=7
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user