Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: user has to login every time chrome sidepanel is opened #5544

Merged
merged 37 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2451b44
remove cache dir
AdityaPimpalkar May 22, 2024
074111b
change host permissions to only accept http connection
AdityaPimpalkar May 22, 2024
7a0ba5c
remove oauth code and add cookies onChanged listner
AdityaPimpalkar May 22, 2024
6951aea
refacto: seperate url inputs from sidepanel
AdityaPimpalkar May 22, 2024
287e77d
move input urls to new settings page
AdityaPimpalkar May 22, 2024
ebaec87
add local storage listeners to change state
AdityaPimpalkar May 22, 2024
9a5c743
define inital state for auth tokens
AdityaPimpalkar May 22, 2024
b96e66a
add comment for changing host permission
AdityaPimpalkar May 22, 2024
b608480
Merge branch 'remove-oauth' into sidepanel-multi-login-fix
AdityaPimpalkar May 22, 2024
46053be
WindowEventEffect
AdityaPimpalkar May 23, 2024
acaa2ef
update sidepanelUrl
AdityaPimpalkar May 23, 2024
92ca1b8
window listners on sidepanel
AdityaPimpalkar May 23, 2024
e9c1c3e
lint fix
AdityaPimpalkar May 23, 2024
c374efd
navigation fix
AdityaPimpalkar May 23, 2024
7911d4c
state cleanup
AdityaPimpalkar May 23, 2024
3cc6bb0
lint fix
AdityaPimpalkar May 23, 2024
31eda67
add chromeExtensionId to client config
AdityaPimpalkar May 23, 2024
979fe16
add chromeExtensionId state to frontend
AdityaPimpalkar May 23, 2024
67255e9
add isDefined checks
AdityaPimpalkar May 23, 2024
34a1b1f
Merge branch 'main' into sidepanel-multi-login-fix
AdityaPimpalkar May 24, 2024
b74d372
remove renewToken mutation
AdityaPimpalkar May 27, 2024
0da579d
window event provider
AdityaPimpalkar May 27, 2024
00df4a8
add accessToken expiry condition on sidepanel
AdityaPimpalkar May 27, 2024
fe014b8
lint fix
AdityaPimpalkar May 27, 2024
1a986c0
button mount fix
AdityaPimpalkar May 27, 2024
02984da
remove dependency
AdityaPimpalkar May 27, 2024
436e2e5
lint fix
AdityaPimpalkar May 27, 2024
b544978
build fix on project.json
AdityaPimpalkar May 28, 2024
75eebb3
add settings button
AdityaPimpalkar May 28, 2024
9df6169
sidepanel internal navigation fix
AdityaPimpalkar May 28, 2024
3b342c7
split window event to provider and effect
AdityaPimpalkar May 28, 2024
41cbf1f
add sidepanel navigation
AdityaPimpalkar May 28, 2024
b65e195
read cookies from clientUrl upon cookie change
AdityaPimpalkar May 28, 2024
8a840f4
lint fix
AdityaPimpalkar May 28, 2024
5687625
Merge branch 'main' into sidepanel-multi-login-fix
AdityaPimpalkar May 28, 2024
e9a7815
yarn lock
AdityaPimpalkar May 28, 2024
0e1ba39
rename WindowEvent to ChromeExtensionSidecar
AdityaPimpalkar May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fix
  • Loading branch information
AdityaPimpalkar committed May 28, 2024
commit 8a840f4c27c4a4597e7719f86435ba6135695e79
62 changes: 31 additions & 31 deletions packages/twenty-front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
import { PageTitle } from '@/ui/utilities/page-title/PageTitle';
import { UserProvider } from '@/users/components/UserProvider';
import { UserProviderEffect } from '@/users/components/UserProviderEffect';
import { WindowEventEffect } from '@/window-event/components/WindowEventEffect';
import { WindowEventProvider } from '@/window-event/components/WindowEventProvider';
import { CommandMenuEffect } from '~/effect-components/CommandMenuEffect';
import { GotoHotkeysEffect } from '~/effect-components/GotoHotkeysEffect';
Expand Down Expand Up @@ -80,7 +81,6 @@ import { SettingsWorkspace } from '~/pages/settings/SettingsWorkspace';
import { SettingsWorkspaceMembers } from '~/pages/settings/SettingsWorkspaceMembers';
import { Tasks } from '~/pages/tasks/Tasks';
import { getPageTitleFromPath } from '~/utils/title-utils';
import { WindowEventEffect } from '@/window-event/components/WindowEventEffect';

