Add full Proxy Hosts feature for Control Room: - Data layer: datasource, model with custom JSON converters for NPM API quirks - Domain layer: ProxyHost entity with SSL, caching, websocket support - Presentation: list page, detail/edit page, form widget Add reusable entity page patterns for Control Room sections: - EntityPageScaffold, EntitySection, EntitySettingRow components - EntityForm with create/view/edit mode support - EntityPageModeMixin for consistent mode management - CreateOnlyField for immutable-after-creation fields 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
94 lines
2.1 KiB
Dart
94 lines
2.1 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'proxy_host.freezed.dart';
|
|
|
|
/// NPM proxy host entity representing a domain configuration.
|
|
@freezed
|
|
class ProxyHost with _$ProxyHost {
|
|
const factory ProxyHost({
|
|
/// Proxy host ID.
|
|
required int id,
|
|
|
|
/// Domain names (can have multiple).
|
|
required List<String> domainNames,
|
|
|
|
/// Forward scheme (http or https).
|
|
required String forwardScheme,
|
|
|
|
/// Forward host (IP or hostname).
|
|
required String forwardHost,
|
|
|
|
/// Forward port.
|
|
required int forwardPort,
|
|
|
|
/// Whether SSL is enabled.
|
|
required bool sslEnabled,
|
|
|
|
/// SSL certificate ID (if enabled).
|
|
int? certificateId,
|
|
|
|
/// Whether the host is enabled.
|
|
@Default(true) bool enabled,
|
|
|
|
/// Whether HTTP/2 is enabled.
|
|
@Default(false) bool http2Support,
|
|
|
|
/// Whether HSTS is enabled.
|
|
@Default(false) bool hstsEnabled,
|
|
|
|
/// Whether to force SSL.
|
|
@Default(false) bool forceSSL,
|
|
|
|
/// Custom locations (advanced nginx config).
|
|
@Default([]) List<ProxyLocation> locations,
|
|
|
|
/// Access list ID (for auth).
|
|
int? accessListId,
|
|
|
|
/// Cache assets enabled.
|
|
@Default(false) bool cacheAssets,
|
|
|
|
/// Block common exploits.
|
|
@Default(false) bool blockExploits,
|
|
|
|
/// Websocket support.
|
|
@Default(false) bool websocketSupport,
|
|
|
|
/// Created timestamp.
|
|
DateTime? createdAt,
|
|
|
|
/// Modified timestamp.
|
|
DateTime? modifiedAt,
|
|
}) = _ProxyHost;
|
|
|
|
const ProxyHost._();
|
|
|
|
/// Primary domain (first in list).
|
|
String get primaryDomain =>
|
|
domainNames.isNotEmpty ? domainNames.first : 'Unknown';
|
|
|
|
/// Forward URL (scheme://host:port).
|
|
String get forwardUrl => '$forwardScheme://$forwardHost:$forwardPort';
|
|
|
|
/// SSL status label.
|
|
String get sslStatus => sslEnabled ? 'SSL Enabled' : 'No SSL';
|
|
}
|
|
|
|
/// Proxy location for advanced routing.
|
|
@freezed
|
|
class ProxyLocation with _$ProxyLocation {
|
|
const factory ProxyLocation({
|
|
/// Location path.
|
|
required String path,
|
|
|
|
/// Forward scheme.
|
|
required String forwardScheme,
|
|
|
|
/// Forward host.
|
|
required String forwardHost,
|
|
|
|
/// Forward port.
|
|
required int forwardPort,
|
|
}) = _ProxyLocation;
|
|
}
|