wulf-pulse/app/api/admin/rmm/settings/discover/route.ts
lorentz 1112a06afe feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul
- RMM Overshell (migration 077): admin page, dispatch UI, executor/worker, target
  resolver, script registry (AD/DHCP/DNS/event-log/services/software/network/loglift)
- LogLift evidence pipeline (migration 078): upload webhook, B2 storage client,
  receiver/matcher, EventLogCollector PowerShell script
- IT Glue audit + write-back (migrations 075, 076): asset-audit runner, ticket
  xrefs, applications/configurations browse pages + apply/revert/audit endpoints
- Link-aware analyzer bundles (migration 073) + provider toggle (migration 074):
  link-discovery service, OpenRouter LLM provider, related-tickets/itglue-suggestion
  panels, analyze-bundle endpoint
- Endpoint data model + device-link reconciliation (migrations 079, 080): conflicts
  admin page, reconciler service, resolve endpoints
- Dashboard overhaul: integration-health service + alerts, overview/health endpoints
- Permissions: add itglue + rmm scopes; middleware: public /api/rmm/loglift route

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 07:13:18 -04:00

38 lines
1.2 KiB
TypeScript

/**
* POST /api/admin/rmm/settings/discover
*
* Force a re-scan of Datto RMM components, find the Overshell, and update
* rmm_settings. Returns the discovered { uid, name } or 404 if nothing
* matches the discovery pattern.
*/
import { NextRequest, NextResponse } from 'next/server';
import { requirePermission } from '@/lib/auth-utils';
import { discoverOvershellComponent } from '@/lib/services/rmm/settings';
export async function POST(_request: NextRequest) {
const { error } = await requirePermission('admin', 'access');
if (error) return error;
try {
const result = await discoverOvershellComponent();
if (!result.discovered) {
return NextResponse.json(
{
error: 'No matching component found',
message:
'Datto RMM did not return any component whose name matches /overshell/i. Register a component (Account → ComStore → Run Command or similar) and retry.',
},
{ status: 404 }
);
}
return NextResponse.json({ settings: result.settings, discovered: result.discovered });
} catch (err) {
return NextResponse.json(
{
error: 'Discovery failed',
message: err instanceof Error ? err.message : String(err),
},
{ status: 500 }
);
}
}