149 Commits

Author SHA1 Message Date
Muhammad Ibrahim
766d36ff80 fix: migration to properly drop unique index on friendly_name
The migration was dropping the constraint but not the underlying unique index.
In PostgreSQL, unique constraints and unique indexes can exist independently.
This caused auto-enrollment to fail with 'unique constraint violated' errors.

Added explicit DROP INDEX statement to ensure the unique index is removed,
allowing duplicate friendly_name values while machine_id remains unique.
2025-10-04 10:44:06 +01:00
Muhammad Ibrahim
dd28e741d4 fix: manual host creation and improve host identification
- Add machine_id support for manual host creation from GUI
- Generate temporary 'pending-{uuid}' machine_id for new hosts
- Agent now collects and sends machine_id on every update
- Backend replaces pending machine_id with real one on first agent connection
- Remove unnecessary duplicate name check (friendly_name can be duplicated)
- Add get_machine_id() function to agent (reads from /etc/machine-id, /var/lib/dbus/machine-id, or generates fallback)
- Display IP address in Network tab on host details page
- Fix network tab visibility conditions to include host.ip

This ensures proper host identification using machine_id while maintaining backwards compatibility with API credentials as the primary authentication method.
2025-10-04 09:39:47 +01:00
Muhammad Ibrahim
35d3c28ae5 feat(ui): Display machine_id in host details page and enable search
- Added machine_id field to host details page
- Backend now returns machine_id in all host queries
- Users can search hosts by machine_id
- Added hostname index to schema for better performance
2025-10-04 09:15:43 +01:00
Muhammad Ibrahim
3cf2ada84e migration: Add machine_id column to hosts table
- Adds machine_id as unique identifier for hosts
- Migrates existing hosts with 'migrated-' prefix
- Removes unique constraint from friendly_name
- Adds indexes for performance
2025-10-04 09:05:36 +01:00
Muhammad Ibrahim
b25bba50a7 feat(backend): Update routes to use machine_id for host identification
- Auto-enrollment endpoints now require and validate machine_id
- Check for duplicates by machine_id instead of friendly_name
- Added /hosts/check-machine-id endpoint for agent installer
- Bulk enrollment updated to handle machine_id
- Multiple hosts with same hostname now supported
2025-10-04 09:04:35 +01:00
Muhammad Ibrahim
811930d1e2 feat: Implement machine_id based host identification
- Add machine_id field to hosts schema (unique, indexed)
- Remove unique constraint from friendly_name (allow duplicate hostnames)
- Agent installer now generates/reads persistent machine_id
- Proxmox script retrieves machine_id from LXC containers
- Backend will check machine_id instead of hostname for duplicates

This allows multiple hosts with same hostname to coexist in PatchMon
2025-10-04 09:02:56 +01:00
Muhammad Ibrahim
657017801b fix: Restore server.js from aa8b42c (accidentally overwrote with older version) 2025-10-03 22:30:53 +01:00
Muhammad Ibrahim
5e8cfa6b63 feat: Add Proxmox LXC auto-enrollment script with dpkg error recovery 2025-10-03 22:27:04 +01:00
9 Technology Group LTD
aa8b42cbb0 Merge pull request #129 from PatchMon/dev-1-2-8
Global Search + Proxmox Auto lxc enrollment
2025-10-03 22:08:26 +01:00
tigattack
32ab004f3f feat: add repository deletion functionality with confirmation modal 2025-10-03 21:53:13 +01:00
9 Technology Group LTD
71b27b4bcf Merge pull request #123 from PatchMon/feat/package_detail
feat: add package detail page and list all packages with pagination
2025-10-03 18:03:57 +01:00
tigattack
757feab9cd fix(packages): add needsUpdate and isSecurityUpdate fields to package hosts 2025-10-02 23:52:10 +01:00
tigattack
6f59a1981d feat(api): endpoint to retrieve hosts for a pkg
With pagination and search functionality
2025-10-02 23:52:10 +01:00
tigattack
8bb16f0896 fix(api): update package host fields to match database schema 2025-10-02 23:52:10 +01:00
tigattack
b454b8d130 feat(packages): show all packages by default, add pagination 2025-10-02 23:52:10 +01:00
tigattack
9c39d83fe5 fix(auth): JWT_SECRET is required 2025-10-02 21:26:19 +01:00
tigattack
7a17958ad8 feat(env): validate required env vars on start 2025-10-02 15:55:52 +01:00
Muhammad Ibrahim
4e6a9829cf chore: Add migration file for auto_enrollment_tokens table 2025-10-02 08:13:04 +01:00
Muhammad Ibrahim
b99f4aad4e feat: Add Proxmox LXC auto-enrollment integration
- Add auto_enrollment_tokens table with rate limiting and IP whitelisting
- Create backend API routes for token management and enrollment
- Build frontend UI for token creation and management
- Add one-liner curl command for easy Proxmox deployment
- Include Proxmox LXC discovery and enrollment script
- Support future integrations with /proxmox-lxc endpoint pattern
- Add comprehensive documentation

