Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2898033
D9609.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9609.diff
View Options
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -26,6 +26,7 @@
combineLoadingStatuses,
} from 'lib/selectors/loading-selectors.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
+import { TunnelbrokerProvider } from 'lib/tunnelbroker/tunnelbroker-context.js';
import type { LoadingStatus } from 'lib/types/loading-types.js';
import type { Dispatch } from 'lib/types/redux-types.js';
import { registerConfig } from 'lib/utils/config.js';
@@ -62,6 +63,7 @@
import VisibilityHandler from './redux/visibility-handler.react.js';
import history from './router-history.js';
import { MessageSearchStateProvider } from './search/message-search-state-provider.react.js';
+import { createTunnelbrokerInitMessage } from './selectors/tunnelbroker-selectors.js';
import AccountSettings from './settings/account-settings.react.js';
import DangerZone from './settings/danger-zone.react.js';
import CommunityPicker from './sidebar/community-picker.react.js';
@@ -77,6 +79,7 @@
// so we disable the autoAddCss logic and import the CSS file. Otherwise every
// icon flashes huge for a second before the CSS is loaded.
import '@fortawesome/fontawesome-svg-core/styles.css';
+
faConfig.autoAddCss = false;
registerConfig({
@@ -110,6 +113,7 @@
+dispatch: Dispatch,
+modals: $ReadOnlyArray<React.Node>,
};
+
class App extends React.PureComponent<Props> {
componentDidMount() {
const {
@@ -363,17 +367,21 @@
[modalContext.modals],
);
+ const tunnelbrokerInitMessage = useSelector(createTunnelbrokerInitMessage);
+
return (
<AppThemeWrapper>
- <App
- {...props}
- navInfo={navInfo}
- entriesLoadingStatus={entriesLoadingStatus}
- loggedIn={loggedIn}
- activeThreadCurrentlyUnread={activeThreadCurrentlyUnread}
- dispatch={dispatch}
- modals={modals}
- />
+ <TunnelbrokerProvider initMessage={tunnelbrokerInitMessage}>
+ <App
+ {...props}
+ navInfo={navInfo}
+ entriesLoadingStatus={entriesLoadingStatus}
+ loggedIn={loggedIn}
+ activeThreadCurrentlyUnread={activeThreadCurrentlyUnread}
+ dispatch={dispatch}
+ modals={modals}
+ />
+ </TunnelbrokerProvider>
</AppThemeWrapper>
);
},
diff --git a/web/selectors/tunnelbroker-selectors.js b/web/selectors/tunnelbroker-selectors.js
new file mode 100644
--- /dev/null
+++ b/web/selectors/tunnelbroker-selectors.js
@@ -0,0 +1,30 @@
+// @flow
+
+import { createSelector } from 'reselect';
+
+import type { ConnectionInitializationMessage } from 'lib/types/tunnelbroker/session-types.js';
+
+import type { AppState } from '../redux/redux-setup.js';
+
+export const createTunnelbrokerInitMessage: AppState => ?ConnectionInitializationMessage =
+ createSelector(
+ state => state.cryptoStore.primaryIdentityKeys?.ed25519,
+ state => state.commServicesAccessToken,
+ state => state.currentUserInfo?.id,
+ (
+ deviceID: ?string,
+ accessToken: ?string,
+ userID: ?string,
+ ): ?ConnectionInitializationMessage => {
+ if (!deviceID || !accessToken || !userID) {
+ return null;
+ }
+ return ({
+ type: 'ConnectionInitializationMessage',
+ deviceID,
+ accessToken,
+ userID,
+ deviceType: 'web',
+ }: ConnectionInitializationMessage);
+ },
+ );
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 6, 1:25 AM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2247231
Default Alt Text
D9609.diff (3 KB)
Attached To
Mode
D9609: [web] create Tunnelbroker session
Attached
Detach File
Event Timeline
Log In to Comment