Skip to content

Commit

Permalink
chore(deps): upgrade to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Mar 15, 2024
1 parent 5d46199 commit d81e930
Show file tree
Hide file tree
Showing 7 changed files with 3,033 additions and 852 deletions.
3,847 changes: 3,015 additions & 832 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"sdp": "^3.2.0",
"secure-file-transfer": "^0.0.7",
"streamsaver": "^2.0.6",
"trystero": "^0.15.0",
"trystero": "^0.18.0",
"typeface-public-sans": "^1.1.13",
"typeface-roboto": "^1.1.13",
"typescript": "^5.4.2",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Room/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export function Room({
} = useRoom(
{
appId,
trackerUrls,
relayUrls: trackerUrls,
rtcConfig,
password,
trackerRedundancy: 4,
relayRedundancy: 4,
},
{
roomId,
Expand Down
6 changes: 3 additions & 3 deletions src/components/Room/useRoom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContext, useEffect, useMemo, useState } from 'react'
import { BaseRoomConfig } from 'trystero'
import { TorrentRoomConfig } from 'trystero/torrent'
import { RelayConfig } from 'trystero/torrent'
import { v4 as uuid } from 'uuid'
import { useDebounce } from '@react-hook/debounce'

Expand Down Expand Up @@ -45,14 +45,14 @@ interface UseRoomConfig {
timeService?: typeof time
}

interface UserMetadata {
interface UserMetadata extends Record<string, any> {
userId: string
customUsername: string
publicKeyString: string
}

export function useRoom(
{ password, ...roomConfig }: BaseRoomConfig & TorrentRoomConfig,
{ password, ...roomConfig }: BaseRoomConfig & RelayConfig,
{
roomId,
userId,
Expand Down
10 changes: 4 additions & 6 deletions src/lib/ConnectionTest/ConnectionTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTrackers } from 'trystero/torrent'
import { getRelaySockets } from 'trystero/torrent'
import { rtcConfig } from 'config/rtcConfig'
import { parseCandidate } from 'sdp'

Expand Down Expand Up @@ -104,17 +104,15 @@ export class ConnectionTest extends EventTarget {
}

testTrackerConnection() {
const trackers = getTrackers()
const relaySockets = Object.values(getRelaySockets())

const trackerSockets = Object.values(trackers)

if (trackerSockets.length === 0) {
if (relaySockets.length === 0) {
// Trystero has not yet initialized tracker sockets
this.trackerConnection = TrackerConnection.SEARCHING
return this.trackerConnection
}

const readyStates = trackerSockets.map(({ readyState }) => readyState)
const readyStates = relaySockets.map(({ readyState }) => readyState)

const haveAllTrackerConnectionsFailed = readyStates.every(
readyState => readyState === WebSocket.CLOSED
Expand Down
10 changes: 5 additions & 5 deletions src/lib/PeerRoom/PeerRoom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinRoom, Room, BaseRoomConfig } from 'trystero'
import { TorrentRoomConfig } from 'trystero/torrent'
import { joinRoom, Room, BaseRoomConfig, DataPayload } from 'trystero'
import { RelayConfig } from 'trystero/torrent'

import { sleep } from 'lib/sleep'

Expand Down Expand Up @@ -27,7 +27,7 @@ const streamQueueAddDelay = 1000
export class PeerRoom {
private room: Room

private roomConfig: TorrentRoomConfig & BaseRoomConfig
private roomConfig: RelayConfig & BaseRoomConfig

private peerJoinHandlers: Map<
PeerHookType,
Expand Down Expand Up @@ -60,7 +60,7 @@ export class PeerRoom {
this.isProcessingPendingStreams = false
}

constructor(config: TorrentRoomConfig & BaseRoomConfig, roomId: string) {
constructor(config: RelayConfig & BaseRoomConfig, roomId: string) {
this.roomConfig = config
this.room = joinRoom(this.roomConfig, roomId)

Expand Down Expand Up @@ -167,7 +167,7 @@ export class PeerRoom {
return peerConnections
}

makeAction = <T>(namespace: string) => {
makeAction = <T extends DataPayload>(namespace: string) => {
return this.room.makeAction<T>(namespace)
}

Expand Down
6 changes: 3 additions & 3 deletions src/models/chat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface UnsentMessage {
export interface UnsentMessage extends Record<string, any> {
id: string
text: string
timeSent: number
Expand Down Expand Up @@ -73,11 +73,11 @@ export const isInlineMedia = (
return 'magnetURI' in message
}

export interface FileOfferMetadata {
export interface FileOfferMetadata extends Record<string, any> {
magnetURI: string
isAllInlineMedia: boolean
}

export interface TypingStatus {
export interface TypingStatus extends Record<string, any> {
isTyping: boolean
}

0 comments on commit d81e930

Please sign in to comment.