const ProvidersThatNeedRouterContext = () => {
const { pathname } = useLocation();
Expand All @@ -90,36 +90,36 @@ const ProvidersThatNeedRouterContext = () => {
<>
<ApolloProvider>
<ClientConfigProviderEffect />
AdityaPimpalkar marked this conversation as resolved.
Show resolved Hide resolved
<ClientConfigProvider>
<WindowEventEffect />
<WindowEventProvider>
<UserProviderEffect />
<UserProvider>
<ApolloMetadataClientProvider>
<ObjectMetadataItemsProvider>
<PrefetchDataProvider>
<AppThemeProvider>
<SnackBarProvider>
<DialogManagerScope dialogManagerScopeId="dialog-manager">
<DialogManager>
<StrictMode>
<PromiseRejectionEffect />
<CommandMenuEffect />
<GotoHotkeysEffect />
<PageTitle title={pageTitle} />
<Outlet />
</StrictMode>
</DialogManager>
</DialogManagerScope>
</SnackBarProvider>
</AppThemeProvider>
</PrefetchDataProvider>
<PageChangeEffect />
</ObjectMetadataItemsProvider>
</ApolloMetadataClientProvider>
</UserProvider>
</WindowEventProvider>
</ClientConfigProvider>
<ClientConfigProvider>
<WindowEventEffect />
<WindowEventProvider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing before we merge in the current state, could we rename this into something more specific so that people understand they probably don't have to deal with this? I'm tempted to call it ChromeExtensionSidecarEffect and ChromeExtensionSidecarProvider or something like that for now. If eventually it becomes something more generic we can rename it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay!

<UserProviderEffect />
<UserProvider>
<ApolloMetadataClientProvider>
<ObjectMetadataItemsProvider>
<PrefetchDataProvider>
<AppThemeProvider>
<SnackBarProvider>
<DialogManagerScope dialogManagerScopeId="dialog-manager">
<DialogManager>
<StrictMode>
<PromiseRejectionEffect />
<CommandMenuEffect />
<GotoHotkeysEffect />
<PageTitle title={pageTitle} />
<Outlet />
</StrictMode>
</DialogManager>
</DialogManagerScope>
</SnackBarProvider>
</AppThemeProvider>
</PrefetchDataProvider>
<PageChangeEffect />
</ObjectMetadataItemsProvider>
</ApolloMetadataClientProvider>
</UserProvider>
</WindowEventProvider>
</ClientConfigProvider>
</ApolloProvider>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useRecoilValue, useSetRecoilState } from 'recoil';
import { tokenPairState } from '@/auth/states/tokenPairState';
import { chromeExtensionIdState } from '@/client-config/states/chromeExtensionIdState';
import { isLoadingTokensFromExtensionState } from '@/window-event/states/isLoadingTokensFromExtensionState';
import { isInFrame } from '~/utils/isInIframe';
import { isDefined } from '~/utils/isDefined';
import { isInFrame } from '~/utils/isInIframe';

export const WindowEventEffect = () => {
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ export const WindowEventProvider: React.FC<React.PropsWithChildren> = ({
if (!isInFrame()) return <>{children}</>;

if (!isDefined(chromeExtensionId))
return <AppInaccessible message={`Twenty is not accessible inside an iframe.`} />;

if(isDefined(isLoadingTokensFromExtension) && !isLoadingTokensFromExtension)
return <AppInaccessible message={`Unauthorized access from iframe origin. If you're trying to access from chrome extension,
return (
<AppInaccessible message={`Twenty is not accessible inside an iframe.`} />
);

if (isDefined(isLoadingTokensFromExtension) && !isLoadingTokensFromExtension)
return (
<AppInaccessible
message={`Unauthorized access from iframe origin. If you're trying to access from chrome extension,
please check your chrome extension ID on your server.
`} />;
`}
/>
);

return isLoadingTokensFromExtension && <>{children}</>;
};
Loading