2026-06-18 19:56:10 +00:00
|
|
|
import type { IntegrationAdapter, Resource } from './types.js'
|
Add backend skeleton: Fastify + SQLite API with auth and integrations
- Single-user JWT auth with a first-run /api/setup endpoint, gated by
GET /api/system/setup-status, to back an upcoming enrollment page
- SQLite schema for users, integrations, secrets (AES-256-GCM encrypted),
bookmarks, and bookmark categories
- Integration adapter registry with real health-check adapters for
Uptime Kuma and Docker, stubs for the rest, wired to
POST /api/integrations/:id/test
- CRUD routes for integrations and bookmarks
- backend/ as its own Docker service in docker-compose.yml, Vite dev
proxy for /api, .env.example for required secrets
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbJV5nm8KPVH1oNJYKpnoF
2026-06-18 19:04:48 +00:00
|
|
|
|
|
|
|
|
export const docker: IntegrationAdapter = {
|
|
|
|
|
async testConnection(config) {
|
|
|
|
|
const baseUrl = config.baseUrl?.replace(/\/$/, '')
|
|
|
|
|
if (!baseUrl) return { ok: false, message: 'Missing baseUrl' }
|
|
|
|
|
try {
|
|
|
|
|
const res = await fetch(`${baseUrl}/version`)
|
|
|
|
|
if (!res.ok) return { ok: false, message: `HTTP ${res.status}` }
|
|
|
|
|
return { ok: true, message: 'Connected' }
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return { ok: false, message: err instanceof Error ? err.message : 'Connection failed' }
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-06-18 19:56:10 +00:00
|
|
|
|
|
|
|
|
async listResources(config): Promise<Resource[]> {
|
|
|
|
|
const baseUrl = config.baseUrl?.replace(/\/$/, '')
|
|
|
|
|
if (!baseUrl) return []
|
|
|
|
|
const res = await fetch(`${baseUrl}/containers/json?all=true`)
|
|
|
|
|
if (!res.ok) return []
|
|
|
|
|
const containers = (await res.json()) as { Names: string[]; State: string }[]
|
|
|
|
|
return containers.map((c) => ({
|
|
|
|
|
name: c.Names[0]?.replace(/^\//, '') ?? 'unknown',
|
|
|
|
|
status: c.State === 'running' ? 'healthy' : c.State === 'restarting' ? 'warning' : 'critical',
|
|
|
|
|
detail: c.State,
|
|
|
|
|
}))
|
|
|
|
|
},
|
Add backend skeleton: Fastify + SQLite API with auth and integrations
- Single-user JWT auth with a first-run /api/setup endpoint, gated by
GET /api/system/setup-status, to back an upcoming enrollment page
- SQLite schema for users, integrations, secrets (AES-256-GCM encrypted),
bookmarks, and bookmark categories
- Integration adapter registry with real health-check adapters for
Uptime Kuma and Docker, stubs for the rest, wired to
POST /api/integrations/:id/test
- CRUD routes for integrations and bookmarks
- backend/ as its own Docker service in docker-compose.yml, Vite dev
proxy for /api, .env.example for required secrets
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbJV5nm8KPVH1oNJYKpnoF
2026-06-18 19:04:48 +00:00
|
|
|
}
|