diff --git a/dashcaddy-installer/package.json b/dashcaddy-installer/package.json index 6e317a9..39591d8 100644 --- a/dashcaddy-installer/package.json +++ b/dashcaddy-installer/package.json @@ -47,12 +47,24 @@ { "from": "../status", "to": "status", - "filter": ["**/*", "!node_modules/**", "!.git/**", "!**/*.test.js", "!**/*.spec.js"] + "filter": [ + "**/*", + "!node_modules/**", + "!.git/**", + "!**/*.test.js", + "!**/*.spec.js" + ] }, { "from": "../dashcaddy-api", "to": "dashcaddy-api", - "filter": ["**/*", "!node_modules/**", "!.git/**", "!**/*.test.js", "!**/*.spec.js"] + "filter": [ + "**/*", + "!node_modules/**", + "!.git/**", + "!**/*.test.js", + "!**/*.spec.js" + ] } ], "icon": "assets/favicon.ico", @@ -65,7 +77,9 @@ "signAndEditExecutable": false }, "mac": { - "target": "dmg", + "target": [ + "zip" + ], "icon": "assets/dashcaddy-logo.png" }, "linux": { @@ -84,4 +98,4 @@ "installerHeaderIcon": "assets/icon.ico" } } -} +} \ No newline at end of file diff --git a/deploy.ps1 b/deploy.ps1 deleted file mode 100644 index 8eaaa57..0000000 --- a/deploy.ps1 +++ /dev/null @@ -1,93 +0,0 @@ -# DashCaddy Deployment Script -# Deploys changes from Dev (E:) to Prod (C:) - -$DevRoot = "E:\CaddyCerts\sites" -$ProdRoot = "C:\Caddy" -$ErrorActionPreference = "Stop" - -Write-Host "Deploying DashCaddy Changes..." -ForegroundColor Cyan - -# 1. Pre-deploy validation - syntax check all JS files -Write-Host "Validating JavaScript syntax..." -ForegroundColor Yellow -$syntaxErrors = 0 -Get-ChildItem "$DevRoot\dashcaddy-api" -Filter "*.js" | ForEach-Object { - $result = & node -c $_.FullName 2>&1 - if ($LASTEXITCODE -ne 0) { - Write-Error "Syntax error in $($_.Name): $result" - $syntaxErrors++ - } -} -Get-ChildItem "$DevRoot\dashcaddy-api\routes" -Filter "*.js" | ForEach-Object { - $result = & node -c $_.FullName 2>&1 - if ($LASTEXITCODE -ne 0) { - Write-Error "Syntax error in routes/$($_.Name): $result" - $syntaxErrors++ - } -} -if ($syntaxErrors -gt 0) { - Write-Error "Aborting deploy: $syntaxErrors syntax error(s) found." - exit 1 -} -Write-Host " All files pass syntax check." -ForegroundColor Green - -# 2. Update Frontend -Write-Host "Updating Dashboard UI..." -ForegroundColor Yellow -if (Test-Path "$ProdRoot\sites\status") { - # Build frontend bundles - Write-Host "Building frontend JavaScript..." -ForegroundColor Yellow - Set-Location "$DevRoot\status" - & npm install - & node build.js - if ($LASTEXITCODE -ne 0) { - Write-Error "Frontend build failed!" - exit 1 - } - Write-Host " Frontend build complete." -ForegroundColor Green - - # Copy all necessary files - Copy-Item "$DevRoot\status\index.html" "$ProdRoot\sites\status\index.html" -Force - Copy-Item "$DevRoot\status\dist\*" "$ProdRoot\sites\status\dist\" -Force - Set-Location $ProdRoot -} else { - Write-Warning "Target status folder not found. Skipping UI update." -} - -# 3. Update Backend API -Write-Host "Updating API Server..." -ForegroundColor Yellow -if (Test-Path "$ProdRoot\sites\dashcaddy-api") { - # Copy all JS files, package files, API spec - Get-ChildItem "$DevRoot\dashcaddy-api" -Filter "*.js" | Copy-Item -Destination "$ProdRoot\sites\dashcaddy-api\" -Force - Copy-Item "$DevRoot\dashcaddy-api\package.json" "$ProdRoot\sites\dashcaddy-api\" -Force - Copy-Item "$DevRoot\dashcaddy-api\package-lock.json" "$ProdRoot\sites\dashcaddy-api\" -Force -ErrorAction SilentlyContinue - Copy-Item "$DevRoot\dashcaddy-api\openapi.yaml" "$ProdRoot\sites\dashcaddy-api\" -Force -ErrorAction SilentlyContinue - - # Copy route modules - if (!(Test-Path "$ProdRoot\sites\dashcaddy-api\routes")) { - New-Item -ItemType Directory -Path "$ProdRoot\sites\dashcaddy-api\routes" | Out-Null - } - Copy-Item "$DevRoot\dashcaddy-api\routes\*" "$ProdRoot\sites\dashcaddy-api\routes\" -Force - - # 4. Rebuild and Restart - Write-Host "Rebuilding API Container..." -ForegroundColor Yellow - Set-Location $ProdRoot - docker-compose up -d --build dashcaddy-api - - # 5. Post-deploy health check - Write-Host "Waiting for container startup..." -ForegroundColor Yellow - Start-Sleep -Seconds 5 - try { - $health = Invoke-RestMethod -Uri "http://localhost:3001/health" -TimeoutSec 10 -ErrorAction Stop - if ($health.status -eq 'ok') { - Write-Host " Health check passed." -ForegroundColor Green - } else { - Write-Warning "Health check returned unexpected status: $($health.status)" - } - } catch { - Write-Warning "Health check failed: $_" - Write-Warning "Check logs with: docker logs --tail 30 dashcaddy-api" - } -} else { - Write-Warning "Target API folder not found. Skipping API update." -} - -Write-Host "Deployment Complete! Refresh your dashboard." -ForegroundColor Green diff --git a/status/api/README.md b/status/api/README.md deleted file mode 100644 index 4047120..0000000 --- a/status/api/README.md +++ /dev/null @@ -1,242 +0,0 @@ -# SAMI-CLOUD Status Dashboard API - -Cross-platform Node.js API server for managing Caddy reverse proxy and DNS records via REST APIs. - -## Features - -- **Cross-Platform**: Works on Windows, Linux, and macOS -- **API-Based**: Uses Caddy Admin API and Technitium DNS API (no PowerShell required) -- **App Deployment**: Deploy apps by creating DNS records and Caddy reverse proxy routes -- **App Deletion**: Clean removal of DNS records and Caddy routes -- **Automatic Rollback**: If deployment fails, automatically rolls back changes - -## Prerequisites - -1. **Node.js** (v14 or higher) -2. **Caddy** with Admin API enabled -3. **Technitium DNS Server** (optional, for DNS management) - -## Installation - -```bash -cd api -npm install -``` - -## Configuration - -Set the following environment variables (or use defaults): - -```bash -# Caddy Admin API endpoint (default: http://localhost:2019) -export CADDY_ADMIN_API=http://localhost:2019 - -# Technitium DNS Server API endpoint (default: http://192.168.254.204:5380) -export DNS_SERVER_API=http://192.168.254.204:5380 - -# Technitium DNS API token (required for DNS operations) -export TECHNITIUM_API_TOKEN=your_api_token_here -``` - -### Windows (PowerShell) -```powershell -$env:CADDY_ADMIN_API="http://localhost:2019" -$env:DNS_SERVER_API="http://192.168.254.204:5380" -$env:TECHNITIUM_API_TOKEN="your_api_token_here" -``` - -### Windows (Command Prompt) -```cmd -set CADDY_ADMIN_API=http://localhost:2019 -set DNS_SERVER_API=http://192.168.254.204:5380 -set TECHNITIUM_API_TOKEN=your_api_token_here -``` - -## Running the Server - -```bash -npm start -``` - -Or directly: -```bash -node caddy-api.js -``` - -The server will start on port 3001. - -## API Endpoints - -### Deploy an App -```http -POST /api/apps/deploy -Content-Type: application/json - -{ - "appId": "myapp", - "config": { - "subdomain": "myapp", - "ip": "192.168.1.100", - "port": "8080", - "createDns": true, - "dnsType": "private", - "sslType": "internal" - } -} -``` - -**Response:** -```json -{ - "success": true, - "message": "App myapp deployed successfully", - "url": "https://myapp.sami", - "domain": "myapp.sami", - "ip": "192.168.1.100", - "port": "8080", - "dnsCreated": true, - "caddyConfigured": true -} -``` - -### Delete an App -```http -POST /api/apps/delete -Content-Type: application/json - -{ - "domain": "myapp.sami", - "ip": "192.168.1.100" -} -``` - -### Get Services List -```http -GET /api/services -``` - -### Get Caddy Configuration -```http -GET /api/caddy/config -``` - -### Test API -```http -GET /api/caddy/test -``` - -### Health Check -```http -GET /health -``` - -## Caddy Configuration Requirements - -Your Caddyfile should have the Admin API enabled: - -```caddyfile -{ - admin localhost:2019 { - origins localhost localhost:2019 - } -} -``` - -For the status dashboard to proxy API requests, add this to your Caddyfile: - -```caddyfile -status.sami { - tls internal - - # API proxy to Node.js server - handle /api/* { - reverse_proxy localhost:3001 - } - - # Static site - root * /path/to/sites/status - file_server -} -``` - -## Getting Technitium DNS API Token - -1. Open Technitium DNS web interface -2. Go to Settings → API -3. Create a new API token or copy existing one -4. Set it as the `TECHNITIUM_API_TOKEN` environment variable - -## Deployment Flow - -When deploying an app: - -1. **Validate** - Checks required fields (appId, subdomain, ip) -2. **DNS Record** - Creates A record in DNS (if `createDns: true` and `dnsType: "private"`) -3. **Caddy Route** - Adds reverse proxy route via Caddy Admin API -4. **Rollback** - If Caddy configuration fails, removes DNS record - -## Troubleshooting - -### Caddy Admin API not accessible -- Verify Caddy is running -- Check that admin API is enabled in your Caddyfile -- Confirm the CADDY_ADMIN_API URL is correct - -### DNS operations failing -- Verify TECHNITIUM_API_TOKEN is set correctly -- Check DNS_SERVER_API URL is accessible -- Ensure the API token has permissions to manage zones - -### Routes not appearing in Caddy -- Check Caddy logs: `caddy logs` -- Verify the route was added: `curl http://localhost:2019/config/` -- Ensure the domain resolves correctly in DNS - -## Production Deployment - -For production use: - -1. Set up environment variables persistently -2. Use a process manager (PM2, systemd, etc.) -3. Configure proper logging -4. Set up SSL/TLS for the API if exposed externally - -### Using PM2 -```bash -npm install -g pm2 -pm2 start caddy-api.js --name sami-api -pm2 save -pm2 startup -``` - -### Using systemd (Linux) -Create `/etc/systemd/system/sami-api.service`: - -```ini -[Unit] -Description=SAMI-CLOUD API Server -After=network.target - -[Service] -Type=simple -User=caddy -WorkingDirectory=/path/to/sites/status/api -Environment="CADDY_ADMIN_API=http://localhost:2019" -Environment="DNS_SERVER_API=http://192.168.254.204:5380" -Environment="TECHNITIUM_API_TOKEN=your_token" -ExecStart=/usr/bin/node caddy-api.js -Restart=on-failure - -[Install] -WantedBy=multi-user.target -``` - -Then: -```bash -sudo systemctl enable sami-api -sudo systemctl start sami-api -``` - -## License - -MIT diff --git a/status/api/caddy-api.js b/status/api/caddy-api.js deleted file mode 100644 index 23e44cc..0000000 --- a/status/api/caddy-api.js +++ /dev/null @@ -1,362 +0,0 @@ -// Cross-platform Node.js API server for Caddy management -// Uses Caddy Admin API and Technitium DNS API directly -// Run with: node caddy-api.js - -const express = require('express'); -const path = require('path'); -const cors = require('cors'); -const fs = require('fs'); - -const app = express(); -const PORT = 3001; - -// Middleware -app.use(cors()); -app.use(express.json()); -app.use(express.static('public')); - -// Configuration -const CADDY_ADMIN_API = process.env.CADDY_ADMIN_API || 'http://localhost:2019'; -const DNS_SERVER_API = process.env.DNS_SERVER_API || 'http://192.168.254.204:5380'; -const DNS_API_TOKEN = process.env.TECHNITIUM_API_TOKEN || ''; - -// Helper function to make HTTP requests -async function makeRequest(url, options = {}) { - const https = url.startsWith('https:') ? require('https') : require('http'); - const urlObj = new URL(url); - - return new Promise((resolve, reject) => { - const reqOptions = { - hostname: urlObj.hostname, - port: urlObj.port, - path: urlObj.pathname + urlObj.search, - method: options.method || 'GET', - headers: options.headers || {}, - ...options - }; - - const req = https.request(reqOptions, (res) => { - let data = ''; - res.on('data', (chunk) => data += chunk); - res.on('end', () => { - try { - const parsed = JSON.parse(data); - resolve({ status: res.statusCode, data: parsed }); - } catch (e) { - resolve({ status: res.statusCode, data: data }); - } - }); - }); - - req.on('error', reject); - - if (options.body) { - req.write(typeof options.body === 'string' ? options.body : JSON.stringify(options.body)); - } - - req.end(); - }); -} - -// Get current Caddy configuration -app.get('/api/v1/caddy/config', async (req, res) => { - try { - const response = await makeRequest(`${CADDY_ADMIN_API}/config/`); - - if (response.status === 200) { - res.json({ - status: 'success', - config: response.data - }); - } else { - res.status(response.status).json({ - status: 'error', - message: 'Failed to get Caddy configuration', - details: response.data - }); - } - } catch (error) { - console.error('Error getting Caddy config:', error); - res.status(500).json({ - status: 'error', - message: error.message - }); - } -}); - -// Get list of services (from apps.json + custom apps) -app.get('/api/v1/services', async (req, res) => { - try { - const servicesPath = path.join(__dirname, '../apps.json'); - - if (fs.existsSync(servicesPath)) { - const servicesData = fs.readFileSync(servicesPath, 'utf8'); - const services = JSON.parse(servicesData); - res.json({ status: 'success', services }); - } else { - res.json({ status: 'success', services: [] }); - } - } catch (error) { - console.error('Error reading services:', error); - res.status(500).json({ - status: 'error', - message: error.message - }); - } -}); - -// Add DNS record via Technitium API -async function addDnsRecord(domain, ipAddress, ttl = 3600) { - if (!DNS_API_TOKEN) { - throw new Error('DNS API token not configured. Set TECHNITIUM_API_TOKEN environment variable.'); - } - - const url = `${DNS_SERVER_API}/api/zones/records/add?token=${DNS_API_TOKEN}&domain=${domain}&type=A&ipAddress=${ipAddress}&ttl=${ttl}`; - - console.log('Adding DNS record:', { domain, ipAddress, ttl }); - const response = await makeRequest(url); - - if (response.data.status === 'ok') { - return { success: true, message: 'DNS record added successfully' }; - } else { - throw new Error(`DNS API error: ${response.data.message || 'Unknown error'}`); - } -} - -// Delete DNS record via Technitium API -async function deleteDnsRecord(domain, ipAddress) { - if (!DNS_API_TOKEN) { - console.warn('DNS API token not configured. Skipping DNS deletion.'); - return { success: true, message: 'DNS deletion skipped (no token)' }; - } - - const url = `${DNS_SERVER_API}/api/zones/records/delete?token=${DNS_API_TOKEN}&domain=${domain}&type=A&ipAddress=${ipAddress}`; - - console.log('Deleting DNS record:', { domain, ipAddress }); - const response = await makeRequest(url); - - if (response.data.status === 'ok') { - return { success: true, message: 'DNS record deleted successfully' }; - } else { - throw new Error(`DNS API error: ${response.data.message || 'Unknown error'}`); - } -} - -// Add route to Caddy via Admin API -async function addCaddyRoute(domain, upstreamUrl, useTls = true) { - // Build Caddy route configuration - const routeConfig = { - "@id": domain, - "match": [{ - "host": [domain] - }], - "handle": [{ - "handler": "reverse_proxy", - "upstreams": [{ - "dial": upstreamUrl.replace(/^https?:\/\//, '') - }] - }], - "terminal": true - }; - - // If using internal TLS, we need to add TLS configuration - if (useTls) { - // Caddy handles TLS automatically for matched domains - // Internal CA is configured in the global Caddyfile - } - - console.log('Adding Caddy route:', JSON.stringify(routeConfig, null, 2)); - - // Add the route to the HTTP server - const response = await makeRequest(`${CADDY_ADMIN_API}/config/apps/http/servers/srv0/routes/0`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(routeConfig) - }); - - if (response.status === 200 || response.status === 201) { - return { success: true, message: 'Caddy route added successfully' }; - } else { - throw new Error(`Caddy API error: ${JSON.stringify(response.data)}`); - } -} - -// Deploy app endpoint - handles DNS and Caddy configuration via APIs -app.post('/api/v1/apps/deploy', async (req, res) => { - try { - const { appId, config } = req.body; - const { subdomain, ip, createDns, port, sslType, dnsType } = config; - - console.log('Deploying app:', { appId, config }); - - // Validate required fields - if (!appId || !subdomain || !ip) { - return res.status(400).json({ - success: false, - message: 'Missing required fields: appId, subdomain, ip' - }); - } - - // Build the full domain - const domain = subdomain.includes('.') ? subdomain : `${subdomain}.sami`; - const finalPort = port || '80'; - const upstreamUrl = `${ip}:${finalPort}`; - - // Step 1: Add DNS record if requested (private DNS) - if (createDns && dnsType === 'private') { - try { - await addDnsRecord(domain, ip); - } catch (dnsError) { - console.error('DNS creation failed:', dnsError); - return res.status(500).json({ - success: false, - message: `DNS creation failed: ${dnsError.message}`, - step: 'dns' - }); - } - } - - // Step 2: Add route to Caddy via Admin API - try { - const useTls = sslType === 'internal'; - await addCaddyRoute(domain, upstreamUrl, useTls); - } catch (caddyError) { - console.error('Caddy route addition failed:', caddyError); - - // Rollback DNS if it was created - if (createDns && dnsType === 'private') { - try { - await deleteDnsRecord(domain, ip); - } catch (rollbackError) { - console.error('DNS rollback failed:', rollbackError); - } - } - - return res.status(500).json({ - success: false, - message: `Caddy configuration failed: ${caddyError.message}`, - step: 'caddy' - }); - } - - // Step 3: Return success response - res.json({ - success: true, - message: `App ${appId} deployed successfully`, - url: `https://${domain}`, - domain: domain, - ip: ip, - port: finalPort, - containerId: null, - dnsCreated: createDns && dnsType === 'private', - caddyConfigured: true - }); - - } catch (error) { - console.error('Deployment error:', error); - res.status(500).json({ - success: false, - message: error.message - }); - } -}); - -// Delete app endpoint - removes DNS and Caddy configuration -app.post('/api/v1/apps/delete', async (req, res) => { - try { - const { domain, ip } = req.body; - - if (!domain) { - return res.status(400).json({ - success: false, - message: 'Domain is required' - }); - } - - console.log('Deleting app:', { domain, ip }); - - // Step 1: Remove from Caddy - try { - const response = await makeRequest(`${CADDY_ADMIN_API}/id/${domain}`, { - method: 'DELETE' - }); - - if (response.status !== 200) { - console.warn('Caddy route deletion warning:', response.data); - } - } catch (caddyError) { - console.error('Caddy route deletion failed:', caddyError); - // Continue anyway to try DNS deletion - } - - // Step 2: Remove DNS record if IP provided - if (ip) { - try { - await deleteDnsRecord(domain, ip); - } catch (dnsError) { - console.error('DNS deletion failed:', dnsError); - return res.status(500).json({ - success: false, - message: `DNS deletion failed: ${dnsError.message}`, - caddyDeleted: true, - dnsDeleted: false - }); - } - } - - res.json({ - success: true, - message: 'App deleted successfully', - domain: domain, - caddyDeleted: true, - dnsDeleted: !!ip - }); - - } catch (error) { - console.error('Deletion error:', error); - res.status(500).json({ - success: false, - message: error.message - }); - } -}); - -// Test endpoint -app.get('/api/v1/caddy/test', (req, res) => { - res.json({ - status: 'success', - message: 'Caddy API is running', - timestamp: new Date().toISOString(), - platform: process.platform, - caddyAdminApi: CADDY_ADMIN_API, - dnsServerApi: DNS_SERVER_API, - dnsTokenConfigured: !!DNS_API_TOKEN - }); -}); - -// Health check -app.get('/health', (req, res) => { - res.json({ status: 'healthy', timestamp: new Date().toISOString() }); -}); - -// Start server -app.listen(PORT, () => { - console.log(`\n====================================`); - console.log(`Caddy API server running on http://localhost:${PORT}`); - console.log(`====================================`); - console.log(`Caddy Admin API: ${CADDY_ADMIN_API}`); - console.log(`DNS Server API: ${DNS_SERVER_API}`); - console.log(`DNS Token: ${DNS_API_TOKEN ? '✓ Configured' : '✗ Not configured'}`); - console.log(`\nEndpoints:`); - console.log(` POST /api/apps/deploy - Deploy an app (DNS + Caddy)`); - console.log(` POST /api/apps/delete - Delete an app (DNS + Caddy)`); - console.log(` GET /api/services - Get list of services`); - console.log(` GET /api/caddy/config - Get current Caddy configuration`); - console.log(` GET /api/caddy/test - Test API connectivity`); - console.log(` GET /health - Health check`); - console.log(`====================================\n`); -}); - -module.exports = app; diff --git a/status/api/caddy-manager.ps1 b/status/api/caddy-manager.ps1 deleted file mode 100644 index d5bd6fe..0000000 --- a/status/api/caddy-manager.ps1 +++ /dev/null @@ -1,206 +0,0 @@ -# Caddy Configuration Manager for Windows -# This script adds new service configurations to your Caddyfile - -param( - [string]$Config, - [string]$Subdomain, - [string]$CaddyfilePath = "C:\caddy\Caddyfile", - [bool]$ReloadCaddy = $true -) - -# Function to write JSON response -function Write-JsonResponse { - param($Status, $Message, $Data = $null) - - $response = @{ - status = $Status - message = $Message - timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss") - } - - if ($Data) { - $response.data = $Data - } - - return $response | ConvertTo-Json -} - -# Function to extract CA names from Caddyfile -function Get-CaddyfileCAs { - param([string]$CaddyfilePath) - - try { - Write-Host "DEBUG: Checking file path: $CaddyfilePath" - - if (-not (Test-Path $CaddyfilePath)) { - Write-Host "DEBUG: File not found" - return @() - } - - $content = Get-Content $CaddyfilePath -Raw - Write-Host "DEBUG: File content length: $($content.Length)" - Write-Host "DEBUG: First 200 chars: $($content.Substring(0, [Math]::Min(200, $content.Length)))" - - $caNames = @() - - # Pattern 1: PKI block with CA definitions - pki { ca ca_name { name "Friendly Name" } } - $pkiPattern = 'pki\s*\{[^}]*?ca\s+([^\s\{]+)\s*\{([^}]*?)\}' - Write-Host "DEBUG: Searching for PKI pattern: $pkiPattern" - - $pkiMatches = [regex]::Matches($content, $pkiPattern, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase -bor [System.Text.RegularExpressions.RegexOptions]::Singleline) - Write-Host "DEBUG: PKI matches found: $($pkiMatches.Count)" - - foreach ($match in $pkiMatches) { - $caId = $match.Groups[1].Value - $caBlock = $match.Groups[2].Value - Write-Host "DEBUG: Found CA ID: $caId" - Write-Host "DEBUG: CA Block: $caBlock" - - # Try to extract the friendly name from within the CA block - $nameMatch = [regex]::Match($caBlock, 'name\s+"([^"]+)"', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) - if ($nameMatch.Success) { - $friendlyName = $nameMatch.Groups[1].Value - Write-Host "DEBUG: Found friendly name: $friendlyName" - $caNames += "$caId ($friendlyName)" - } else { - Write-Host "DEBUG: No friendly name found, using ID only" - $caNames += $caId - } - } - - # Pattern 2: tls { ca ca_name } - $matches1 = [regex]::Matches($content, 'tls\s*\{\s*ca\s+([^\s\}]+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) - Write-Host "DEBUG: TLS block matches: $($matches1.Count)" - foreach ($match in $matches1) { - $caNames += $match.Groups[1].Value - } - - # Pattern 3: tls ca_name (direct) - $matches2 = [regex]::Matches($content, 'tls\s+([^\s\{]+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) - Write-Host "DEBUG: Direct TLS matches: $($matches2.Count)" - foreach ($match in $matches2) { - $caName = $match.Groups[1].Value - if ($caName -ne "internal" -and $caName -ne "off") { - $caNames += $caName - } - } - - Write-Host "DEBUG: Total CAs found: $($caNames.Count)" - Write-Host "DEBUG: CA list: $($caNames -join ', ')" - - # Remove duplicates and return - return $caNames | Sort-Object | Get-Unique - } - catch { - Write-Host "DEBUG: Exception in Get-CaddyfileCAs: $($_.Exception.Message)" - Write-Host "Error reading CAs from Caddyfile: $($_.Exception.Message)" - return @() - } -} - -# Handle get-cas command -if ($args[0] -eq "get-cas") { - $CaddyfilePath = if ($args[1]) { $args[1] } else { "C:\caddy\Caddyfile" } - - Write-Host "DEBUG: get-cas command received" - Write-Host "DEBUG: Caddyfile path: $CaddyfilePath" - Write-Host "DEBUG: File exists: $(Test-Path $CaddyfilePath)" - - try { - $cas = Get-CaddyfileCAs -CaddyfilePath $CaddyfilePath - - Write-Host "DEBUG: CAs found: $($cas -join ', ')" - - $response = @{ - status = "success" - message = "CAs retrieved successfully" - data = @{ - cas = $cas - count = $cas.Count - caddyfilePath = $CaddyfilePath - } - timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss") - } - - Write-Output ($response | ConvertTo-Json) - exit 0 - } - catch { - Write-Host "DEBUG: Error occurred: $($_.Exception.Message)" - - $response = @{ - status = "error" - message = "Failed to retrieve CAs: $($_.Exception.Message)" - timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss") - } - - Write-Output ($response | ConvertTo-Json) - exit 1 - } -} - -# Main configuration addition logic -try { - # Validate required parameters for config addition - if (-not $Config -or -not $Subdomain) { - Write-Output (Write-JsonResponse "error" "Config and Subdomain parameters are required") - exit 1 - } - - # Check if Caddyfile exists - if (-not (Test-Path $CaddyfilePath)) { - Write-Output (Write-JsonResponse "error" "Caddyfile not found at: $CaddyfilePath") - exit 1 - } - - # Read existing Caddyfile - $existingConfig = Get-Content $CaddyfilePath -Raw -ErrorAction Stop - - # Check if subdomain already exists - if ($existingConfig -match "$Subdomain\.sami\s*\{") { - Write-Output (Write-JsonResponse "error" "Subdomain '$Subdomain.sami' already exists in Caddyfile") - exit 1 - } - - # Create backup - $backupPath = "$CaddyfilePath.backup.$(Get-Date -Format 'yyyyMMdd-HHmmss')" - Copy-Item $CaddyfilePath $backupPath -ErrorAction Stop - Write-Host "Backup created: $backupPath" - - # Append new configuration - $newContent = $existingConfig.TrimEnd() + "`n`n" + $Config.TrimEnd() + "`n" - Set-Content -Path $CaddyfilePath -Value $newContent -NoNewline -ErrorAction Stop - - Write-Host "Configuration added successfully" - - # Reload Caddy if requested - if ($ReloadCaddy) { - Write-Host "Reloading Caddy..." - - # Try to reload Caddy - $reloadResult = & caddy reload --config $CaddyfilePath 2>&1 - - if ($LASTEXITCODE -eq 0) { - Write-Host "Caddy reloaded successfully" - Write-Output (Write-JsonResponse "success" "Configuration added and Caddy reloaded successfully" @{ - backup = $backupPath - subdomain = "$Subdomain.sami" - }) - } else { - Write-Host "Caddy reload failed: $reloadResult" - # Restore backup if reload failed - Copy-Item $backupPath $CaddyfilePath -Force - Write-Output (Write-JsonResponse "error" "Caddy reload failed. Configuration rolled back. Error: $reloadResult") - exit 1 - } - } else { - Write-Output (Write-JsonResponse "success" "Configuration added successfully (Caddy not reloaded)" @{ - backup = $backupPath - subdomain = "$Subdomain.sami" - }) - } - -} catch { - Write-Output (Write-JsonResponse "error" "Error: $($_.Exception.Message)") - exit 1 -} \ No newline at end of file diff --git a/status/api/install-and-run.bat b/status/api/install-and-run.bat deleted file mode 100644 index a54c518..0000000 --- a/status/api/install-and-run.bat +++ /dev/null @@ -1,63 +0,0 @@ -@echo off -title SAMI Caddy API Server -echo ======================================== -echo Installing SAMI Caddy API Server... -echo ======================================== - -REM Check if Node.js is installed -echo Checking for Node.js... -node --version >nul 2>&1 -if %errorlevel% neq 0 ( - echo. - echo ERROR: Node.js is not installed or not in PATH - echo Please install Node.js from https://nodejs.org/ - echo. - pause - exit /b 1 -) - -echo Node.js found: -node --version - -echo. -echo Installing dependencies... -echo. - -REM Install npm dependencies -npm install - -if %errorlevel% neq 0 ( - echo. - echo ERROR: Failed to install dependencies - echo Check the error messages above - echo. - pause - exit /b 1 -) - -echo. -echo ======================================== -echo Dependencies installed successfully! -echo ======================================== -echo. -echo Starting Caddy API server... -echo. -echo Server URL: http://localhost:3001 -echo Test URL: http://localhost:3001/api/caddy/test -echo. -echo Press Ctrl+C to stop the server -echo ======================================== -echo. - -REM Start the server and keep window open on error -npm start -if %errorlevel% neq 0 ( - echo. - echo ERROR: Server failed to start - echo Check the error messages above - echo. -) - -echo. -echo Server stopped. -pause \ No newline at end of file diff --git a/status/api/package-lock.json b/status/api/package-lock.json deleted file mode 100644 index 35eeddf..0000000 --- a/status/api/package-lock.json +++ /dev/null @@ -1,1227 +0,0 @@ -{ - "name": "sami-caddy-api", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "sami-caddy-api", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "cors": "^2.8.5", - "express": "^4.18.2" - }, - "devDependencies": { - "nodemon": "^3.0.1" - } - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "license": "MIT", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "license": "MIT" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/body-parser": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", - "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", - "license": "MIT", - "dependencies": { - "bytes": "~3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "~1.2.0", - "http-errors": "~2.0.1", - "iconv-lite": "~0.4.24", - "on-finished": "~2.4.1", - "qs": "~6.14.0", - "raw-body": "~2.5.3", - "type-is": "~1.6.18", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", - "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", - "license": "MIT" - }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "license": "MIT", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.22.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", - "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", - "license": "MIT", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "~1.20.3", - "content-disposition": "~0.5.4", - "content-type": "~1.0.4", - "cookie": "~0.7.1", - "cookie-signature": "~1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.3.1", - "fresh": "~0.5.2", - "http-errors": "~2.0.0", - "merge-descriptors": "1.0.3", - "methods": "~1.1.2", - "on-finished": "~2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "~0.1.12", - "proxy-addr": "~2.0.7", - "qs": "~6.14.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "~0.19.0", - "serve-static": "~1.16.2", - "setprototypeof": "1.2.0", - "statuses": "~2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", - "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "on-finished": "~2.4.1", - "parseurl": "~1.3.3", - "statuses": "~2.0.2", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true, - "license": "ISC" - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "license": "MIT" - }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/nodemon": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.11.tgz", - "integrity": "sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^4", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^7.5.3", - "simple-update-notifier": "^2.0.0", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/nodemon/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", - "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", - "license": "MIT" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true, - "license": "MIT" - }, - "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.1.0" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", - "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", - "license": "MIT", - "dependencies": { - "bytes": "~3.1.2", - "http-errors": "~2.0.1", - "iconv-lite": "~0.4.24", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/send": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", - "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "~0.5.2", - "http-errors": "~2.0.1", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "~2.4.1", - "range-parser": "~1.2.1", - "statuses": "~2.0.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/serve-static": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", - "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", - "license": "MIT", - "dependencies": { - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "~0.19.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC" - }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/simple-update-notifier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", - "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", - "dev": true, - "license": "ISC", - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true, - "license": "MIT" - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - } - } -} diff --git a/status/api/package.json b/status/api/package.json deleted file mode 100644 index df922c6..0000000 --- a/status/api/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "sami-caddy-api", - "version": "2.0.0", - "description": "Cross-platform API server for managing Caddy and DNS via REST APIs", - "main": "caddy-api.js", - "scripts": { - "start": "node caddy-api.js", - "dev": "nodemon caddy-api.js", - "test": "node test-api.js" - }, - "dependencies": { - "express": "^4.18.2", - "cors": "^2.8.5" - }, - "devDependencies": { - "nodemon": "^3.0.1" - }, - "keywords": ["caddy", "api", "dns", "technitium", "reverse-proxy", "cross-platform", "sami-cloud"], - "author": "SAMI-CLOUD", - "license": "MIT" -} \ No newline at end of file diff --git a/status/api/start.bat b/status/api/start.bat deleted file mode 100644 index a3aa5b2..0000000 --- a/status/api/start.bat +++ /dev/null @@ -1,44 +0,0 @@ -@echo off -REM Quick start script for SAMI-CLOUD API Server (Windows) - -echo ==================================== -echo SAMI-CLOUD API Server -echo ==================================== -echo. - -REM Check if Node.js is installed -where node >nul 2>nul -if %errorlevel% neq 0 ( - echo Error: Node.js is not installed or not in PATH - echo Please install Node.js from https://nodejs.org/ - pause - exit /b 1 -) - -REM Check if node_modules exists -if not exist "node_modules" ( - echo Installing dependencies... - call npm install - echo. -) - -REM Check environment variables -if "%CADDY_ADMIN_API%"=="" ( - echo Warning: CADDY_ADMIN_API not set, using default: http://localhost:2019 - set CADDY_ADMIN_API=http://localhost:2019 -) - -if "%DNS_SERVER_API%"=="" ( - echo Warning: DNS_SERVER_API not set, using default: http://192.168.254.204:5380 - set DNS_SERVER_API=http://192.168.254.204:5380 -) - -if "%TECHNITIUM_API_TOKEN%"=="" ( - echo Warning: TECHNITIUM_API_TOKEN not set - DNS operations will fail - echo Set it with: set TECHNITIUM_API_TOKEN=your_token - echo. -) - -echo Starting API server... -echo. -node caddy-api.js diff --git a/status/api/start.sh b/status/api/start.sh deleted file mode 100644 index f858480..0000000 --- a/status/api/start.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Quick start script for SAMI-CLOUD API Server (Linux/macOS) - -echo "====================================" -echo "SAMI-CLOUD API Server" -echo "====================================" -echo "" - -# Check if Node.js is installed -if ! command -v node &> /dev/null; then - echo "Error: Node.js is not installed or not in PATH" - echo "Please install Node.js from https://nodejs.org/" - exit 1 -fi - -# Check if node_modules exists -if [ ! -d "node_modules" ]; then - echo "Installing dependencies..." - npm install - echo "" -fi - -# Check environment variables -if [ -z "$CADDY_ADMIN_API" ]; then - echo "Warning: CADDY_ADMIN_API not set, using default: http://localhost:2019" - export CADDY_ADMIN_API="http://localhost:2019" -fi - -if [ -z "$DNS_SERVER_API" ]; then - echo "Warning: DNS_SERVER_API not set, using default: http://192.168.254.204:5380" - export DNS_SERVER_API="http://192.168.254.204:5380" -fi - -if [ -z "$TECHNITIUM_API_TOKEN" ]; then - echo "Warning: TECHNITIUM_API_TOKEN not set - DNS operations will fail" - echo "Set it with: export TECHNITIUM_API_TOKEN=your_token" - echo "" -fi - -echo "Starting API server..." -echo "" -node caddy-api.js diff --git a/status/api/test-api.js b/status/api/test-api.js deleted file mode 100644 index a436db2..0000000 --- a/status/api/test-api.js +++ /dev/null @@ -1,72 +0,0 @@ -// Simple test script to verify API connectivity -const http = require('http'); - -const API_URL = 'http://localhost:3001'; - -function makeRequest(path) { - return new Promise((resolve, reject) => { - http.get(`${API_URL}${path}`, (res) => { - let data = ''; - res.on('data', (chunk) => data += chunk); - res.on('end', () => { - try { - resolve({ status: res.statusCode, data: JSON.parse(data) }); - } catch (e) { - resolve({ status: res.statusCode, data: data }); - } - }); - }).on('error', reject); - }); -} - -async function runTests() { - console.log('Testing SAMI-CLOUD API...\n'); - - // Test 1: Health Check - console.log('1. Testing health endpoint...'); - try { - const health = await makeRequest('/health'); - if (health.status === 200) { - console.log(' ✓ Health check passed'); - } else { - console.log(' ✗ Health check failed:', health.status); - } - } catch (error) { - console.log(' ✗ Health check error:', error.message); - } - - // Test 2: API Test Endpoint - console.log('\n2. Testing API test endpoint...'); - try { - const test = await makeRequest('/api/v1/caddy/test'); - if (test.status === 200) { - console.log(' ✓ API test passed'); - console.log(' Platform:', test.data.platform); - console.log(' Caddy Admin API:', test.data.caddyAdminApi); - console.log(' DNS Server API:', test.data.dnsServerApi); - console.log(' DNS Token:', test.data.dnsTokenConfigured ? 'Configured' : 'Not configured'); - } else { - console.log(' ✗ API test failed:', test.status); - } - } catch (error) { - console.log(' ✗ API test error:', error.message); - } - - // Test 3: Services Endpoint - console.log('\n3. Testing services endpoint...'); - try { - const services = await makeRequest('/api/v1/services'); - if (services.status === 200) { - console.log(' ✓ Services endpoint passed'); - console.log(' Found', services.data.services.length, 'services'); - } else { - console.log(' ✗ Services endpoint failed:', services.status); - } - } catch (error) { - console.log(' ✗ Services endpoint error:', error.message); - } - - console.log('\nTests complete!'); -} - -runTests().catch(console.error); diff --git a/status/api/test-server.bat b/status/api/test-server.bat deleted file mode 100644 index a410eea..0000000 --- a/status/api/test-server.bat +++ /dev/null @@ -1,84 +0,0 @@ -@echo off -title SAMI Caddy API Server - Debug Mode -echo ======================================== -echo SAMI Caddy API Server - Debug Mode -echo ======================================== - -cd /d "%~dp0" -echo Current directory: %CD% - -echo. -echo Checking Node.js... -node --version -if %errorlevel% neq 0 ( - echo ERROR: Node.js not found - pause - exit /b 1 -) - -echo. -echo Checking files... -if exist "caddy-api.js" ( - echo ✓ caddy-api.js found -) else ( - echo ✗ caddy-api.js NOT found - pause - exit /b 1 -) - -if exist "package.json" ( - echo ✓ package.json found -) else ( - echo ✗ package.json NOT found - pause - exit /b 1 -) - -if exist "caddy-manager.ps1" ( - echo ✓ caddy-manager.ps1 found -) else ( - echo ✗ caddy-manager.ps1 NOT found - pause - exit /b 1 -) - -echo. -echo Installing dependencies... -npm install -if %errorlevel% neq 0 ( - echo ERROR: npm install failed - pause - exit /b 1 -) - -echo. -echo ======================================== -echo Starting server with error capture... -echo ======================================== -echo Server will run on: http://localhost:3001 -echo Test endpoint: http://localhost:3001/api/caddy/test -echo. -echo If server starts successfully, you'll see "Caddy API server running..." -echo Press Ctrl+C to stop the server -echo ======================================== -echo. - -REM Capture both stdout and stderr -node caddy-api.js 2>&1 -set SERVER_EXIT_CODE=%errorlevel% - -echo. -echo ======================================== -echo Server exited with code: %SERVER_EXIT_CODE% -echo ======================================== - -if %SERVER_EXIT_CODE% neq 0 ( - echo ERROR: Server failed to start or crashed - echo Check the error messages above -) else ( - echo Server stopped normally -) - -echo. -echo Press any key to close this window... -pause >nul \ No newline at end of file