Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency @tf2pickup-org/mumble-protocol to v1.0.3 #451

Merged
merged 4 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
compressionLevel: mixed

defaultSemverRangePrefix: ""

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"bot"
],
"dependencies": {
"@tf2pickup-org/mumble-protocol": "1.0.2",
"@tf2pickup-org/mumble-protocol": "1.0.3",
"rxjs": "7.8.1"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe(Client.name, () => {
type: 0,
typeName: Version.typeName,
payload: Version.create({
version: 66790,
versionV1: 66790,
versionV2: BigInt(66790),
release: '1.4.230',
os: 'Linux',
osVersion: 'Ubuntu 20.04.4 LTS [x64]',
Expand Down
10 changes: 6 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { filterPacket } from './rxjs-operators/filter-packet';
import { platform, release } from 'os';
import { Permissions } from './permissions';
import { EventNames } from './event-names';
import { encodeMumbleVersionLegacy } from './encode-mumble-version-legacy';

const defaultOptions: Partial<ClientOptions> = {
port: 64738,
Expand Down Expand Up @@ -161,16 +162,17 @@ export class Client extends EventEmitter {
* @internal
*/
private async sendVersion(): Promise<void> {
const version = encodeMumbleVersion({
const version = {
major: 1,
minor: 4,
patch: 230,
});
patch: 287,
};
return await this.socket?.send(
Version,
Version.create({
release: this.options.clientName,
version,
versionV1: encodeMumbleVersionLegacy(version),
versionV2: encodeMumbleVersion(version),
os: platform(),
osVersion: release(),
}),
Expand Down
14 changes: 14 additions & 0 deletions src/encode-mumble-version-legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @internal
*/
export const encodeMumbleVersionLegacy = (version: {
major: number;
minor: number;
patch: number;
}) => {
// https://github.com/mumble-voip/mumble/issues/5827
const major = Math.min(version.major, 255);
const minor = Math.min(version.minor, 255);
const patch = Math.min(version.patch, 255);
return ((major & 0xffff) << 16) | ((minor & 0xff) << 8) | (patch & 0xff);
};
8 changes: 5 additions & 3 deletions src/encode-mumble-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const encodeMumbleVersion = (version: {
minor: number;
patch: number;
}) =>
((version.major & 0xffff) << 16) |
((version.minor & 0xff) << 8) |
(version.patch & 0xff);
BigInt(
((version.major & 0xffff) << 16) |
((version.minor & 0xff) << 8) |
(version.patch & 0xff),
);
Loading