-
Notifications
You must be signed in to change notification settings - Fork 65
Fix login cookie #17
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 login cookie #17
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds master/slave node synchronization, comprehensive backup & restore functionality, token refresh/auth storage refactor, and deployment/update scripting. Key changes introduce new Prisma models & migrations (backup, slave nodes, system config), large backup controller with export/import logic (including nginx/SSL file handling), and client-side state & API layer adjustments (token handling, node mode UI).
- Introduces slave node management (registration, status, sync) and system configuration APIs.
- Adds full backup/export/import with nginx vhost & SSL file regeneration plus user/password restoration.
- Refactors frontend auth/token handling (localStorage wrapper) and adds reactive system/node management UI.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/update.sh | New deployment/update automation script with build, migrate, seed, and health checks |
| apps/web/src/types/index.ts | Extends SlaveNode and adds SystemConfig type definitions |
| apps/web/src/store/useStore.ts | Switches auth state to tokenStorage abstraction |
| apps/web/src/services/* | New services for users, system config, slave nodes, backup; auth/logout refactor |
| apps/web/src/services/api.ts | Adds robust token refresh queue and logout/redirect handling |
| apps/web/src/routes/_auth/nodes.tsx | New UI for master/slave mode management with tabs |
| apps/web/src/queries/* | Query options for system config, slave nodes, auth adjustments |
| apps/web/src/mocks/data.ts | Updates mock slave nodes with new fields |
| apps/web/src/lib/auth-storage.ts | Centralized localStorage-based auth token/user utilities |
| apps/web/src/hooks/useAuthStorage.ts | Reactive auth state hooks with custom events |
| apps/web/src/components/pages/* | Adds SlaveNodes, SystemConfig, enhanced Backup & Account behavior |
| apps/web/src/auth.tsx | Refactors AuthProvider to use new storage hooks |
| apps/web/package.json | Adds react-use dependency |
| apps/api/src/utils/slave-status-checker.ts | Background job to mark stale slave nodes offline |
| apps/api/src/routes/* | New routes for backup, slave, system config, node sync |
| apps/api/src/controllers/* | Large additions: system config, slave, backup, node sync logic |
| apps/api/prisma/seed-safe.ts | Safe seeding script adding default users & CRS rules |
| apps/api/prisma/schema.prisma | New models & enums for backup, slave sync, system config |
| apps/api/prisma/migrations/* | Migrations for backup, slave node, and system config features |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| export const tokenStorage = { | ||
| // Get access token | ||
| getAccessToken: (): string | null => { | ||
| return Cookies.get(AUTH_KEYS.ACCESS_TOKEN) || null; | ||
| return localStorage.getItem(AUTH_KEYS.ACCESS_TOKEN); | ||
| }, | ||
|
|
||
| // Set access token | ||
| setAccessToken: (token: string): void => { | ||
| Cookies.set(AUTH_KEYS.ACCESS_TOKEN, token, { | ||
| ...COOKIE_OPTIONS, | ||
| expires: ACCESS_TOKEN_EXPIRY, | ||
| }); | ||
| localStorage.setItem(AUTH_KEYS.ACCESS_TOKEN, token); | ||
| }, |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Access and refresh tokens are stored in localStorage, increasing XSS exposure risk. Consider HttpOnly secure cookies or an in-memory strategy plus a refresh rotation to mitigate token theft.
* Feat: Update Features Backup & Restore (#12) * feat: Update Features Backup & Restore * Feat: Slave Mode (#13) * feat: Update Features Backup & Restore * Feat: Features update (#14) * feat: Update software * Features update version and update noti Change Password (#15) * feat: Update Features Backup & Restore * Fix frontend error (#16) * Refactor services to use centralized API module and token storage * Feat: Enhance Slave Mode UI with mode switch button and update node mode mutation * feat: Improve SSLDialog layout with enhanced text wrapping for certificate fields * refactor: replace js-cookie with localStorage for token management (#17) * feat: add syncInterval and lastSyncHash columns to system_configs table (#18) * feat: Update project goal description and remove security recommendation * feat: Update project goal description and remove security recommendation * About readme (#21) * feat: Update project goal description and remove security recommendation * Refactor be (#22) * Refactor code structure for improved readability and maintainability * style: limit max height of certificate, private key, and chain input fields (#23) --------- Co-authored-by: SangND <dacsang97@gmail.com>




No description provided.