feat(scan): add guided Linux agent setup in administration
Some checks failed
Build and Release FEDEO / verify (push) Successful in 23s
Build and Release FEDEO / build-and-release (push) Failing after 29s

This commit is contained in:
2026-09-17 18:56:30 +02:00
parent 1329f164d8
commit 68c0a224e5
15 changed files with 869 additions and 89 deletions

View File

@@ -90,10 +90,22 @@ export default async function instanceAgentRoutes(server: FastifyInstance) {
createdAt: instanceAgents.createdAt,
})
return {
agent,
token,
}
reply.header("Cache-Control", "no-store")
return { agent, token }
})
server.post<{ Params: { id: string } }>("/instance-agents/:id/token", async (req, reply) => {
if (!requireAdmin(req, reply)) return
const id = z.string().uuid().parse(req.params.id)
const token = createAgentToken()
const [agent] = await server.db
.update(instanceAgents)
.set({ tokenPrefix: token.slice(0, 24), tokenHash: hashToken(token), lastSeenAt: null, updatedAt: new Date() })
.where(eq(instanceAgents.id, id))
.returning({ id: instanceAgents.id })
if (!agent) return reply.code(404).send({ error: "Agent not found" })
reply.header("Cache-Control", "no-store")
return { token }
})
server.patch<{ Params: { id: string } }>("/instance-agents/:id", async (req, reply) => {