Security features:
- Hashed token secrets
- Per-day rate limits
- IP whitelist support
- Token expiration
- Separate enrollment vs host API credentials
2025-10-02 07:50:10 +01:00
Muhammad Ibrahim
7a8e9d95a0 Added a global search bar 2025-10-02 07:03:10 +01:00
Muhammad Ibrahim
5d8a1e71d6 Made changes to the host details area to add notes
Reconfigured JWT session timeouts
2025-10-01 08:38:40 +01:00
Muhammad Ibrahim
b3d7e49961 Fixed <1GB Ram issue with it throwing integer error 2025-09-30 21:53:30 +01:00
Muhammad Ibrahim
8be25283dc Relaid out settings page and configured agent and other communication to use curl flags which can be configured to ignore ssl cert if self-hosted. 2025-09-30 21:38:13 +01:00
Muhammad Ibrahim
ed0cf79b53 Added settings pages to bring all the settings together from patchmon options, profile page and server settings. 2025-09-30 19:48:28 +01:00
Muhammad Ibrahim
8ca22dc7ab Fixed crontab syntax issue with timing 2025-09-30 09:31:12 +01:00
tigattack
d626493100 fix: Revert Dockerfile edits and lockfile changes
This reverts commits 8409b71857 and 78eb2b183e
2025-09-29 21:53:13 +01:00
Muhammad Ibrahim
b49ea6b197 Update PatchMon version to 1.2.7
- Updated agent script version to 1.2.7
- Updated all package.json files to version 1.2.7
- Updated backend version references
- Updated setup script version references
- Fixed agent file path issues in API endpoints
- Fixed linting issues (Node.js imports, unused variables, accessibility)
- Created comprehensive version update guide in patchmon-admin/READMEs/
2025-09-29 20:42:14 +01:00
Muhammad Ibrahim
78eb2b183e Docker package-lock.json generation for each backend and frontend folder. 2025-09-29 17:20:13 +01:00
tigattack
840664c39e chore: fixup package-lock, remove unused deps 2025-09-28 18:20:06 +01:00
tigattack
c886b812d6 chore: clarify auto-update feature 2025-09-27 00:52:04 +01:00
tigattack
be3fe52aea fix(api): resolve duplicate key constraint errors in host package updates 2025-09-27 00:52:04 +01:00
tigattack
e3aa28a8d9 fix: login after signup
Also resolves entire user object being return to client, including password_hash... ⚠️
2025-09-26 20:17:09 +01:00
Muhammad Ibrahim
0c0446ad69 Added a few dashboard enhancements with Doughnut charts 2025-09-26 02:10:55 +01:00
Muhammad Ibrahim
527b0ccc3c Fixed auto-update toggle to refresh upon save 2025-09-26 01:05:49 +01:00
tigattack
469107c149 fix: incorrect cardId 2025-09-26 00:24:32 +01:00
tigattack
22f6befc89 fix(backend): lint errors 2025-09-26 00:24:32 +01:00
tigattack
591389a91f style(backend): fmt 2025-09-25 23:13:49 +01:00
Muhammad Ibrahim
a479003ba9 fix: return first_name and last_name in setup-admin and signup responses
- Add first_name and last_name to select clause in setup-admin endpoint
- Add first_name and last_name to select clause in signup endpoint
- Ensures frontend receives the name fields after user creation
- Fixes issue where first/last names don't populate in UI after setup

The data was being saved to database correctly but not returned in the API response, causing frontend to not display the names properly.
2025-09-24 20:17:36 +01:00
Muhammad Ibrahim
9f3016be57 deps: update all dependencies to latest non-deprecated versions
Frontend:
- ESLint: 8.53.0 → 9.17.0 (fixes deprecated warnings)
- React/React-DOM: 18.2.0 → 18.3.1
- Axios: 1.6.2 → 1.7.9
- Chart.js: 4.4.0 → 4.4.7
- Date-fns: 2.30.0 → 4.1.0 (major update)
- Express: 4.18.2 → 4.21.2
- HTTP-proxy-middleware: 2.0.6 → 3.0.3
- Lucide-react: 0.294.0 → 0.468.0
- React-router-dom: 6.20.1 → 6.31.0
- Add ESLint v9 flat config (eslint.config.js)
- Add required @eslint/js and globals dependencies

Backend:
- Prisma: 5.7.0 → 6.1.0
- Express: 4.18.2 → 4.21.2
- Dotenv: 16.3.1 → 16.4.7
- Express-rate-limit: 7.1.5 → 7.5.0
- Express-validator: 7.0.1 → 7.2.0
- Helmet: 7.1.0 → 8.0.0
- UUID: 9.0.1 → 11.0.3
- Winston: 3.11.0 → 3.17.0
- Nodemon: 3.0.2 → 3.1.9

Fixes npm warnings:
- rimraf < v4 deprecated
- inflight memory leaks
- glob < v9 deprecated
- @humanwhocodes packages deprecated
- ESLint v8 no longer supported
2025-09-24 19:50:50 +01:00
Muhammad Ibrahim
99aa79a6a4 Fixed authentication redirect upon signin using states
Finally fixed dashboard defaults for new user signups
2025-09-24 07:42:15 +01:00
Muhammad Ibrahim
73761d8927 fixed dashboard defaults via server.js config 2025-09-24 07:07:38 +01:00
Muhammad Ibrahim
9889083900 reverted the removal of schema migration files to make it production save in order to not mess up previous instances 2025-09-24 03:05:22 +01:00
Muhammad Ibrahim
acb30f22bd Removed migration settings from earlier whic hwere messing with the logic of new dashboard layout system. Now has a single source of truth based on what the defaults should be in server.js 2025-09-24 02:54:44 +01:00
Muhammad Ibrahim
3a0b564a6f Fixed permissions issues
Created default user role
modified server.js to check if roles of admin/user is present
modified server.js to check dashboard cards
set up default dashboard cards to show
2025-09-24 02:33:26 +01:00
tigattack
c3aa5534f3 fix: improve proxy config 2025-09-22 23:42:00 +01:00
tigattack
bf2ea908f4 refactor(docker): rework docker
- Move Docker files to own directory (tidier since I added several more files)
- Optimise images and reduce size
  - Uses multi-stage builds
  - Optimises layer efficiency
  - Uses NGINX as base for frontend
- Sets default env vars
- Uses tini for proper signal handling
2025-09-22 23:42:00 +01:00
tigattack
001b234ecc fix(backend): set imported agent versions as current
Fixes agent installation script failing with "No agent version available" error

- Auto-imported agent versions now marked as current/default appropriately
- First imported version becomes both current and default
- Newer versions become current (but not default)
- Added concurrent database updates with Promise.all()
- Fixed agent download endpoint fallback to filesystem when no DB versions exist
2025-09-22 23:41:53 +01:00
tigattack
d300922312 refactor(backend): make /agent/download route more resilient
* Fixes early 404 return
* Fixes filename when agent version undefined
* Correctly returns 500 when error occurs
2025-09-22 22:23:54 +01:00
tigattack
20ff5b5b72 refactor(backend): update DB wait env var names 2025-09-22 22:23:54 +01:00
tigattack
5e6a2d863c fix(backend): update settings log msgs 2025-09-22 22:23:54 +01:00