@@ -10,6 +10,9 @@ interface Props {
1010export function SecuredYProvider ( { children, store} : PropsWithChildren < Props > ) {
1111 const securityState = useSecurityStateContext ( ) ;
1212
13+ const hash = typeof location != 'undefined' ? location . hash . slice ( 1 ) : '' ;
14+ const hashParameters = ! hash ? { } : Object . fromEntries ( new URLSearchParams ( hash ) as any ) ;
15+
1316 const initialYState : Partial < YState > = { slices : [ { store, slice : 'data' , //logging: true,
1417 providers : { webrtc : { options : { signaling : securityState . syncServerSessionWebrtc . settings . signaling , // TOOD till now all need share the same
1518 password : securityState . syncServerDataWebrtc . settings . password } } ,
@@ -20,16 +23,19 @@ export function SecuredYProvider({children, store}: PropsWithChildren<Props>) {
2023 websocket : { url : securityState . syncServerSessionWebsocket . settings . url } } } ,
2124 { store, slice : 'schema' , logging : true , // TODO
2225 providers : { webrtc : { options : { signaling : [ 'wss://yjs.winzlieb.eu' ] ,
23- password : 'TODO' } } ,
24- websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' } } } ,
26+ password : hashParameters . formId } } ,
27+ websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' ,
28+ room : hashParameters . formId } } } ,
2529 { store, slice : 'keys' , logging : true ,
2630 providers : { webrtc : { options : { signaling : [ 'wss://yjs.winzlieb.eu' ] ,
27- password : 'TODO' } } ,
28- websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' } } } ,
31+ password : hashParameters . formId } } ,
32+ websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' ,
33+ room : hashParameters . formId } } } ,
2934 { store, slice : 'cryptedData' , logging : true ,
3035 providers : { webrtc : { options : { signaling : [ 'wss://yjs.winzlieb.eu' ] ,
31- password : 'TODO' } } ,
32- websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' } } } ] }
36+ password : hashParameters . formId } } ,
37+ websocket : { url : 'wss://mqtt.afg.mission-lifeline.de' ,
38+ room : hashParameters . formId } } } ] }
3339
3440 return (
3541 < YProvider initialYState = { initialYState } >
0 commit comments