Skip to content

Commit f988f8b

Browse files
hashParameters.formId
1 parent 77c04bc commit f988f8b

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

packages/react-redux-yjs/features/YProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export function YConfigurator() {
106106
useEffect(
107107
() => {
108108
if(yContext) {
109+
//console.log({yContext})
109110
const destructors = yContext?.slices?.map( sliceState => configureSlice(sliceState) );
110111
//setYContext(yContext);
111112
// TODO use dispatch to set updated sliceStates?

packages/secured-react-redux-yjs/features/SecuredYProvider.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ interface Props {
1010
export 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}>

packages/security-state/features/react/SecurityIndicator.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { useSecurityStateContext } from './SecurityStateProvider';
1010
type OnClick = (event: React.MouseEvent<HTMLElement>) => void
1111

1212
export function SecurityIndicator({fakeLevel, onClick}: {fakeLevel?: SECURITY_LEVEL, onClick?: OnClick}) {
13-
const securityContext = useSecurityStateContext()
13+
//const securityContext = useSecurityStateContext(); console.log({securityContext})
1414
const { assessment } = useSecurityStateContext()?.syncServerSessionWebsocket || {}; // TODO minimum
1515
const level = fakeLevel || assessment;
1616
var icon;
17-
console.log({assessment, securityContext})
1817
switch(level) {
1918
case SECURITY_LEVEL.advanced:
2019
icon = <EnhancedEncryptionIcon sx={{backgroundColor: SECURITY_INDICATOR.advanced, color: 'white'}}/>;

0 commit comments

Comments
 (0)