Skip to content

Development - all changes#19

Merged
venu123143 merged 37 commits intomainfrom
development
Dec 28, 2025
Merged

Development - all changes#19
venu123143 merged 37 commits intomainfrom
development

Conversation

@venu123143
Copy link
Copy Markdown
Owner

@venu123143 venu123143 commented Dec 28, 2025

Summary by CodeRabbit

  • New Features

    • Added API token management to Settings for secure integrations
    • Added active sessions tracking and remote logout capability
    • Introduced PIN-based protection for sensitive files
    • Added file access level control (Public/Protected/Private)
    • Added theme toggle (Light/Dark/System)
    • Implemented file downloads with timestamps
    • Added Recent Files widget to dashboard
  • Improvements

    • Enhanced file sorting and filtering options
    • Improved notification display and interactions
    • Better upload experience with access level preservation

✏️ Tip: You can customize this high-level summary in your review settings.

venu123143 and others added 30 commits September 23, 2025 12:01
protected route and private route added
skip and forward 10 seconds in the video player changes
Darkmode, lightmode and Ui responsive changes as well as Toggle accesslevel changes
lazy loading implemented for routes
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 28, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces comprehensive authentication, session, and file management features: API token generation/revocation, PIN-based verification, active session management, file access-level controls (public/protected/private), a notification UI system, theme support (light/dark/system), multipart file uploads, and token refresh mechanisms with queue management. It also adds dependencies, lazy-loads routes, and updates settings and file management pages accordingly.

Changes

