Skip to content

Commit

Permalink
change url check to starts with
Browse files Browse the repository at this point in the history
  • Loading branch information
nizzyabi committed Dec 28, 2024
1 parent 1f27441 commit 5d4ecae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/web/lib/plain/plainChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ const PlainChat = () => {

const isAppDomain = useMemo(() => {
const restrictedPaths = process.env.NEXT_PUBLIC_PLAIN_CHAT_EXCLUDED_PATHS?.split(",") || [];
const pathSegments = pathname?.split("/").filter(Boolean) || [];

return (
typeof window !== "undefined" &&
window.location.origin === process.env.NEXT_PUBLIC_WEBAPP_URL &&
!restrictedPaths.some((path) => pathname?.includes(path.trim()))
!restrictedPaths.some((path) => pathSegments.some((segment) => segment.startsWith(path.trim())))
);
}, [pathname]);

Expand Down

0 comments on commit 5d4ecae

Please sign in to comment.