Update protocol and client features src

This commit is contained in:
seavor 2026-05-07 18:18:38 -05:00
parent 6006d6f2fa
commit 254410d025
8 changed files with 16 additions and 26 deletions

1
.gitignore vendored
View file

@ -15,3 +15,4 @@ compile_commands.json
.gdb_history .gdb_history
cockatrice/resources/config/qtlogging.ini cockatrice/resources/config/qtlogging.ini
docs/ docs/
.claude/settings.local.json

View file

@ -19,12 +19,13 @@ import { afterEach, beforeEach, vi } from 'vitest';
import { ServerDispatch, RoomsDispatch, GameDispatch } from '@app/store'; import { ServerDispatch, RoomsDispatch, GameDispatch } from '@app/store';
import { Data } from '@app/types'; import { Data } from '@app/types';
import { PROTOCOL_VERSION } from 'sockatrice';
import { WebClient, setPendingOptions } from '@app/websocket'; import { WebClient, setPendingOptions } from '@app/websocket';
import { WebsocketTypes } from '@app/websocket/types'; import { WebsocketTypes } from '@app/websocket/types';
import { import {
CLIENT_CONFIG, CLIENT_CONFIG,
CLIENT_OPTIONS, CLIENT_OPTIONS,
PROTOCOL_VERSION,
createWebClientResponse, createWebClientResponse,
} from '@app/api'; } from '@app/api';
@ -205,7 +206,6 @@ beforeEach(() => {
createWebClientResponse(), createWebClientResponse(),
CLIENT_CONFIG, CLIENT_CONFIG,
CLIENT_OPTIONS, CLIENT_OPTIONS,
PROTOCOL_VERSION,
); );
}); });

View file

@ -35,7 +35,7 @@
"react-virtualized-auto-sizer": "^2.0.3", "react-virtualized-auto-sizer": "^2.0.3",
"react-window": "^2.2.7", "react-window": "^2.2.7",
"rxjs": "^7.5.4", "rxjs": "^7.5.4",
"sockatrice": "https://github.com/seavor/Sockatrice/releases/download/v2.1.3/sockatrice-2.1.3.tgz" "sockatrice": "https://github.com/seavor/Sockatrice/releases/download/v2.2.0/sockatrice-2.2.0.tgz"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
@ -5373,9 +5373,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/sockatrice": { "node_modules/sockatrice": {
"version": "2.1.3", "version": "2.2.0",
"resolved": "https://github.com/seavor/Sockatrice/releases/download/v2.1.3/sockatrice-2.1.3.tgz", "resolved": "https://github.com/seavor/Sockatrice/releases/download/v2.2.0/sockatrice-2.2.0.tgz",
"integrity": "sha512-xywXolumrums59NteojtdmVKfjF8Ah71ewseczecZBqSmNAQ6zhM9enhmukWLvgQJr0rh7o1RDX5m+54kct+vA==", "integrity": "sha512-OMM+aLDLObGOCWLm+ME9ph+Zb65ELLi3jCDA1E5i4Uh+dRJgH9O/ulLjptjSYiQcQHZp0VoF980TBa93j0belQ==",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"dependencies": { "dependencies": {
"@bufbuild/protobuf": "^2.11.0", "@bufbuild/protobuf": "^2.11.0",

View file

@ -60,7 +60,7 @@
"react-virtualized-auto-sizer": "^2.0.3", "react-virtualized-auto-sizer": "^2.0.3",
"react-window": "^2.2.7", "react-window": "^2.2.7",
"rxjs": "^7.5.4", "rxjs": "^7.5.4",
"sockatrice": "https://github.com/seavor/Sockatrice/releases/download/v2.1.3/sockatrice-2.1.3.tgz" "sockatrice": "https://github.com/seavor/Sockatrice/releases/download/v2.2.0/sockatrice-2.2.0.tgz"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",

View file

@ -1,24 +1,16 @@
import { SOCKATRICE_FEATURES } from 'sockatrice';
import type { WebsocketTypes } from '@app/websocket/types'; import type { WebsocketTypes } from '@app/websocket/types';
export const PROTOCOL_VERSION = 14; const APP_FEATURES = [
'2.7.0_min_version',
'2.8.0_min_version',
] as const;
export const CLIENT_CONFIG: WebsocketTypes.ClientConfig = { export const CLIENT_CONFIG: WebsocketTypes.ClientConfig = {
clientid: 'webatrice', clientid: 'webatrice',
clientver: 'webclient-1.0 (2019-10-31)', clientver: 'webclient-1.0 (2019-10-31)',
clientfeatures: [ clientfeatures: [...SOCKATRICE_FEATURES, ...APP_FEATURES],
'client_id',
'client_ver',
'feature_set',
'room_chat_history',
'client_warnings',
'forgot_password',
'idle_client',
'mod_log_lookup',
'user_ban_history',
'websocket',
'2.7.0_min_version',
'2.8.0_min_version',
],
}; };
export const CLIENT_OPTIONS: WebsocketTypes.ClientOptions = { export const CLIENT_OPTIONS: WebsocketTypes.ClientOptions = {

View file

@ -1,2 +1,2 @@
export { createWebClientResponse } from './response'; export { createWebClientResponse } from './response';
export { CLIENT_CONFIG, CLIENT_OPTIONS, PROTOCOL_VERSION } from './clientConfig'; export { CLIENT_CONFIG, CLIENT_OPTIONS } from './clientConfig';

View file

@ -10,7 +10,6 @@ vi.mock('@app/api', () => ({
createWebClientResponse: vi.fn(() => 'response'), createWebClientResponse: vi.fn(() => 'response'),
CLIENT_CONFIG: { clientid: 'test', clientver: 'test', clientfeatures: [] }, CLIENT_CONFIG: { clientid: 'test', clientver: 'test', clientfeatures: [] },
CLIENT_OPTIONS: { autojoinrooms: false, keepalive: 5000 }, CLIENT_OPTIONS: { autojoinrooms: false, keepalive: 5000 },
PROTOCOL_VERSION: 14,
})); }));
function Wrapper({ children }: { children: ReactNode }) { function Wrapper({ children }: { children: ReactNode }) {

View file

@ -3,7 +3,6 @@ import { WebClient } from '@app/websocket';
import { import {
CLIENT_CONFIG, CLIENT_CONFIG,
CLIENT_OPTIONS, CLIENT_OPTIONS,
PROTOCOL_VERSION,
createWebClientResponse, createWebClientResponse,
} from '@app/api'; } from '@app/api';
@ -15,7 +14,6 @@ export function WebClientProvider({ children }: { children: ReactNode }) {
createWebClientResponse(), createWebClientResponse(),
CLIENT_CONFIG, CLIENT_CONFIG,
CLIENT_OPTIONS, CLIENT_OPTIONS,
PROTOCOL_VERSION,
)); ));
return <WebClientContext value={client}>{children}</WebClientContext>; return <WebClientContext value={client}>{children}</WebClientContext>;