Cohort / File(s) Summary
API Token Management
src/api/api-token.api.ts
New module exposing generateToken, listTokens, revokeToken functions for API token CRUD operations
Authentication & Session APIs
src/api/auth.api.ts
Extended with PIN management (setPin, verifyPin, changePin), session retrieval (getSession, getActiveSessions), and token operations (refreshToken, revokeToken, revokeAllTokens)
File Access & Upload APIs
src/api/file.api.ts, src/api/upload.api.ts
New upload module with multipart/direct upload support; file.api extended with getPrivateFiles, getRecents, updateFileAccessLevel
Notification API
src/api/notification.api.ts
Signature updated: offset parameter changed to cursor (string) for cursor-based pagination
Token Refresh & Interceptors
src/api/axios.ts
Complete rewrite: added request interceptor for Bearer token injection, response interceptor with 401 handling, token refresh queue mechanism, and logout utility
API Contexts
src/contexts/ApiTokenContext.tsx, src/contexts/NotificationUIContext.tsx
New contexts for API token state management and notification UI rendering with show/remove/clear operations
Theme Context
src/contexts/ThemeContext.tsx
New context providing light/dark/system theme selection with localStorage persistence and system preference listening
Notification State Management
src/contexts/NotificationContext.tsx
Migrated from offset-based to cursor-based pagination; added refreshNotifications; replaced totalCount with nextCursor and hasMore flags
Auth State Management
src/contexts/useAuth.tsx
Extended with PIN session handling, PIN operations (setPin, verifyPin, changePin), session retrieval, and token/logout-all management
File State Management
src/contexts/fileContext.tsx, src/contexts/UploadContext.tsx
fileContext: added privateFiles and recents queries with updateFileAccessLevel mutation; UploadContext: replaced direct API calls with React Query mutations and added per-file button loading states
Access Level UI
src/components/file-manager/ChangeAccessLevelModal.tsx, src/components/file-manager/FileGridItem.tsx, src/components/file-manager/FileListItem.tsx
New modal for changing file access level; grid and list items extended with access-level submenu (Public/Protected/Private) with checkmarks and icons
Notification UI
src/components/custom/notification-popup.tsx
New NotificationPopup and NotificationContainer components with auto-dismiss, click-to-view, progress bar, and stacked layout
Recent Files & Sorting
src/components/file-manager/RecentFiles.tsx, src/components/file-manager/Toolbar.tsx
New RecentFiles component; Toolbar props extended with sortDirection and onSortChange for prop-driven sort state
Video Player Enhancements
src/components/player/VideoPlayer.tsx, src/components/player/VideoPlayerModal.tsx
Added skip controls (±10s via double-click desktop/double-tap mobile) with visual indicators; error handling improved
Settings Components
src/components/settings/api-token-settings.tsx, src/components/settings/active-sessions.tsx, src/components/settings/settings-content.tsx, src/components/settings/settings-header.tsx, src/components/settings/settings-page.tsx, src/components/settings/settings-tabs.tsx
New API token and active session management UIs; settings restructured with PIN setup/change flows, theme selector, and new tabs (PIN, API Token, Sessions); header now displays user display name
Layout & Theme Toggle
src/components/layouts/top-bar.tsx, src/components/ui/button.tsx, src/components/ui/calendar.tsx, src/components/ui/sonner.tsx
Theme toggle button added to top bar; button cursor styling enhanced; new Calendar component wrapping DayPicker; Sonner toaster switched to ThemeContext
File Management Pages
src/pages/all-files-page.tsx, src/pages/private-files-page.tsx, src/pages/shared-files-page.tsx, src/pages/deleted-files-page.tsx
All-files: added size-based sorting and updateFileAccessLevel; private-files: added PIN verification gate, breadcrumb navigation, and access-level controls; shared-files: refactored for multi-tab view with real data; deleted-files: added size sorting
Upload & Home Pages
src/routes/Upload.tsx, src/pages/home-dashboard.tsx
Upload page: added accessLevel prop pass-through; home: replaced mock recent files with RecentFiles component, added folder creation and personalized greeting
Session & PIN Verification
src/components/session/VerifyPin.tsx
New modal component for PIN verification with 4-digit input, PIN-not-set detection, and required/optional modes
Download & Query Utilities
src/hooks/useFileDownload.tsx, src/hooks/useQueryState.tsx, src/hooks/useUploadMutations.ts
New download hook with CDN integration and timestamped filenames; query state hook for URL param management; upload mutation hooks wrapping React Query
File Transforms & Utilities
src/lib/utils.ts, src/types/file-manager.ts, src/types/file.types.ts, src/types/user.types.ts
Added privateFileItem and sharedFileItem transforms; access_level field added to BaseFileItem; encryption callbacks removed, onChangeAccessLevel added; SharedUserDetails and expanded SharedFileSystemNode introduced; JwtToken split into access/refresh tokens; pin_hash added to IUser
Configuration & Styling
src/config/page-configs.ts, src/css/index.css, package.json
Removed encryption customActions; comprehensive upload UI CSS variables (light/dark); date-fns and react-day-picker dependencies added
Socket & Provider Configuration
src/store/connect-socket.ts, src/providers/AppProviders.tsx
Socket: enabled reconnect with token switched to access_token; providers: reordered composition, enabled ThemeProvider, added ApiTokenProvider and NotificationUIProvider, configured React Query defaults (retry: 0 for mutations, staleTime: 5min)
Route Optimization & Other
src/App.tsx, src/components/sidebar/sidebar-navigation.tsx, src/components/user/user-dropdown.tsx, src/components/upload/FIleUploader.tsx, src/components/upload/UploadPopup.tsx, src/components/custom/ImageViewer.tsx
Routes lazy-loaded via React.lazy; sidebar navigation wired to active route; user dropdown now navigates on non-logout clicks; file uploader extended with accessLevel prop and chunked/direct upload paths; upload popup: added per-file button loading states; image viewer: async blob-based download with timestamped filename
Documentation Removed
README-FILE-MANAGER.md (deleted)
Entire file manager documentation file removed

Sequence Diagrams

