feat(vhost-manager): add VHost templates synchronized with appstore
Created dynamic VHost template system similar to Network Modes profiles: New Files: - root/usr/share/vhost-manager/templates.json (7.7KB, 253 lines) - root/usr/share/vhost-manager/README.md Template Catalog (13 templates): - LuCI UI, Netdata (Core/Monitoring) - CrowdSec, AdGuard Home (Security/Network) - NoDogSplash (Network - Captive Portal) - Domoticz, Zigbee2MQTT (IoT & Home Automation) - Lyrion Music Server (Media) - LocalAI (AI & Machine Learning) - Citadel, Mail-in-a-Box, Nextcloud (Productivity) - ISPConfig (Hosting & Control Panels) Features: - Synchronized with SecuBox appstore applications - 9 categories matching appstore structure - Default domains (*.local), backend ports, SSL/auth requirements - Dynamic loading via fetch from /usr/share/vhost-manager/templates.json - Links to appstore app_id for integration Code Changes: - internal.js: Added loadTemplates() method with fetch API - Replaced hardcoded SERVICES array with dynamic loading - Version bump: 0.4.1-r3 → 0.5.0-r1 Benefits: - Single source of truth for service configurations - Easy to add new services (just edit JSON) - Consistent with appstore and network-modes pattern - Pre-configured templates reduce user errors - SSL and WebSocket settings included Access: https://192.168.8.191/cgi-bin/luci/admin/secubox/services/vhosts/internal 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f59ca75e08
commit
89232f3736
@ -4,8 +4,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-vhost-manager
|
||||
PKG_VERSION:=0.4.1
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=0.5.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
|
||||
|
||||
|
||||
@ -3,28 +3,55 @@
|
||||
'require vhost-manager/api as API';
|
||||
'require secubox-theme/theme as Theme';
|
||||
'require vhost-manager/ui as VHostUI';
|
||||
'require request';
|
||||
|
||||
var lang = (typeof L !== 'undefined' && L.env && L.env.lang) ||
|
||||
(document.documentElement && document.documentElement.getAttribute('lang')) ||
|
||||
(navigator.language ? navigator.language.split('-')[0] : 'en');
|
||||
Theme.init({ language: lang });
|
||||
|
||||
var SERVICES = [
|
||||
{ icon: '🖥️', name: _('LuCI UI'), domain: 'router.local', backend: 'http://127.0.0.1:80', category: _('Core'), description: _('Expose the management UI behind nginx with optional SSL and auth.') },
|
||||
{ icon: '📈', name: _('Netdata'), domain: 'metrics.local', backend: 'http://127.0.0.1:19999', category: _('Monitoring'), description: _('High-resolution telemetry for CPU, memory, and interfaces.') },
|
||||
{ icon: '🛡️', name: _('CrowdSec'), domain: 'crowdsec.local', backend: 'http://127.0.0.1:8080', category: _('Security'), description: _('Review bouncer decisions and live intrusion alerts.') },
|
||||
{ icon: '🏠', name: _('Home Assistant'), domain: 'home.local', backend: 'http://192.168.1.13:8123', category: _('Automation'), description: _('Publish your smart-home UI securely with SSL and auth.') },
|
||||
{ icon: '🎬', name: _('Media Server'), domain: 'media.local', backend: 'http://192.168.1.12:8096', category: _('Entertainment'), description: _('Jellyfin or Plex front-end available via a friendly hostname.') },
|
||||
{ icon: '🗄️', name: _('Nextcloud'), domain: 'cloud.local', backend: 'http://192.168.1.20:80', category: _('Productivity'), description: _('Bring private SaaS back on-prem with HTTPS and caching headers.') }
|
||||
];
|
||||
var SERVICES = [];
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
API.listVHosts()
|
||||
API.listVHosts(),
|
||||
this.loadTemplates()
|
||||
]);
|
||||
},
|
||||
|
||||
loadTemplates: function() {
|
||||
return request.get('/usr/share/vhost-manager/templates.json').then(function(response) {
|
||||
try {
|
||||
var data = JSON.parse(response.responseText || '{}');
|
||||
SERVICES = (data.templates || []).map(function(t) {
|
||||
return {
|
||||
id: t.id,
|
||||
icon: t.icon,
|
||||
name: t.name,
|
||||
domain: t.domain,
|
||||
backend: t.backend,
|
||||
port: t.port,
|
||||
category: t.category,
|
||||
description: t.description,
|
||||
app_id: t.app_id,
|
||||
requires_ssl: t.requires_ssl,
|
||||
requires_auth: t.requires_auth,
|
||||
websocket_support: t.websocket_support,
|
||||
notes: t.notes
|
||||
};
|
||||
});
|
||||
return SERVICES;
|
||||
} catch(e) {
|
||||
console.error('Failed to parse vhost templates:', e);
|
||||
return [];
|
||||
}
|
||||
}).catch(function(err) {
|
||||
console.error('Failed to load vhost templates:', err);
|
||||
return [];
|
||||
});
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var vhosts = data[0] || [];
|
||||
var active = {};
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
# VHost Manager Templates
|
||||
|
||||
This directory contains pre-configured VHost templates for SecuBox appstore applications and common services.
|
||||
|
||||
## templates.json
|
||||
|
||||
VHost templates catalog synchronized with SecuBox appstore applications. Each template provides:
|
||||
|
||||
- **Domain**: Default local domain name
|
||||
- **Backend**: Internal service URL and port
|
||||
- **Category**: Service classification
|
||||
- **Requirements**: SSL, authentication, WebSocket support
|
||||
- **App ID**: Link to corresponding appstore application
|
||||
|
||||
## Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"templates": [
|
||||
{
|
||||
"id": "unique-id",
|
||||
"icon": "emoji",
|
||||
"name": "Service Name",
|
||||
"domain": "service.local",
|
||||
"backend": "http://127.0.0.1:port",
|
||||
"port": 8080,
|
||||
"category": "Category Name",
|
||||
"description": "Service description",
|
||||
"app_id": "secubox-app-id",
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": false,
|
||||
"notes": "Optional configuration notes"
|
||||
}
|
||||
],
|
||||
"categories": { ... },
|
||||
"metadata": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Templates are automatically loaded by the VHost Manager internal services page at:
|
||||
https://router-ip/cgi-bin/luci/admin/secubox/services/vhosts/internal
|
||||
|
||||
Users can:
|
||||
1. Browse available service templates by category
|
||||
2. See which services are already configured
|
||||
3. Create new VHosts based on templates with one click
|
||||
4. View recommended SSL and authentication settings
|
||||
|
||||
## Synchronization
|
||||
|
||||
This file is synchronized with:
|
||||
- **SecuBox Appstore** (`/usr/share/secubox/appstore/apps.json`)
|
||||
- **Network Modes** profiles pattern
|
||||
|
||||
When new apps are added to the appstore, corresponding VHost templates should be added here.
|
||||
|
||||
## Categories
|
||||
|
||||
- Core Services - Essential router management
|
||||
- Monitoring & Analytics - System monitoring tools
|
||||
- Security - Threat detection and security services
|
||||
- Network Services - DNS, captive portal, ad blocking
|
||||
- IoT & Home Automation - Smart home platforms
|
||||
- Media & Entertainment - Streaming services
|
||||
- AI & Machine Learning - LLM and AI tools
|
||||
- Productivity & Collaboration - File sharing, email, calendars
|
||||
- Hosting & Control Panels - Web hosting management
|
||||
|
||||
## Maintained by
|
||||
|
||||
CyberMind.fr - SecuBox Development Team
|
||||
@ -0,0 +1,253 @@
|
||||
{
|
||||
"templates": [
|
||||
{
|
||||
"id": "luci",
|
||||
"icon": "🖥️",
|
||||
"name": "LuCI UI",
|
||||
"domain": "router.local",
|
||||
"backend": "http://127.0.0.1:80",
|
||||
"port": 80,
|
||||
"category": "Core",
|
||||
"description": "Expose the management UI behind nginx with optional SSL and auth.",
|
||||
"app_id": null,
|
||||
"enabled_by_default": true,
|
||||
"requires_ssl": false,
|
||||
"requires_auth": false,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "netdata",
|
||||
"icon": "📈",
|
||||
"name": "Netdata",
|
||||
"domain": "metrics.local",
|
||||
"backend": "http://127.0.0.1:19999",
|
||||
"port": 19999,
|
||||
"category": "Monitoring",
|
||||
"description": "High-resolution telemetry for CPU, memory, and interfaces.",
|
||||
"app_id": null,
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": false,
|
||||
"requires_auth": true,
|
||||
"websocket_support": true
|
||||
},
|
||||
{
|
||||
"id": "crowdsec",
|
||||
"icon": "🛡️",
|
||||
"name": "CrowdSec",
|
||||
"domain": "crowdsec.local",
|
||||
"backend": "http://127.0.0.1:8080",
|
||||
"port": 8080,
|
||||
"category": "Security",
|
||||
"description": "Review bouncer decisions and live intrusion alerts.",
|
||||
"app_id": "secubox-app-crowdsec",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "nodogsplash",
|
||||
"icon": "🌐",
|
||||
"name": "NoDogSplash",
|
||||
"domain": "portal.local",
|
||||
"backend": "http://127.0.0.1:2050",
|
||||
"port": 2050,
|
||||
"category": "Network",
|
||||
"description": "Captive portal splash page for guest network access control.",
|
||||
"app_id": "secubox-app-nodogsplash",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": false,
|
||||
"requires_auth": false,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "domoticz",
|
||||
"icon": "🏠",
|
||||
"name": "Domoticz",
|
||||
"domain": "domoticz.local",
|
||||
"backend": "http://127.0.0.1:8080",
|
||||
"port": 8080,
|
||||
"category": "IoT & Home Automation",
|
||||
"description": "Home automation system with support for various devices and protocols.",
|
||||
"app_id": "secubox-app-domoticz",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": true
|
||||
},
|
||||
{
|
||||
"id": "lyrion",
|
||||
"icon": "🎵",
|
||||
"name": "Lyrion Music Server",
|
||||
"domain": "music.local",
|
||||
"backend": "http://127.0.0.1:9000",
|
||||
"port": 9000,
|
||||
"category": "Media",
|
||||
"description": "Multi-room audio streaming server (formerly Logitech Media Server).",
|
||||
"app_id": "secubox-app-lyrion",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": false,
|
||||
"requires_auth": false,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "zigbee2mqtt",
|
||||
"icon": "📡",
|
||||
"name": "Zigbee2MQTT",
|
||||
"domain": "zigbee.local",
|
||||
"backend": "http://127.0.0.1:8080",
|
||||
"port": 8080,
|
||||
"category": "IoT & Home Automation",
|
||||
"description": "Zigbee to MQTT bridge with web-based device management interface.",
|
||||
"app_id": "secubox-app-zigbee2mqtt",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": true
|
||||
},
|
||||
{
|
||||
"id": "localai",
|
||||
"icon": "🤖",
|
||||
"name": "LocalAI",
|
||||
"domain": "ai.local",
|
||||
"backend": "http://127.0.0.1:8080",
|
||||
"port": 8080,
|
||||
"category": "AI & Machine Learning",
|
||||
"description": "Self-hosted OpenAI-compatible API with web interface for model management.",
|
||||
"app_id": "secubox-app-localai",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "citadel",
|
||||
"icon": "🏢",
|
||||
"name": "Citadel",
|
||||
"domain": "groupware.local",
|
||||
"backend": "http://127.0.0.1:504",
|
||||
"port": 504,
|
||||
"category": "Productivity",
|
||||
"description": "Complete groupware with email, calendar, contacts, and instant messaging.",
|
||||
"app_id": "secubox-app-citadel",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": true
|
||||
},
|
||||
{
|
||||
"id": "ispconfig",
|
||||
"icon": "🖥️",
|
||||
"name": "ISPConfig",
|
||||
"domain": "hosting.local",
|
||||
"backend": "http://127.0.0.1:8080",
|
||||
"port": 8080,
|
||||
"category": "Hosting & Control Panels",
|
||||
"description": "Web hosting control panel for managing servers, websites, and databases.",
|
||||
"app_id": "secubox-app-ispconfig",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "mailinabox",
|
||||
"icon": "📧",
|
||||
"name": "Mail-in-a-Box",
|
||||
"domain": "mail.local",
|
||||
"backend": "http://127.0.0.1:4430",
|
||||
"port": 4430,
|
||||
"category": "Productivity",
|
||||
"description": "Easy-to-deploy email server with webmail, contacts, and calendar.",
|
||||
"app_id": "secubox-app-mailinabox",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": true,
|
||||
"websocket_support": false
|
||||
},
|
||||
{
|
||||
"id": "nextcloud",
|
||||
"icon": "☁️",
|
||||
"name": "Nextcloud",
|
||||
"domain": "cloud.local",
|
||||
"backend": "http://127.0.0.1:80",
|
||||
"port": 80,
|
||||
"category": "Productivity",
|
||||
"description": "Self-hosted file sync and share with calendar, contacts, and collaboration.",
|
||||
"app_id": "secubox-app-nextcloud",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": false,
|
||||
"websocket_support": true,
|
||||
"notes": "Nextcloud handles its own authentication. Configure trusted domains in config.php."
|
||||
},
|
||||
{
|
||||
"id": "adguardhome",
|
||||
"icon": "🛡️",
|
||||
"name": "AdGuard Home",
|
||||
"domain": "adguard.local",
|
||||
"backend": "http://127.0.0.1:3000",
|
||||
"port": 3000,
|
||||
"category": "Network",
|
||||
"description": "Network-wide ad blocker with DNS-over-HTTPS/TLS and analytics dashboard.",
|
||||
"app_id": "secubox-app-adguardhome",
|
||||
"enabled_by_default": false,
|
||||
"requires_ssl": true,
|
||||
"requires_auth": false,
|
||||
"websocket_support": false,
|
||||
"notes": "AdGuard Home has its own authentication system."
|
||||
}
|
||||
],
|
||||
"categories": {
|
||||
"Core": {
|
||||
"name": "Core Services",
|
||||
"icon": "🖥️",
|
||||
"description": "Essential router services and management interfaces"
|
||||
},
|
||||
"Monitoring": {
|
||||
"name": "Monitoring & Analytics",
|
||||
"icon": "📈",
|
||||
"description": "System monitoring and performance analytics tools"
|
||||
},
|
||||
"Security": {
|
||||
"name": "Security",
|
||||
"icon": "🛡️",
|
||||
"description": "Security and threat detection services"
|
||||
},
|
||||
"Network": {
|
||||
"name": "Network Services",
|
||||
"icon": "🌐",
|
||||
"description": "Network utilities and DNS services"
|
||||
},
|
||||
"IoT & Home Automation": {
|
||||
"name": "IoT & Home Automation",
|
||||
"icon": "🏠",
|
||||
"description": "Smart home and IoT device management"
|
||||
},
|
||||
"Media": {
|
||||
"name": "Media & Entertainment",
|
||||
"icon": "🎵",
|
||||
"description": "Media streaming and entertainment services"
|
||||
},
|
||||
"AI & Machine Learning": {
|
||||
"name": "AI & Machine Learning",
|
||||
"icon": "🤖",
|
||||
"description": "AI models and machine learning tools"
|
||||
},
|
||||
"Productivity": {
|
||||
"name": "Productivity & Collaboration",
|
||||
"icon": "📧",
|
||||
"description": "Email, file sharing, and collaboration tools"
|
||||
},
|
||||
"Hosting & Control Panels": {
|
||||
"name": "Hosting & Control Panels",
|
||||
"icon": "🖥️",
|
||||
"description": "Web hosting and server management"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"version": "1.0",
|
||||
"last_updated": "2026-01-01",
|
||||
"repository": "https://github.com/cybermind-studio/secubox-openwrt"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user