2025-10-28 13:05:42 +00:00
|
|
|
/**
|
|
|
|
|
* Type definitions for Onebox
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Service types
|
|
|
|
|
export interface IService {
|
|
|
|
|
id?: number;
|
|
|
|
|
name: string;
|
|
|
|
|
image: string;
|
|
|
|
|
registry?: string;
|
|
|
|
|
envVars: Record<string, string>;
|
|
|
|
|
port: number;
|
|
|
|
|
domain?: string;
|
|
|
|
|
containerID?: string;
|
|
|
|
|
status: 'stopped' | 'starting' | 'running' | 'stopping' | 'failed';
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
2025-11-24 01:31:15 +00:00
|
|
|
// Onebox Registry fields
|
|
|
|
|
useOneboxRegistry?: boolean;
|
|
|
|
|
registryRepository?: string;
|
|
|
|
|
registryToken?: string;
|
|
|
|
|
registryImageTag?: string;
|
|
|
|
|
autoUpdateOnPush?: boolean;
|
|
|
|
|
imageDigest?: string;
|
2025-10-28 13:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Registry types
|
|
|
|
|
export interface IRegistry {
|
|
|
|
|
id?: number;
|
|
|
|
|
url: string;
|
|
|
|
|
username: string;
|
|
|
|
|
passwordEncrypted: string;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Nginx configuration types
|
|
|
|
|
export interface INginxConfig {
|
|
|
|
|
id?: number;
|
|
|
|
|
serviceId: number;
|
|
|
|
|
domain: string;
|
|
|
|
|
port: number;
|
|
|
|
|
sslEnabled: boolean;
|
|
|
|
|
configTemplate: string;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 19:34:26 +00:00
|
|
|
// Domain management types
|
|
|
|
|
export interface IDomain {
|
|
|
|
|
id?: number;
|
|
|
|
|
domain: string;
|
|
|
|
|
dnsProvider: 'cloudflare' | 'manual' | null;
|
|
|
|
|
cloudflareZoneId?: string;
|
|
|
|
|
isObsolete: boolean;
|
|
|
|
|
defaultWildcard: boolean;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ICertificate {
|
|
|
|
|
id?: number;
|
|
|
|
|
domainId: number;
|
|
|
|
|
certDomain: string;
|
|
|
|
|
isWildcard: boolean;
|
|
|
|
|
certPath: string;
|
|
|
|
|
keyPath: string;
|
|
|
|
|
fullChainPath: string;
|
|
|
|
|
expiryDate: number;
|
|
|
|
|
issuer: string;
|
|
|
|
|
isValid: boolean;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ICertRequirement {
|
|
|
|
|
id?: number;
|
|
|
|
|
serviceId: number;
|
|
|
|
|
domainId: number;
|
|
|
|
|
subdomain: string;
|
|
|
|
|
certificateId?: number;
|
|
|
|
|
status: 'pending' | 'active' | 'renewing';
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IDomainView {
|
|
|
|
|
domain: IDomain;
|
|
|
|
|
certificates: ICertificate[];
|
|
|
|
|
requirements: ICertRequirement[];
|
|
|
|
|
serviceCount: number;
|
|
|
|
|
certificateStatus: 'valid' | 'expiring-soon' | 'expired' | 'pending' | 'none';
|
|
|
|
|
daysRemaining: number | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Legacy SSL certificate type (for backward compatibility)
|
2025-10-28 13:05:42 +00:00
|
|
|
export interface ISslCertificate {
|
|
|
|
|
id?: number;
|
|
|
|
|
domain: string;
|
|
|
|
|
certPath: string;
|
|
|
|
|
keyPath: string;
|
|
|
|
|
fullChainPath: string;
|
|
|
|
|
expiryDate: number;
|
|
|
|
|
issuer: string;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DNS record types
|
|
|
|
|
export interface IDnsRecord {
|
|
|
|
|
id?: number;
|
|
|
|
|
domain: string;
|
|
|
|
|
type: 'A' | 'AAAA' | 'CNAME';
|
|
|
|
|
value: string;
|
|
|
|
|
cloudflareID?: string;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Metrics types
|
|
|
|
|
export interface IMetric {
|
|
|
|
|
id?: number;
|
|
|
|
|
serviceId: number;
|
|
|
|
|
timestamp: number;
|
|
|
|
|
cpuPercent: number;
|
|
|
|
|
memoryUsed: number;
|
|
|
|
|
memoryLimit: number;
|
|
|
|
|
networkRxBytes: number;
|
|
|
|
|
networkTxBytes: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Log entry types
|
|
|
|
|
export interface ILogEntry {
|
|
|
|
|
id?: number;
|
|
|
|
|
serviceId: number;
|
|
|
|
|
timestamp: number;
|
|
|
|
|
message: string;
|
|
|
|
|
level: 'info' | 'warn' | 'error' | 'debug';
|
|
|
|
|
source: 'stdout' | 'stderr';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// User types
|
|
|
|
|
export interface IUser {
|
|
|
|
|
id?: number;
|
|
|
|
|
username: string;
|
|
|
|
|
passwordHash: string;
|
|
|
|
|
role: 'admin' | 'user';
|
|
|
|
|
createdAt: number;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Settings types
|
|
|
|
|
export interface ISetting {
|
|
|
|
|
key: string;
|
|
|
|
|
value: string;
|
|
|
|
|
updatedAt: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Application settings
|
|
|
|
|
export interface IAppSettings {
|
|
|
|
|
serverIP?: string;
|
|
|
|
|
cloudflareAPIKey?: string;
|
|
|
|
|
cloudflareEmail?: string;
|
|
|
|
|
cloudflareZoneID?: string;
|
|
|
|
|
acmeEmail?: string;
|
|
|
|
|
nginxConfigDir?: string;
|
|
|
|
|
dataDir?: string;
|
|
|
|
|
httpPort?: number;
|
|
|
|
|
metricsInterval?: number;
|
|
|
|
|
logRetentionDays?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Container stats from Docker
|
|
|
|
|
export interface IContainerStats {
|
|
|
|
|
cpuPercent: number;
|
|
|
|
|
memoryUsed: number;
|
|
|
|
|
memoryLimit: number;
|
|
|
|
|
memoryPercent: number;
|
|
|
|
|
networkRx: number;
|
|
|
|
|
networkTx: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Service deployment options
|
|
|
|
|
export interface IServiceDeployOptions {
|
|
|
|
|
name: string;
|
|
|
|
|
image: string;
|
|
|
|
|
registry?: string;
|
|
|
|
|
envVars?: Record<string, string>;
|
|
|
|
|
port: number;
|
|
|
|
|
domain?: string;
|
|
|
|
|
autoSSL?: boolean;
|
|
|
|
|
autoDNS?: boolean;
|
2025-11-24 01:31:15 +00:00
|
|
|
// Onebox Registry options
|
|
|
|
|
useOneboxRegistry?: boolean;
|
|
|
|
|
registryImageTag?: string;
|
|
|
|
|
autoUpdateOnPush?: boolean;
|
2025-10-28 13:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// HTTP API request/response types
|
|
|
|
|
export interface IApiResponse<T = unknown> {
|
|
|
|
|
success: boolean;
|
|
|
|
|
data?: T;
|
|
|
|
|
error?: string;
|
|
|
|
|
message?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ILoginRequest {
|
|
|
|
|
username: string;
|
|
|
|
|
password: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ILoginResponse {
|
|
|
|
|
token: string;
|
|
|
|
|
user: {
|
|
|
|
|
username: string;
|
|
|
|
|
role: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CLI command types
|
|
|
|
|
export interface ICliArgs {
|
|
|
|
|
_: string[];
|
|
|
|
|
[key: string]: unknown;
|
|
|
|
|
}
|