sequenceDiagram
    participant Client as Client/Browser
    participant Axios as Axios Interceptor
    participant API as Backend API
    participant Queue as Request Queue
    participant Storage as LocalStorage
    participant App as App State

    Note over Client,App: Token Refresh Flow with Queue Management

    rect rgb(200, 220, 240)
        Note over Client,Queue: Initial 401 Response (Multiple Concurrent Requests)
        Client->>API: Request with Access Token
        API-->>Axios: 401 Unauthorized
        Client->>API: Request 2 with Access Token (concurrent)
        API-->>Axios: 401 Unauthorized
    end

    rect rgb(220, 240, 220)
        Note over Axios,Storage: Token Refresh Sequence
        Axios->>Axios: isRefreshing = true
        Axios->>Queue: Queue failed Request 1
        Axios->>Queue: Queue failed Request 2
        Axios->>API: POST /auth/refresh<br/>(with refresh_token)
        API-->>Axios: New Access Token
    end

    rect rgb(240, 220, 200)
        Note over App,Storage: Update State & Retry
        Axios->>App: Update auth store<br/>(new access_token)
        Axios->>Storage: Save new token
        Axios->>Queue: Process queued requests
        Queue->>API: Retry Request 1 (new token)
        Queue->>API: Retry Request 2 (new token)
        API-->>Queue: Success 200
        Axios->>Axios: isRefreshing = false
    end

    rect rgb(240, 200, 200)
        Note over Axios,App: Error Handling
        alt Refresh Token Invalid
            API-->>Axios: 401/403 on refresh
            Axios->>App: Clear tokens<br/>logoutUser()
            Axios->>Storage: Clear localStorage
            Axios->>Client: Redirect to /login
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A rabbit hops through token gates, with PIN codes held so tight,
Sessions managed, files arranged by access—private, protected, bright.
Uploads chunked through mystic queues, downloads timestamp-blessed,
Dark and light themes dance as one—the file manager, now truly dressed! 🌙✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch development

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 634374b and 55b3200.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (60)
  • README-FILE-MANAGER.md
  • package.json
  • src/App.tsx
  • src/api/api-token.api.ts
  • src/api/auth.api.ts
  • src/api/axios.ts
  • src/api/file.api.ts
  • src/api/notification.api.ts
  • src/api/upload.api.ts
  • src/components/custom/ImageViewer.tsx
  • src/components/custom/notification-popup.tsx
  • src/components/file-manager/ChangeAccessLevelModal.tsx
  • src/components/file-manager/FileGridItem.tsx
  • src/components/file-manager/FileListItem.tsx
  • src/components/file-manager/RecentFiles.tsx
  • src/components/file-manager/ShareFileModal.tsx
  • src/components/file-manager/Toolbar.tsx
  • src/components/layouts/top-bar.tsx
  • src/components/player/VideoPlayer.tsx
  • src/components/player/VideoPlayerModal.tsx
  • src/components/session/VerifyPin.tsx
  • src/components/settings/active-sessions.tsx
  • src/components/settings/api-token-settings.tsx
  • src/components/settings/settings-content.tsx
  • src/components/settings/settings-header.tsx
  • src/components/settings/settings-page.tsx
  • src/components/settings/settings-tabs.tsx
  • src/components/sidebar/sidebar-navigation.tsx
  • src/components/ui/button.tsx
  • src/components/ui/calendar.tsx
  • src/components/ui/sonner.tsx
  • src/components/upload/FIleUploader.tsx
  • src/components/upload/UploadPopup.tsx
  • src/components/user/user-dropdown.tsx
  • src/config/page-configs.ts
  • src/contexts/ApiTokenContext.tsx
  • src/contexts/NotificationContext.tsx
  • src/contexts/NotificationUIContext.tsx
  • src/contexts/ThemeContext.tsx
  • src/contexts/UploadContext.tsx
  • src/contexts/fileContext.tsx
  • src/contexts/useAuth.tsx
  • src/css/index.css
  • src/hooks/useFileDownload.tsx
  • src/hooks/useQueryState.tsx
  • src/hooks/useUploadMutations.ts
  • src/lib/utils.ts
  • src/pages/all-files-page.tsx
  • src/pages/deleted-files-page.tsx
  • src/pages/home-dashboard.tsx
  • src/pages/notifications-page.tsx
  • src/pages/private-files-page.tsx
  • src/pages/shared-files-page.tsx
  • src/providers/AppProviders.tsx
  • src/routes/Upload.tsx
  • src/routes/auth/Register.tsx
  • src/store/connect-socket.ts
  • src/types/file-manager.ts
  • src/types/file.types.ts
  • src/types/user.types.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@venu123143 venu123143 merged commit ce546d6 into main Dec 28, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant