mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
migrate to Protobuf ES
This commit is contained in:
parent
68e22d22bf
commit
fd55f4fb7f
133 changed files with 1745 additions and 1621 deletions
|
|
@ -8,15 +8,9 @@ vi.mock('websocket', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
vi.mock('websocket/services/ProtoController', () => ({
|
||||
ProtoController: {
|
||||
root: {
|
||||
ServerInfo_User: {
|
||||
UserLevelFlag: {
|
||||
IsModerator: 4,
|
||||
},
|
||||
},
|
||||
},
|
||||
vi.mock('generated/proto/serverinfo_user_pb', () => ({
|
||||
ServerInfo_User_UserLevelFlag: {
|
||||
IsModerator: 4,
|
||||
},
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { StatusEnum, User, WebSocketConnectReason, WebSocketConnectOptions } from 'types';
|
||||
import { SessionCommands, webClient } from 'websocket';
|
||||
import { ProtoController } from 'websocket/services/ProtoController';
|
||||
import { ServerInfo_User_UserLevelFlag } from 'generated/proto/serverinfo_user_pb';
|
||||
|
||||
export class AuthenticationService {
|
||||
static login(options: WebSocketConnectOptions): void {
|
||||
|
|
@ -40,7 +40,7 @@ export class AuthenticationService {
|
|||
}
|
||||
|
||||
static isModerator(user: User): boolean {
|
||||
const moderatorLevel = ProtoController.root.ServerInfo_User.UserLevelFlag.IsModerator;
|
||||
const moderatorLevel = ServerInfo_User_UserLevelFlag.IsModerator;
|
||||
// @TODO tell cockatrice not to do this so shittily
|
||||
return (user.userLevel & moderatorLevel) === moderatorLevel;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue