feat(api, web): enhance agent installation process with invited status and policy support
- Updated the agent enrollment process to include an 'invited' status, allowing for better tracking of agent states. - Implemented support for install links that can now include an `install_link_id`, facilitating the transition from invited to pending status upon enrollment. - Enhanced the MikroTik installation script to include the `EvofwInstallLinkId` for better tracking and management. - Added new API endpoints for fetching agent policies and serving MikroTik-specific installation scripts. - Improved the web UI to reflect the new agent statuses and provide copyable installation commands for agents. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const agentPlatformSchema = z.enum(['linux', 'mikrotik'])
|
||||
export const agentStatusSchema = z.enum(['pending', 'approved', 'revoked'])
|
||||
export const agentStatusSchema = z.enum([
|
||||
'invited',
|
||||
'pending',
|
||||
'approved',
|
||||
'revoked',
|
||||
])
|
||||
export const policyModeSchema = z.enum(['blacklist', 'whitelist'])
|
||||
export const policyActionSchema = z.enum(['allow', 'deny'])
|
||||
export const ipListTypeSchema = z.enum([
|
||||
@@ -34,6 +39,8 @@ export const agentSchema = z.object({
|
||||
created_at: z.string(),
|
||||
approved_at: z.string().nullable().optional(),
|
||||
revoked_at: z.string().nullable().optional(),
|
||||
install_curl: z.string().nullable().optional(),
|
||||
install_link_id: z.string().nullable().optional(),
|
||||
})
|
||||
|
||||
export const ipListSchema = z.object({
|
||||
@@ -151,6 +158,7 @@ export const enrollBodySchema = z.object({
|
||||
platform: agentPlatformSchema.optional().default('linux'),
|
||||
token: z.string().min(16),
|
||||
client_version: z.string().optional(),
|
||||
install_link_id: z.string().optional(),
|
||||
})
|
||||
|
||||
export const applyReportBodySchema = z.object({
|
||||
@@ -192,6 +200,7 @@ export const installLinkSchema = z.object({
|
||||
slug: z.string(),
|
||||
client_name: z.string(),
|
||||
platform: agentPlatformSchema,
|
||||
agent_id: z.string().nullable().optional(),
|
||||
created_at: z.string(),
|
||||
revoked_at: z.string().nullable().optional(),
|
||||
last_used_at: z.string().nullable().optional(),
|
||||
|
||||
Reference in New Issue
Block a user