Compare commits

...

3 Commits

Author SHA1 Message Date
chuckbutkus
38ce58d684 Merge branch 'main' into convo-redirect 2025-05-27 12:03:17 -04:00
Chuck Butkus
affba2e7e9 Test fix 2025-05-27 01:51:26 -04:00
Chuck Butkus
489851aa12 Don't display convo error if not authenticated 2025-05-27 01:16:14 -04:00
2 changed files with 12 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ import { useDocumentTitleFromState } from "#/hooks/use-document-title-from-state
import { transformVSCodeUrl } from "#/utils/vscode-url-helper";
import OpenHands from "#/api/open-hands";
import { TabContent } from "#/components/layout/tab-content";
import { useIsAuthed } from "#/hooks/query/use-is-authed";
function AppContent() {
useConversationConfig();
@@ -43,6 +44,7 @@ function AppContent() {
const { data: settings } = useSettings();
const { conversationId } = useConversationId();
const { data: conversation, isFetched } = useActiveConversation();
const { data: isAuthed } = useIsAuthed();
const { curAgentState } = useSelector((state: RootState) => state.agent);
const dispatch = useDispatch();
@@ -54,13 +56,13 @@ function AppContent() {
const [width, setWidth] = React.useState(window.innerWidth);
React.useEffect(() => {
if (isFetched && !conversation) {
if (isFetched && !conversation && isAuthed) {
displayErrorToast(
"This conversation does not exist, or you do not have permission to access it.",
);
navigate("/");
}
}, [conversation, isFetched]);
}, [conversation, isFetched, isAuthed]);
React.useEffect(() => {
dispatch(clearTerminal());

View File

@@ -24,7 +24,14 @@ class LocalhostCORSMiddleware(CORSMiddleware):
while using standard CORS rules for other origins.
"""
def __init__(self, app: ASGIApp) -> None:
def __init__(
self,
app,
allow_origins=None,
allow_credentials=False,
allow_methods=None,
allow_headers=None,
):
allow_origins_str = os.getenv('PERMITTED_CORS_ORIGINS')
if allow_origins_str:
allow_origins = tuple(