Desktop: Update node dependencies
This commit is contained in:
parent
f6ea970790
commit
4e4aa45440
2
.github/workflows/ringrtc.yml
vendored
2
.github/workflows/ringrtc.yml
vendored
@ -74,7 +74,7 @@ jobs:
|
||||
run: npm ci
|
||||
working-directory: src/node
|
||||
- name: Check typescript
|
||||
run: npm run eslint
|
||||
run: npm run oxlint
|
||||
working-directory: src/node
|
||||
- name: Check package.json for prebuildChecksum
|
||||
run: >-
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
build/**
|
||||
dist/**
|
||||
|
||||
# TypeScript generated files
|
||||
ts/**/*.js
|
||||
@ -1,145 +0,0 @@
|
||||
// Copyright 2018-2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
const rules = {
|
||||
'comma-dangle': [
|
||||
'error',
|
||||
{
|
||||
arrays: 'always-multiline',
|
||||
objects: 'always-multiline',
|
||||
imports: 'always-multiline',
|
||||
exports: 'always-multiline',
|
||||
functions: 'never',
|
||||
},
|
||||
],
|
||||
|
||||
// prevents us from accidentally checking in exclusive tests (`.only`):
|
||||
'mocha/no-exclusive-tests': 'error',
|
||||
|
||||
// it helps readability to put public API at top,
|
||||
'no-use-before-define': 'off',
|
||||
|
||||
// useful for unused or internal fields
|
||||
'no-underscore-dangle': 'off',
|
||||
|
||||
// though we have a logger, we still remap console to log to disk
|
||||
'no-console': 'error',
|
||||
|
||||
// consistently place operators at end of line except ternaries
|
||||
'operator-linebreak': [
|
||||
'error',
|
||||
'after',
|
||||
{ overrides: { '?': 'ignore', ':': 'ignore' } },
|
||||
],
|
||||
|
||||
quotes: [
|
||||
'error',
|
||||
'single',
|
||||
{ avoidEscape: true, allowTemplateLiterals: false },
|
||||
],
|
||||
|
||||
'no-continue': 'off',
|
||||
'no-bitwise': 'off',
|
||||
'no-plusplus': 'off',
|
||||
|
||||
// Prettier overrides:
|
||||
'arrow-parens': 'off',
|
||||
'function-paren-newline': 'off',
|
||||
|
||||
// We prefer named exports
|
||||
'import/prefer-default-export': 'off',
|
||||
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector: 'ForInStatement',
|
||||
message:
|
||||
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
||||
},
|
||||
{
|
||||
selector: 'LabeledStatement',
|
||||
message:
|
||||
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
||||
},
|
||||
{
|
||||
selector: 'WithStatement',
|
||||
message:
|
||||
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
||||
},
|
||||
],
|
||||
curly: 'error',
|
||||
|
||||
'prefer-template': 'error',
|
||||
|
||||
// Things present in our existing code that we may want to be stricter about in the future.
|
||||
eqeqeq: 'off',
|
||||
// The RingRTC singleton is used in VideoSupport; maybe we should untangle this.
|
||||
'import/no-cycle': 'off',
|
||||
};
|
||||
|
||||
const typescriptRules = {
|
||||
...rules,
|
||||
|
||||
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
|
||||
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
||||
|
||||
// Overrides recommended by typescript-eslint
|
||||
// https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-shadow': ['error', { ignoreOnInitialization: true }],
|
||||
'@typescript-eslint/no-useless-constructor': ['error'],
|
||||
'no-shadow': 'off',
|
||||
'no-useless-constructor': 'off',
|
||||
|
||||
// useful for unused parameters
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
|
||||
// Upgrade from a warning
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
||||
|
||||
// Already enforced by TypeScript
|
||||
'consistent-return': 'off',
|
||||
|
||||
// Things present in our existing code that we may want to be stricter about in the future.
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
es2018: true,
|
||||
},
|
||||
settings: {
|
||||
'import/core-modules': ['electron'],
|
||||
},
|
||||
|
||||
extends: ['eslint:recommended', 'prettier'],
|
||||
|
||||
plugins: ['import', 'mocha', 'more'],
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
],
|
||||
rules: typescriptRules,
|
||||
},
|
||||
],
|
||||
|
||||
rules,
|
||||
};
|
||||
@ -1 +1 @@
|
||||
22.20.0
|
||||
24.15.0
|
||||
|
||||
1565
src/node/.oxlintrc.json
Normal file
1565
src/node/.oxlintrc.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,48 +5,50 @@
|
||||
|
||||
import { RingRTCType } from './ringrtc/Service';
|
||||
|
||||
export type {
|
||||
AudioDevice,
|
||||
CallId,
|
||||
CallSettings,
|
||||
DeviceId,
|
||||
GroupCallObserver,
|
||||
HttpResult,
|
||||
PeekDeviceInfo,
|
||||
PeekInfo,
|
||||
Reaction,
|
||||
UserId,
|
||||
VideoFrameSender,
|
||||
VideoFrameSource,
|
||||
} from './ringrtc/Service';
|
||||
export {
|
||||
AnswerMessage,
|
||||
AudioDevice,
|
||||
DataMode,
|
||||
BusyMessage,
|
||||
Call,
|
||||
CallEndReason,
|
||||
CallId,
|
||||
CallLogLevel,
|
||||
CallMessageUrgency,
|
||||
CallRejectReason,
|
||||
CallSettings,
|
||||
CallState,
|
||||
CallingMessage,
|
||||
ConnectionState,
|
||||
DeviceId,
|
||||
GroupCall,
|
||||
GroupCallKind,
|
||||
GroupCallObserver,
|
||||
GroupMemberInfo,
|
||||
HangupMessage,
|
||||
HangupType,
|
||||
HttpMethod,
|
||||
HttpResult,
|
||||
IceCandidateMessage,
|
||||
JoinState,
|
||||
LocalDeviceState,
|
||||
OfferMessage,
|
||||
OfferType,
|
||||
OpaqueMessage,
|
||||
PeekDeviceInfo,
|
||||
PeekInfo,
|
||||
PeekStatusCodes,
|
||||
Reaction,
|
||||
RemoteDeviceState,
|
||||
RingCancelReason,
|
||||
RingRTCType,
|
||||
RingUpdate,
|
||||
SpeechEvent,
|
||||
UserId,
|
||||
VideoFrameSender,
|
||||
VideoFrameSource,
|
||||
VideoPixelFormatEnum,
|
||||
videoPixelFormatToEnum,
|
||||
VideoRequest,
|
||||
|
||||
5071
src/node/package-lock.json
generated
5071
src/node/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -24,8 +24,8 @@
|
||||
"build": "tsc && bash scripts/build-help.sh",
|
||||
"clean": "rimraf dist",
|
||||
"test": "electron-mocha --renderer --recursive dist/test --timeout 10000 --require source-map-support/register",
|
||||
"eslint": "eslint .",
|
||||
"lint": "npm run format --list-different && npm run eslint",
|
||||
"oxlint": "oxlint --format=stylish",
|
||||
"lint": "npm run format --list-different && npm run oxlint",
|
||||
"format": "prettier --write .",
|
||||
"check-format": "prettier . --check",
|
||||
"install": "node scripts/fetch-prebuild.js",
|
||||
@ -39,32 +39,35 @@
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"https-proxy-agent": "7.0.6",
|
||||
"tar": "^7.5.2"
|
||||
"tar": "7.5.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "5.2.3",
|
||||
"@types/chai-as-promised": "^8.0.2",
|
||||
"@types/lodash": "^4.17.21",
|
||||
"@types/chai-as-promised": "8.0.2",
|
||||
"@types/lodash": "4.17.21",
|
||||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "25.0.3",
|
||||
"@types/sinon-chai": "^4.0.0",
|
||||
"chai": "6.2.2",
|
||||
"chai-as-promised": "^8.0.2",
|
||||
"electron": "39.2.4",
|
||||
"chai-as-promised": "8.0.2",
|
||||
"electron": "42.3.0",
|
||||
"electron-mocha": "13.1.0",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-airbnb-typescript-prettier": "5.0.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-import": "2.29.0",
|
||||
"eslint-plugin-mocha": "10.2.0",
|
||||
"eslint-plugin-more": "1.0.5",
|
||||
"lodash": "4.17.23",
|
||||
"mocha": "11.3.0",
|
||||
"prettier": "3.7.4",
|
||||
"rimraf": "6.1.2",
|
||||
"sinon": "^21.0.1",
|
||||
"sinon-chai": "^4.0.1",
|
||||
"lodash": "4.18.1",
|
||||
"mocha": "11.7.6",
|
||||
"oxlint": "1.65.0",
|
||||
"oxlint-tsgolint": "0.22.1",
|
||||
"prettier": "3.8.3",
|
||||
"rimraf": "6.1.3",
|
||||
"sinon": "22.0.0",
|
||||
"sinon-chai": "4.0.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"typescript": "5.9.3"
|
||||
"typescript": "6.0.3"
|
||||
},
|
||||
"overrides": {
|
||||
"mocha": {
|
||||
"brace-expansion": "2.0.3",
|
||||
"diff": "8.0.3",
|
||||
"serialize-javascript": "7.0.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,17 +26,17 @@ export class CallLinkRootKey {
|
||||
}
|
||||
|
||||
static generateAdminPassKey(): Uint8Array<ArrayBuffer> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
// oxlint-disable-next-line typescript/no-unsafe-return
|
||||
return Native.CallLinkRootKey_generateAdminPasskey();
|
||||
}
|
||||
|
||||
deriveRoomId(): Uint8Array<ArrayBuffer> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
// oxlint-disable-next-line typescript/no-unsafe-return
|
||||
return Native.CallLinkRootKey_deriveRoomId(this.bytes);
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
// oxlint-disable-next-line typescript/no-unsafe-return
|
||||
return Native.CallLinkRootKey_toFormattedString(this.bytes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
import * as os from 'os';
|
||||
import * as process from 'process';
|
||||
import * as os from 'node:os';
|
||||
import * as process from 'node:process';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-dynamic-require
|
||||
// oxlint-disable-next-line typescript/no-var-requires import/no-dynamic-require node/global-require
|
||||
export default require(
|
||||
`../../build/${os.platform()}/libringrtc-${process.arch}.node`
|
||||
);
|
||||
|
||||
@ -3,14 +3,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
import {
|
||||
CallLinkState,
|
||||
CallLinkRestrictions,
|
||||
CallLinkRootKey,
|
||||
} from './CallLinks';
|
||||
import { CallSummary } from './CallSummary';
|
||||
import type { CallSummary } from './CallSummary';
|
||||
import Native from './Native';
|
||||
|
||||
const INVALID_CLIENT_ID = 0;
|
||||
@ -39,23 +37,19 @@ class NativeCallManager {
|
||||
}
|
||||
|
||||
private createCallEndpoint(config: Config) {
|
||||
const fieldTrials = Object.assign(
|
||||
{
|
||||
'RingRTC-AnyAddressPortsKillSwitch': 'Enabled',
|
||||
'RingRTC-PruneTurnPorts': 'Enabled',
|
||||
'WebRTC-Bwe-ProbingConfiguration':
|
||||
'skip_if_est_larger_than_fraction_of_max:0.99',
|
||||
'WebRTC-IncreaseIceCandidatePriorityHostSrflx': 'Enabled',
|
||||
},
|
||||
config.field_trials
|
||||
);
|
||||
const fieldTrials = {
|
||||
'RingRTC-AnyAddressPortsKillSwitch': 'Enabled',
|
||||
'RingRTC-PruneTurnPorts': 'Enabled',
|
||||
'WebRTC-Bwe-ProbingConfiguration':
|
||||
'skip_if_est_larger_than_fraction_of_max:0.99',
|
||||
'WebRTC-IncreaseIceCandidatePriorityHostSrflx': 'Enabled',
|
||||
...config.field_trials,
|
||||
};
|
||||
|
||||
/* eslint-disable prefer-template */
|
||||
const fieldTrialsString =
|
||||
Object.entries(fieldTrials)
|
||||
.map(([k, v]) => `${k}/${v}`)
|
||||
.join('/') + '/';
|
||||
/* eslint-enable prefer-template */
|
||||
Object.defineProperty(this, Native.callEndpointPropertyKey, {
|
||||
configurable: true, // allows it to be changed
|
||||
get() {
|
||||
@ -65,7 +59,7 @@ class NativeCallManager {
|
||||
configurable: true, // allows it to be changed
|
||||
value: callEndpoint,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
// oxlint-disable-next-line typescript/no-unsafe-return
|
||||
return callEndpoint;
|
||||
},
|
||||
});
|
||||
@ -171,18 +165,18 @@ class NativeCallManager {
|
||||
type GroupId = Uint8Array<ArrayBuffer>;
|
||||
type GroupCallUserId = Uint8Array<ArrayBuffer>;
|
||||
|
||||
export interface PeekDeviceInfo {
|
||||
export type PeekDeviceInfo = {
|
||||
demuxId: number;
|
||||
userId?: GroupCallUserId;
|
||||
}
|
||||
};
|
||||
|
||||
export interface Reaction {
|
||||
export type Reaction = {
|
||||
demuxId: number;
|
||||
value: string;
|
||||
}
|
||||
};
|
||||
|
||||
/** type returned by Rust */
|
||||
export interface RawPeekInfo {
|
||||
export type RawPeekInfo = {
|
||||
devices: Array<PeekDeviceInfo>;
|
||||
creator?: GroupCallUserId;
|
||||
eraId?: string;
|
||||
@ -193,10 +187,10 @@ export interface RawPeekInfo {
|
||||
deviceCountExcludingPendingDevices: number;
|
||||
pendingUsers: Array<GroupCallUserId>;
|
||||
callLinkState?: RawCallLinkState;
|
||||
}
|
||||
};
|
||||
|
||||
/** type derived from RawPeekInfo */
|
||||
export interface PeekInfo {
|
||||
export type PeekInfo = {
|
||||
devices: Array<PeekDeviceInfo>;
|
||||
creator?: GroupCallUserId;
|
||||
eraId?: string;
|
||||
@ -207,7 +201,7 @@ export interface PeekInfo {
|
||||
deviceCountExcludingPendingDevices: number;
|
||||
pendingUsers: Array<GroupCallUserId>;
|
||||
callLinkState?: CallLinkState;
|
||||
}
|
||||
};
|
||||
|
||||
export enum PeekStatusCodes {
|
||||
EXPIRED_CALL_LINK = 703,
|
||||
@ -264,13 +258,13 @@ export class ReceivedAudioLevel {
|
||||
}
|
||||
}
|
||||
|
||||
interface RawCallLinkState {
|
||||
type RawCallLinkState = {
|
||||
name: string;
|
||||
rawRestrictions: number;
|
||||
revoked: boolean;
|
||||
expiration: Date;
|
||||
rootKey: Uint8Array<ArrayBuffer>;
|
||||
}
|
||||
};
|
||||
|
||||
function normalizeAudioLevel(raw: RawAudioLevel): NormalizedAudioLevel {
|
||||
return raw / 32767;
|
||||
@ -299,9 +293,8 @@ function rawCallLinkStateToCallLinkState(
|
||||
raw.expiration,
|
||||
new CallLinkRootKey(raw.rootKey)
|
||||
);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function rawPeekInfoToPeekInfo(raw: RawPeekInfo): PeekInfo {
|
||||
@ -312,8 +305,10 @@ function rawPeekInfoToPeekInfo(raw: RawPeekInfo): PeekInfo {
|
||||
}
|
||||
|
||||
class Requests<T> {
|
||||
private _resolveById: Map<number, [(response: T) => void, () => void]> =
|
||||
new Map();
|
||||
private readonly _resolveById = new Map<
|
||||
number,
|
||||
[(response: T) => void, () => void]
|
||||
>();
|
||||
private _nextId = 1;
|
||||
|
||||
add(): [number, Promise<T>] {
|
||||
@ -370,13 +365,13 @@ export type HttpResult<T> =
|
||||
export class RingRTCType {
|
||||
private readonly callManager: CallManager;
|
||||
private _call: Call | null;
|
||||
private _groupCallByClientId: Map<GroupCallClientId, GroupCall>;
|
||||
private _peekRequests: Requests<HttpResult<PeekInfo>>;
|
||||
private _callLinkRequests: Requests<HttpResult<CallLinkState>>;
|
||||
private _emptyRequests: Requests<HttpResult<undefined>>;
|
||||
private readonly _groupCallByClientId: Map<GroupCallClientId, GroupCall>;
|
||||
private readonly _peekRequests: Requests<HttpResult<PeekInfo>>;
|
||||
private readonly _callLinkRequests: Requests<HttpResult<CallLinkState>>;
|
||||
private readonly _emptyRequests: Requests<HttpResult<undefined>>;
|
||||
|
||||
// A map to hold call information not maintained in RingRTC.
|
||||
private _callInfoByCallId: Map<string, CallInfo>;
|
||||
private readonly _callInfoByCallId: Map<string, CallInfo>;
|
||||
|
||||
private getCallInfoKey(callId: CallId): string {
|
||||
return callId.toString();
|
||||
@ -928,6 +923,7 @@ export class RingRTCType {
|
||||
message: CallingMessage
|
||||
): void {
|
||||
if (!broadcast) {
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
message.destinationDeviceId = remoteDeviceId;
|
||||
}
|
||||
|
||||
@ -1273,15 +1269,14 @@ export class RingRTCType {
|
||||
return promise.then(result => {
|
||||
if (result.success) {
|
||||
return result.value;
|
||||
} else {
|
||||
return {
|
||||
devices: [],
|
||||
deviceCount: 0,
|
||||
deviceCountIncludingPendingDevices: 0,
|
||||
deviceCountExcludingPendingDevices: 0,
|
||||
pendingUsers: [],
|
||||
};
|
||||
}
|
||||
return {
|
||||
devices: [],
|
||||
deviceCount: 0,
|
||||
deviceCountIncludingPendingDevices: 0,
|
||||
deviceCountExcludingPendingDevices: 0,
|
||||
pendingUsers: [],
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@ -1973,24 +1968,24 @@ export class RingRTCType {
|
||||
}
|
||||
}
|
||||
|
||||
export interface CallSettings {
|
||||
export type CallSettings = {
|
||||
iceServers: Array<IceServer>;
|
||||
hideIp: boolean;
|
||||
dataMode: DataMode;
|
||||
audioLevelsIntervalMillis?: number;
|
||||
dredDuration?: number;
|
||||
}
|
||||
};
|
||||
|
||||
interface IceServer {
|
||||
type IceServer = {
|
||||
username?: string;
|
||||
password?: string;
|
||||
/** Provide hostname when urls contain IP addresses instead of hostname */
|
||||
hostname?: string;
|
||||
urls: Array<string>;
|
||||
}
|
||||
};
|
||||
|
||||
// Describes an audio input or output device.
|
||||
export interface AudioDevice {
|
||||
export type AudioDevice = {
|
||||
// Device name.
|
||||
name: string;
|
||||
// Index of this device, starting from 0.
|
||||
@ -1999,7 +1994,7 @@ export interface AudioDevice {
|
||||
uniqueId: string;
|
||||
// If present, the identifier of a localized string to substitute for the device name.
|
||||
i18nKey?: string;
|
||||
}
|
||||
};
|
||||
|
||||
// Given a weird name to not conflict with WebCodec's VideoPixelFormat
|
||||
export enum VideoPixelFormatEnum {
|
||||
@ -2030,7 +2025,7 @@ export function videoPixelFormatToEnum(
|
||||
* VideoFrameSender is used to transmit video frames (from a camera or screen share) over
|
||||
* RTP via the RingRTC library.
|
||||
*/
|
||||
export interface VideoFrameSender {
|
||||
export type VideoFrameSender = {
|
||||
/**
|
||||
* Sends a video frame to be transmitted via RingRTC.
|
||||
*
|
||||
@ -2045,12 +2040,12 @@ export interface VideoFrameSender {
|
||||
format: VideoPixelFormatEnum,
|
||||
buffer: Uint8Array<ArrayBuffer>
|
||||
): void;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for retrieving received video frames from the RingRTC library.
|
||||
*/
|
||||
export interface VideoFrameSource {
|
||||
export type VideoFrameSource = {
|
||||
/**
|
||||
* Copies the latest frame into `buffer`.
|
||||
*
|
||||
@ -2072,7 +2067,7 @@ export interface VideoFrameSource {
|
||||
maxWidth: number,
|
||||
maxHeight: number
|
||||
): [number, number] | undefined;
|
||||
}
|
||||
};
|
||||
|
||||
export class Call {
|
||||
// The calls' info and state.
|
||||
@ -2463,7 +2458,7 @@ export enum GroupCallKind {
|
||||
CallLink,
|
||||
}
|
||||
|
||||
export interface GroupCallObserver {
|
||||
export type GroupCallObserver = {
|
||||
requestMembershipProof(groupCall: GroupCall): void;
|
||||
requestGroupMembers(groupCall: GroupCall): void;
|
||||
onLocalDeviceStateChanged(groupCall: GroupCall): void;
|
||||
@ -2485,7 +2480,7 @@ export interface GroupCallObserver {
|
||||
sourceDemuxId: number,
|
||||
targetDemuxId: number
|
||||
): void;
|
||||
}
|
||||
};
|
||||
|
||||
export class GroupCall {
|
||||
private readonly _kind: GroupCallKind;
|
||||
@ -2498,7 +2493,7 @@ export class GroupCall {
|
||||
return this._clientId;
|
||||
}
|
||||
|
||||
private _localDeviceState: LocalDeviceState;
|
||||
private readonly _localDeviceState: LocalDeviceState;
|
||||
private _remoteDeviceStates: Array<RemoteDeviceState> | undefined;
|
||||
|
||||
private _peekInfo: PeekInfo | undefined;
|
||||
@ -2754,7 +2749,7 @@ export class GroupCall {
|
||||
// We don't get aspect ratios from RingRTC, so make sure to copy them over.
|
||||
for (const noo of remoteDeviceStates) {
|
||||
const old = this._remoteDeviceStates?.find(
|
||||
old => old.demuxId == noo.demuxId
|
||||
candidate => candidate.demuxId == noo.demuxId
|
||||
);
|
||||
noo.videoAspectRatio = old?.videoAspectRatio;
|
||||
}
|
||||
@ -2962,7 +2957,7 @@ export enum RingCancelReason {
|
||||
Busy,
|
||||
}
|
||||
|
||||
export interface CallManager {
|
||||
export type CallManager = {
|
||||
setConfig(config: Config): void;
|
||||
setSelfUuid(uuid: Uint8Array<ArrayBuffer>): void;
|
||||
addAsset(
|
||||
@ -3193,9 +3188,9 @@ export interface CallManager {
|
||||
getAudioOutputs(): Array<AudioDevice>;
|
||||
setAudioOutput(index: number): void;
|
||||
setVoiceProcessingEnabled(enabled: boolean): void;
|
||||
}
|
||||
};
|
||||
|
||||
export interface CallManagerCallbacks {
|
||||
export type CallManagerCallbacks = {
|
||||
onStartOutgoingCall(remoteUserId: UserId, callId: CallId): void;
|
||||
onStartIncomingCall(
|
||||
remoteUserId: UserId,
|
||||
@ -3317,7 +3312,7 @@ export interface CallManagerCallbacks {
|
||||
line: number,
|
||||
message: string
|
||||
): void;
|
||||
}
|
||||
};
|
||||
|
||||
export enum CallState {
|
||||
Prering = 'idle',
|
||||
@ -3392,9 +3387,8 @@ export enum CallLogLevel {
|
||||
|
||||
function sillyDeadlockProtection(f: () => void) {
|
||||
void (async () => {
|
||||
// This is a silly way of preventing a deadlock.
|
||||
// eslint-disable-next-line @typescript-eslint/await-thenable
|
||||
await 0;
|
||||
// Yield so f() runs after unwinding the calling stack.
|
||||
await Promise.resolve();
|
||||
|
||||
f();
|
||||
})();
|
||||
|
||||
@ -3,16 +3,14 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const https = require('https');
|
||||
const https = require('node:https');
|
||||
const { HttpsProxyAgent } = require('https-proxy-agent');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const crypto = require('node:crypto');
|
||||
const tar = require('tar');
|
||||
const { Transform } = require('stream');
|
||||
const { pipeline } = require('stream/promises');
|
||||
const { Transform } = require('node:stream');
|
||||
const { pipeline } = require('node:stream/promises');
|
||||
|
||||
const VERSION = process.env.npm_package_version;
|
||||
|
||||
@ -35,7 +33,7 @@ if (process.env.npm_package_json) {
|
||||
}
|
||||
|
||||
const URL = config.prebuildUrl.replace(
|
||||
'${npm_package_version}', // eslint-disable-line no-template-curly-in-string
|
||||
'${npm_package_version}', // oxlint-disable-line eslint/no-template-curly-in-string
|
||||
VERSION
|
||||
);
|
||||
const HASH = config.prebuildChecksum;
|
||||
@ -71,7 +69,7 @@ async function downloadIfNeeded() {
|
||||
function download() {
|
||||
console.log(`downloading ${URL}`);
|
||||
return new Promise((resolve, reject) => {
|
||||
let options = {};
|
||||
const options = {};
|
||||
if (process.env.HTTPS_PROXY != undefined) {
|
||||
options.agent = new HttpsProxyAgent(process.env.HTTPS_PROXY);
|
||||
}
|
||||
@ -107,4 +105,4 @@ function download() {
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@ -3,33 +3,31 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-disable no-console, @typescript-eslint/require-await, @typescript-eslint/no-unused-vars */
|
||||
/* oxlint-disable eslint/no-console typescript/no-unused-vars */
|
||||
|
||||
import {
|
||||
DataMode,
|
||||
import type {
|
||||
Call,
|
||||
CallRejectReason,
|
||||
CallId,
|
||||
CallingMessage,
|
||||
CallLogLevel,
|
||||
CallMessageUrgency,
|
||||
CallSettings,
|
||||
CallState,
|
||||
HttpMethod,
|
||||
RingUpdate,
|
||||
UserId,
|
||||
} from '../ringrtc/Service';
|
||||
import { DataMode, CallLogLevel, CallState } from '../ringrtc/Service';
|
||||
import { RingRTC } from '../index';
|
||||
import { log, sleep, uuidToBytes } from './Utils';
|
||||
|
||||
// This class mimics the Desktop Client CallingClass in ts/services/calling.ts to facilitate testing
|
||||
export class CallingClass {
|
||||
private _name: string;
|
||||
private _id: string;
|
||||
private _localDeviceId: number;
|
||||
private readonly _name: string;
|
||||
private readonly _id: string;
|
||||
private readonly _localDeviceId: number;
|
||||
private _call: Call | undefined;
|
||||
private _delayIncomingCallSettingsRequest: number;
|
||||
private _delayOutgoingCallSettingsRequest: number;
|
||||
private readonly _delayOutgoingCallSettingsRequest: number;
|
||||
|
||||
set delayIncomingCallSettingsRequest(value: number) {
|
||||
this._delayIncomingCallSettingsRequest = value;
|
||||
@ -49,7 +47,7 @@ export class CallingClass {
|
||||
}
|
||||
|
||||
private setupCallCallbacks(call: Call) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
call.handleStateChanged = () => {
|
||||
log('handleCallStateChanged');
|
||||
log(`call.state === ${call.state}`);
|
||||
@ -59,17 +57,17 @@ export class CallingClass {
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
call.handleRemoteAudioEnabled = () => {
|
||||
log('handleRemoteAudioEnabled');
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
call.handleRemoteVideoEnabled = () => {
|
||||
log('handleRemoteVideoEnabled');
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
call.handleRemoteSharingScreen = () => {
|
||||
log('handleRemoteSharingScreen');
|
||||
};
|
||||
|
||||
@ -3,31 +3,34 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* oxlint-disable typescript/no-non-null-assertion */
|
||||
|
||||
import { assert, expect, should, use } from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import { createHash, randomBytes } from 'crypto';
|
||||
import {
|
||||
import { createHash, randomBytes } from 'node:crypto';
|
||||
import type {
|
||||
CallEndReason,
|
||||
callIdFromEra,
|
||||
CallingMessage,
|
||||
CallSummary,
|
||||
GroupCall,
|
||||
Reaction,
|
||||
SpeechEvent,
|
||||
} from '../index';
|
||||
import {
|
||||
callIdFromEra,
|
||||
CallLinkRestrictions,
|
||||
CallLinkRootKey,
|
||||
CallRejectReason,
|
||||
CallState,
|
||||
CallSummary,
|
||||
GroupCall,
|
||||
GroupCallKind,
|
||||
GroupMemberInfo,
|
||||
HttpMethod,
|
||||
OfferType,
|
||||
PeekStatusCodes,
|
||||
Reaction,
|
||||
RingRTC,
|
||||
SpeechEvent,
|
||||
} from '../index';
|
||||
import sinon, { SinonSpy } from 'sinon';
|
||||
import type { SinonSpy } from 'sinon';
|
||||
import sinon from 'sinon';
|
||||
import sinonChai from 'sinon-chai';
|
||||
import { CallingClass } from './CallingClass';
|
||||
import { countDownLatch, log, sleep, uuidToBytes } from './Utils';
|
||||
@ -46,7 +49,7 @@ function generateOfferCallingMessage(callId: bigint): CallingMessage {
|
||||
);
|
||||
return {
|
||||
offer: {
|
||||
callId: callId,
|
||||
callId,
|
||||
opaque: audioOnlySdp,
|
||||
type: OfferType.AudioCall,
|
||||
},
|
||||
@ -90,7 +93,7 @@ describe('RingRTC', () => {
|
||||
reason: CallRejectReason;
|
||||
ageSec: number;
|
||||
}>((resolve, _reject) => {
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* oxlint-disable typescript/no-shadow */
|
||||
RingRTC.handleRejectedIncomingCallRequest = (
|
||||
_callId,
|
||||
_remoteUserId,
|
||||
@ -99,7 +102,7 @@ describe('RingRTC', () => {
|
||||
) => {
|
||||
resolve({ reason, ageSec });
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/no-shadow */
|
||||
/* oxlint-enable typescript/no-shadow */
|
||||
RingRTC.handleCallingMessage(offer, {
|
||||
remoteUserId: 'remote',
|
||||
remoteDeviceId: 4,
|
||||
@ -143,7 +146,7 @@ describe('RingRTC', () => {
|
||||
reason: CallRejectReason;
|
||||
ageSec: number;
|
||||
}>((resolve, _reject) => {
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* oxlint-disable typescript/no-shadow */
|
||||
RingRTC.handleRejectedIncomingCallRequest = (
|
||||
_callId,
|
||||
_remoteUserId,
|
||||
@ -152,7 +155,7 @@ describe('RingRTC', () => {
|
||||
) => {
|
||||
resolve({ reason, ageSec });
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/no-shadow */
|
||||
/* oxlint-enable typescript/no-shadow */
|
||||
RingRTC.handleCallingMessage(offer, {
|
||||
remoteUserId: 'remote',
|
||||
remoteDeviceId: 4,
|
||||
@ -277,7 +280,9 @@ describe('RingRTC', () => {
|
||||
delayIncomingCallSettings: number,
|
||||
delayOutgoingCallSettings: number
|
||||
) {
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
calling.delayOutgoingCallSettingsRequest = delayOutgoingCallSettings;
|
||||
// oxlint-disable-next-line eslint/no-param-reassign
|
||||
calling.delayIncomingCallSettingsRequest = delayIncomingCallSettings;
|
||||
|
||||
const outgoingCallLatch = countDownLatch(1);
|
||||
@ -1103,7 +1108,7 @@ describe('RingRTC', () => {
|
||||
});
|
||||
|
||||
class NullGroupObserver {
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* oxlint-disable typescript/no-empty-function */
|
||||
requestMembershipProof(_call: GroupCall) {}
|
||||
requestGroupMembers(_call: GroupCall) {}
|
||||
onLocalDeviceStateChanged(_call: GroupCall) {}
|
||||
@ -1125,7 +1130,7 @@ describe('RingRTC', () => {
|
||||
_sourceDemuxId: number,
|
||||
_targetDemuxId: number
|
||||
) {}
|
||||
/* eslint-enable @typescript-eslint/no-empty-function */
|
||||
/* oxlint-enable typescript/no-empty-function */
|
||||
}
|
||||
|
||||
it('can create a call and try to connect', async () => {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-disable no-console */
|
||||
/* oxlint-disable eslint/no-console */
|
||||
|
||||
import { chunk } from 'lodash';
|
||||
import { assert } from 'chai';
|
||||
@ -18,15 +18,16 @@ export function countDownLatch(count: number): {
|
||||
resolve = resolveInternal;
|
||||
});
|
||||
|
||||
let remaining = count;
|
||||
const countDown = () => {
|
||||
count--;
|
||||
if (count == 0) {
|
||||
remaining--;
|
||||
if (remaining == 0) {
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
countDown: countDown,
|
||||
countDown,
|
||||
finished,
|
||||
};
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true
|
||||
"stripInternal": true,
|
||||
"types": ["mocha", "node"]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user