Skip to content

Conversation

@dacsang97
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings October 7, 2025 09:21
@dacsang97 dacsang97 changed the base branch from main to beta_developer October 7, 2025 09:22
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
3.6% Duplication on New Code (required ≤ 3%)
B Reliability Rating on New Code (required ≥ A)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vncloudsco vncloudsco merged commit 893f8fe into TinyActive:beta_developer Oct 7, 2025
1 of 2 checks passed
Copy link

Copilot AI left a 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.

Comment on lines 13 to 22
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);
},
Copy link

Copilot AI Oct 7, 2025

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.

Copilot uses AI. Check for mistakes.
vncloudsco added a commit that referenced this pull request Oct 8, 2025
* 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>
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.

2 participants