forked from Shiloh/remnantchat
chore(deps): use trystero@0.15.0
This commit is contained in:
parent
ab18b795c8
commit
1cf4b50ac2
11
package-lock.json
generated
11
package-lock.json
generated
@ -46,7 +46,7 @@
|
|||||||
"sdp": "^3.2.0",
|
"sdp": "^3.2.0",
|
||||||
"secure-file-transfer": "^0.0.7",
|
"secure-file-transfer": "^0.0.7",
|
||||||
"streamsaver": "^2.0.6",
|
"streamsaver": "^2.0.6",
|
||||||
"trystero": "^0.13.1",
|
"trystero": "^0.15.0",
|
||||||
"typeface-public-sans": "^1.1.13",
|
"typeface-public-sans": "^1.1.13",
|
||||||
"typeface-roboto": "^1.1.13",
|
"typeface-roboto": "^1.1.13",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
@ -25716,8 +25716,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/trystero": {
|
"node_modules/trystero": {
|
||||||
"version": "0.13.1",
|
"version": "0.15.0",
|
||||||
"license": "MIT",
|
"resolved": "https://registry.npmjs.org/trystero/-/trystero-0.15.0.tgz",
|
||||||
|
"integrity": "sha512-BsHx1OlMQOvGbWb5OZ8hIZUyH9H2V6HjdvsnvOLBd2LruoFn20zwJrK5kqK9K2hl/VaW1ln0dMC3E4pQb75rbA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"firebase": "^9.6.5",
|
"firebase": "^9.6.5",
|
||||||
"ipfs-core": "0.9.0",
|
"ipfs-core": "0.9.0",
|
||||||
@ -42784,7 +42785,9 @@
|
|||||||
"version": "1.0.1"
|
"version": "1.0.1"
|
||||||
},
|
},
|
||||||
"trystero": {
|
"trystero": {
|
||||||
"version": "0.13.1",
|
"version": "0.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/trystero/-/trystero-0.15.0.tgz",
|
||||||
|
"integrity": "sha512-BsHx1OlMQOvGbWb5OZ8hIZUyH9H2V6HjdvsnvOLBd2LruoFn20zwJrK5kqK9K2hl/VaW1ln0dMC3E4pQb75rbA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"firebase": "^9.6.5",
|
"firebase": "^9.6.5",
|
||||||
"ipfs-core": "npm:dry-uninstall",
|
"ipfs-core": "npm:dry-uninstall",
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"sdp": "^3.2.0",
|
"sdp": "^3.2.0",
|
||||||
"secure-file-transfer": "^0.0.7",
|
"secure-file-transfer": "^0.0.7",
|
||||||
"streamsaver": "^2.0.6",
|
"streamsaver": "^2.0.6",
|
||||||
"trystero": "^0.13.1",
|
"trystero": "^0.15.0",
|
||||||
"typeface-public-sans": "^1.1.13",
|
"typeface-public-sans": "^1.1.13",
|
||||||
"typeface-roboto": "^1.1.13",
|
"typeface-roboto": "^1.1.13",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
|
|
||||||
import { PeerRoom } from 'services/PeerRoom'
|
|
||||||
import { PeerActions } from 'models/network'
|
|
||||||
|
|
||||||
export function usePeerRoomAction<T>(peerRoom: PeerRoom, action: PeerActions) {
|
|
||||||
const [peerRoomAction] = useState(() => peerRoom.makeAction<T>(action))
|
|
||||||
|
|
||||||
return peerRoomAction
|
|
||||||
}
|
|
@ -30,8 +30,6 @@ import { fileTransfer } from 'services/FileTransfer'
|
|||||||
|
|
||||||
import { messageTranscriptSizeLimit } from 'config/messaging'
|
import { messageTranscriptSizeLimit } from 'config/messaging'
|
||||||
|
|
||||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
|
||||||
|
|
||||||
interface UseRoomConfig {
|
interface UseRoomConfig {
|
||||||
roomId: string
|
roomId: string
|
||||||
userId: string
|
userId: string
|
||||||
@ -156,7 +154,7 @@ export function useRoom(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const [sendTypingStatusChange, receiveTypingStatusChange] =
|
const [sendTypingStatusChange, receiveTypingStatusChange] =
|
||||||
usePeerRoomAction<TypingStatus>(peerRoom, PeerActions.TYPING_STATUS_CHANGE)
|
peerRoom.makeAction<TypingStatus>(PeerActions.TYPING_STATUS_CHANGE)
|
||||||
|
|
||||||
const [isTyping, setIsTypingDebounced, setIsTyping] = useDebounce(
|
const [isTyping, setIsTypingDebounced, setIsTyping] = useDebounce(
|
||||||
false,
|
false,
|
||||||
@ -199,17 +197,17 @@ export function useRoom(
|
|||||||
}, [isShowingMessages, setUnreadMessages])
|
}, [isShowingMessages, setUnreadMessages])
|
||||||
|
|
||||||
const [sendPeerMetadata, receivePeerMetadata] =
|
const [sendPeerMetadata, receivePeerMetadata] =
|
||||||
usePeerRoomAction<UserMetadata>(peerRoom, PeerActions.PEER_METADATA)
|
peerRoom.makeAction<UserMetadata>(PeerActions.PEER_METADATA)
|
||||||
|
|
||||||
const [sendMessageTranscript, receiveMessageTranscript] = usePeerRoomAction<
|
const [sendMessageTranscript, receiveMessageTranscript] = peerRoom.makeAction<
|
||||||
Array<ReceivedMessage | ReceivedInlineMedia>
|
Array<ReceivedMessage | ReceivedInlineMedia>
|
||||||
>(peerRoom, PeerActions.MESSAGE_TRANSCRIPT)
|
>(PeerActions.MESSAGE_TRANSCRIPT)
|
||||||
|
|
||||||
const [sendPeerMessage, receivePeerMessage] =
|
const [sendPeerMessage, receivePeerMessage] =
|
||||||
usePeerRoomAction<UnsentMessage>(peerRoom, PeerActions.MESSAGE)
|
peerRoom.makeAction<UnsentMessage>(PeerActions.MESSAGE)
|
||||||
|
|
||||||
const [sendPeerInlineMedia, receivePeerInlineMedia] =
|
const [sendPeerInlineMedia, receivePeerInlineMedia] =
|
||||||
usePeerRoomAction<UnsentInlineMedia>(peerRoom, PeerActions.MEDIA_MESSAGE)
|
peerRoom.makeAction<UnsentInlineMedia>(PeerActions.MEDIA_MESSAGE)
|
||||||
|
|
||||||
const sendMessage = async (message: string) => {
|
const sendMessage = async (message: string) => {
|
||||||
if (isMessageSending) return
|
if (isMessageSending) return
|
||||||
|
@ -5,8 +5,6 @@ import { PeerActions } from 'models/network'
|
|||||||
import { AudioState, Peer } from 'models/chat'
|
import { AudioState, Peer } from 'models/chat'
|
||||||
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
||||||
|
|
||||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
|
||||||
|
|
||||||
interface UseRoomAudioConfig {
|
interface UseRoomAudioConfig {
|
||||||
peerRoom: PeerRoom
|
peerRoom: PeerRoom
|
||||||
}
|
}
|
||||||
@ -34,8 +32,7 @@ export function useRoomAudio({ peerRoom }: UseRoomAudioConfig) {
|
|||||||
})()
|
})()
|
||||||
}, [audioStream])
|
}, [audioStream])
|
||||||
|
|
||||||
const [sendAudioChange, receiveAudioChange] = usePeerRoomAction<AudioState>(
|
const [sendAudioChange, receiveAudioChange] = peerRoom.makeAction<AudioState>(
|
||||||
peerRoom,
|
|
||||||
PeerActions.AUDIO_CHANGE
|
PeerActions.AUDIO_CHANGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ import { PeerRoom, PeerHookType } from 'services/PeerRoom'
|
|||||||
|
|
||||||
import { fileTransfer } from 'services/FileTransfer/index'
|
import { fileTransfer } from 'services/FileTransfer/index'
|
||||||
|
|
||||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
|
||||||
|
|
||||||
interface UseRoomFileShareConfig {
|
interface UseRoomFileShareConfig {
|
||||||
onInlineMediaUpload: (files: File[]) => void
|
onInlineMediaUpload: (files: File[]) => void
|
||||||
peerRoom: PeerRoom
|
peerRoom: PeerRoom
|
||||||
@ -36,10 +34,7 @@ export function useRoomFileShare({
|
|||||||
const { peerOfferedFileMetadata, setPeerOfferedFileMetadata } = roomContext
|
const { peerOfferedFileMetadata, setPeerOfferedFileMetadata } = roomContext
|
||||||
|
|
||||||
const [sendFileOfferMetadata, receiveFileOfferMetadata] =
|
const [sendFileOfferMetadata, receiveFileOfferMetadata] =
|
||||||
usePeerRoomAction<FileOfferMetadata | null>(
|
peerRoom.makeAction<FileOfferMetadata | null>(PeerActions.FILE_OFFER)
|
||||||
peerRoom,
|
|
||||||
PeerActions.FILE_OFFER
|
|
||||||
)
|
|
||||||
|
|
||||||
receiveFileOfferMetadata((fileOfferMetadata, peerId) => {
|
receiveFileOfferMetadata((fileOfferMetadata, peerId) => {
|
||||||
if (fileOfferMetadata) {
|
if (fileOfferMetadata) {
|
||||||
|
@ -7,8 +7,6 @@ import { PeerActions } from 'models/network'
|
|||||||
import { ScreenShareState, Peer, VideoStreamType } from 'models/chat'
|
import { ScreenShareState, Peer, VideoStreamType } from 'models/chat'
|
||||||
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
||||||
|
|
||||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
|
||||||
|
|
||||||
interface UseRoomScreenShareConfig {
|
interface UseRoomScreenShareConfig {
|
||||||
peerRoom: PeerRoom
|
peerRoom: PeerRoom
|
||||||
}
|
}
|
||||||
@ -28,7 +26,7 @@ export function useRoomScreenShare({ peerRoom }: UseRoomScreenShareConfig) {
|
|||||||
} = roomContext
|
} = roomContext
|
||||||
|
|
||||||
const [sendScreenShare, receiveScreenShare] =
|
const [sendScreenShare, receiveScreenShare] =
|
||||||
usePeerRoomAction<ScreenShareState>(peerRoom, PeerActions.SCREEN_SHARE)
|
peerRoom.makeAction<ScreenShareState>(PeerActions.SCREEN_SHARE)
|
||||||
|
|
||||||
receiveScreenShare((screenState, peerId) => {
|
receiveScreenShare((screenState, peerId) => {
|
||||||
const newPeerList = peerList.map(peer => {
|
const newPeerList = peerList.map(peer => {
|
||||||
|
@ -8,8 +8,6 @@ import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
|||||||
|
|
||||||
import { isRecord } from 'utils'
|
import { isRecord } from 'utils'
|
||||||
|
|
||||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
|
||||||
|
|
||||||
interface UseRoomVideoConfig {
|
interface UseRoomVideoConfig {
|
||||||
peerRoom: PeerRoom
|
peerRoom: PeerRoom
|
||||||
}
|
}
|
||||||
@ -70,8 +68,7 @@ export function useRoomVideo({ peerRoom }: UseRoomVideoConfig) {
|
|||||||
})()
|
})()
|
||||||
}, [peerRoom, selfVideoStream, setSelfVideoStream])
|
}, [peerRoom, selfVideoStream, setSelfVideoStream])
|
||||||
|
|
||||||
const [sendVideoChange, receiveVideoChange] = usePeerRoomAction<VideoState>(
|
const [sendVideoChange, receiveVideoChange] = peerRoom.makeAction<VideoState>(
|
||||||
peerRoom,
|
|
||||||
PeerActions.VIDEO_CHANGE
|
PeerActions.VIDEO_CHANGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user