secubox-openwrt/package/secubox/luci-app-vhost-manager/htdocs/luci-static/resources/vhost-manager/api.js
CyberMind-FR 31a87c5d7a feat(structure): reorganize luci-app packages into package/secubox/ + appstore migration
Major structural reorganization and feature additions:

## Folder Reorganization
- Move 17 luci-app-* packages to package/secubox/ (except luci-app-secubox core hub)
- Update all tooling to support new structure:
  - secubox-tools/quick-deploy.sh: search both locations
  - secubox-tools/validate-modules.sh: validate both directories
  - secubox-tools/fix-permissions.sh: fix permissions in both locations
  - .github/workflows/test-validate.yml: build from both paths
- Update README.md links to new package/secubox/ paths

## AppStore Migration (Complete)
- Add catalog entries for all remaining luci-app packages:
  - network-tweaks.json: Network optimization tools
  - secubox-bonus.json: Documentation & demos hub
- Total: 24 apps in AppStore catalog (22 existing + 2 new)
- New category: 'documentation' for docs/demos/tutorials

## VHost Manager v2.0 Enhancements
- Add profile activation system for Internal Services and Redirects
- Implement createVHost() API wrapper for template-based deployment
- Fix Virtual Hosts view rendering with proper LuCI patterns
- Fix RPCD backend shell script errors (remove invalid local declarations)
- Extend backend validation for nginx return directives (redirect support)
- Add section_id parameter for named VHost profiles
- Add Remove button to Redirects page for feature parity
- Update README to v2.0 with comprehensive feature documentation

## Network Tweaks Dashboard
- Close button added to component details modal

Files changed: 340+ (336 renames with preserved git history)
Packages affected: 19 luci-app, 2 secubox-app, 1 theme, 4 tools

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 14:59:38 +01:00

120 lines
2.7 KiB
JavaScript

'use strict';
'require baseclass';
'require rpc';
var callStatus = rpc.declare({
object: 'luci.vhost-manager',
method: 'status',
expect: { }
});
var callListVHosts = rpc.declare({
object: 'luci.vhost-manager',
method: 'list_vhosts',
expect: { vhosts: [] }
});
var callGetVHost = rpc.declare({
object: 'luci.vhost-manager',
method: 'get_vhost',
params: ['domain'],
expect: { }
});
var callAddVHost = rpc.declare({
object: 'luci.vhost-manager',
method: 'add_vhost',
params: ['domain', 'backend', 'tls_mode', 'auth', 'auth_user', 'auth_pass', 'websocket', 'enabled', 'cert_path', 'key_path', 'section_id'],
expect: { }
});
var callUpdateVHost = rpc.declare({
object: 'luci.vhost-manager',
method: 'update_vhost',
params: ['domain', 'backend', 'tls_mode', 'auth', 'auth_user', 'auth_pass', 'websocket', 'enabled', 'cert_path', 'key_path'],
expect: { }
});
var callDeleteVHost = rpc.declare({
object: 'luci.vhost-manager',
method: 'delete_vhost',
params: ['domain'],
expect: { }
});
var callTestBackend = rpc.declare({
object: 'luci.vhost-manager',
method: 'test_backend',
params: ['backend'],
expect: { }
});
var callRequestCert = rpc.declare({
object: 'luci.vhost-manager',
method: 'request_cert',
params: ['domain', 'email'],
expect: { }
});
var callListCerts = rpc.declare({
object: 'luci.vhost-manager',
method: 'list_certs',
expect: { certificates: [] }
});
var callReloadNginx = rpc.declare({
object: 'luci.vhost-manager',
method: 'reload_nginx',
expect: { }
});
var callGetAccessLogs = rpc.declare({
object: 'luci.vhost-manager',
method: 'get_access_logs',
params: ['domain', 'lines'],
expect: { logs: [] }
});
return baseclass.extend({
getStatus: callStatus,
listVHosts: callListVHosts,
getVHost: callGetVHost,
addVHost: callAddVHost,
updateVHost: callUpdateVHost,
deleteVHost: callDeleteVHost,
testBackend: callTestBackend,
requestCert: callRequestCert,
listCerts: callListCerts,
reloadNginx: callReloadNginx,
getAccessLogs: callGetAccessLogs,
// Wrapper for template-based VHost creation
createVHost: function(config) {
var domain = config.domain;
var backend = config.backend || config.upstream;
var tlsMode = config.tls_mode || (config.requires_ssl ? 'acme' : 'off');
var auth = config.auth || false;
var authUser = config.auth_user || null;
var authPass = config.auth_pass || null;
var websocket = config.websocket_enabled || config.websocket_support || false;
var enabled = config.enabled !== false;
var certPath = config.cert_path || null;
var keyPath = config.key_path || null;
var sectionId = config.section_id || config.id || null;
return callAddVHost(
domain,
backend,
tlsMode,
auth,
authUser,
authPass,
websocket,
enabled,
certPath,
keyPath,
sectionId
);
}
});