diff --git a/backend/src/db/queries.ts b/backend/src/db/queries.ts index 429efcad..02fdf02e 100644 --- a/backend/src/db/queries.ts +++ b/backend/src/db/queries.ts @@ -35,7 +35,7 @@ function rowToRepo(row: RepoRow): Repo { } export function createRepo(db: Database, repo: CreateRepoInput): Repo { - const normalizedPath = repo.localPath.replace(/\/+$/, '') + const normalizedPath = repo.localPath.trim().replace(/\/+$/, '') const existing = repo.isLocal ? getRepoByLocalPath(db, normalizedPath) diff --git a/backend/src/services/files.ts b/backend/src/services/files.ts index b5b8752f..ac4b9a12 100644 --- a/backend/src/services/files.ts +++ b/backend/src/services/files.ts @@ -233,7 +233,8 @@ export async function renameOrMoveFile(userPath: string, body: { newPath: string } function validatePath(userPath: string): string { - const normalized = path.normalize(userPath).replace(/^(\.\.(\/|\\|$))+/, '') + const trimmed = userPath.trim() + const normalized = path.normalize(trimmed).replace(/^(\.\.(\/|\\|$))+/, '') const fullPath = path.join(SHARED_WORKSPACE_BASE, normalized) const resolved = path.resolve(fullPath) diff --git a/backend/src/services/repo.ts b/backend/src/services/repo.ts index b984dc3a..cb9feacb 100644 --- a/backend/src/services/repo.ts +++ b/backend/src/services/repo.ts @@ -108,7 +108,7 @@ export async function initLocalRepo( localPath: string, branch?: string ): Promise { - const normalizedPath = localPath.replace(/\/+$/, '') + const normalizedPath = localPath.trim().replace(/\/+$/, '') const fullPath = path.resolve(getReposPath(), normalizedPath) const existing = db.getRepoByLocalPath(database, normalizedPath) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 96a661c5..1dd958bb 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,6 +8,9 @@ import { SettingsDialog } from './components/settings/SettingsDialog' import { useSettingsDialog } from './hooks/useSettingsDialog' import { useTheme } from './hooks/useTheme' import { TTSProvider } from './contexts/TTSContext' +import { PermissionProvider } from '@/contexts/PermissionContext' +import { PermissionRequestDialog } from '@/components/session/PermissionRequestDialog' +import { usePermissionContext } from '@/contexts/PermissionContext' const queryClient = new QueryClient({ defaultOptions: { @@ -38,6 +41,30 @@ function AppContent() { closeButton /> +) +} + +function PermissionDialogWrapper() { + const { + currentPermission, + pendingCount, + isFromDifferentSession, + respondToPermission, + dismissPermission, + showDialog, + setShowDialog, + } = usePermissionContext() + + return ( + ) } @@ -46,7 +73,10 @@ function App() { return ( - + + + + ) diff --git a/frontend/src/components/layout/Header.tsx b/frontend/src/components/layout/Header.tsx index 13430f73..fe740158 100644 --- a/frontend/src/components/layout/Header.tsx +++ b/frontend/src/components/layout/Header.tsx @@ -1,4 +1,4 @@ -import { Settings } from "lucide-react"; +import { Settings, Bell } from "lucide-react"; import { Button } from "@/components/ui/button"; import { BackButton } from "@/components/ui/back-button"; import { useSettingsDialog } from "@/hooks/useSettingsDialog"; @@ -9,9 +9,11 @@ interface HeaderProps { title: string; backTo?: string; action?: ReactNode; + pendingPermissions?: number; + onPendingPermissionsClick?: () => void; } -export function Header({ title, backTo, action }: HeaderProps) { +export function Header({ title, backTo, action, pendingPermissions, onPendingPermissionsClick }: HeaderProps) { const { open: openSettings } = useSettingsDialog(); const theme = useTheme(); @@ -37,6 +39,22 @@ export function Header({ title, backTo, action }: HeaderProps) {
{action &&
{action}
} + {pendingPermissions !== undefined && pendingPermissions > 0 && ( + + )} + )} +