Phase 1: Add ESLint/Prettier config + baseline auto-fixes

This commit is contained in:
Krystie
2026-03-22 11:00:25 +01:00
parent 41a0cdee7e
commit e2c67a8fe8
90 changed files with 4008 additions and 3066 deletions

View File

@@ -23,7 +23,7 @@ const LICENSE_SERVER_URL = process.env.LICENSE_SERVER_URL || null; // Set when l
const PREMIUM_FEATURES = {
sso: { name: 'Auto-Login SSO', description: 'Automatic single sign-on for deployed apps' },
recipes: { name: 'Recipes', description: 'Multi-container stack deployment' },
swarm: { name: 'Docker Swarm', description: 'Multi-node cluster orchestration' }
swarm: { name: 'Docker Swarm', description: 'Multi-node cluster orchestration' },
};
class LicenseManager {
@@ -48,13 +48,13 @@ class LicenseManager {
if (this.isExpired()) {
this.log.info?.('license', 'License has expired', {
code: this._maskCode(this.activation.code),
expiredAt: this.activation.expiresAt
expiredAt: this.activation.expiresAt,
});
} else {
this.log.info?.('license', 'License loaded', {
code: this._maskCode(this.activation.code),
expiresAt: this.activation.expiresAt,
daysRemaining: this.daysRemaining()
daysRemaining: this.daysRemaining(),
});
}
} else {
@@ -96,7 +96,7 @@ class LicenseManager {
os.hostname(),
os.platform(),
os.arch(),
os.cpus()[0]?.model || 'unknown'
os.cpus()[0]?.model || 'unknown',
];
// Get primary MAC address
const interfaces = os.networkInterfaces();
@@ -132,7 +132,7 @@ class LicenseManager {
return {
success: true,
message: 'This code is already activated',
activation: this.getStatus()
activation: this.getStatus(),
};
}
@@ -170,7 +170,7 @@ class LicenseManager {
expiresAt: expiresAt.toISOString(),
machineId,
validationMethod: 'offline',
features: Object.keys(PREMIUM_FEATURES)
features: Object.keys(PREMIUM_FEATURES),
};
} else {
// Online validation succeeded — use server response
@@ -182,7 +182,7 @@ class LicenseManager {
try {
await this.credentialManager.store(LICENSE_CRED_KEY, JSON.stringify(this.activation), {
activatedAt: this.activation.activatedAt,
expiresAt: this.activation.expiresAt
expiresAt: this.activation.expiresAt,
});
} catch (error) {
this.log.error?.('license', 'Failed to store activation', { error: error.message });
@@ -196,14 +196,14 @@ class LicenseManager {
code: this._maskCode(code),
durationDays: this.activation.durationDays,
expiresAt: this.activation.expiresAt,
method: this.activation.validationMethod
method: this.activation.validationMethod,
});
const durationLabel = this.activation.lifetime ? 'lifetime' : `${this.activation.durationDays} days`;
return {
success: true,
message: `License activated for ${durationLabel}`,
activation: this.getStatus()
activation: this.getStatus(),
};
}
@@ -247,7 +247,7 @@ class LicenseManager {
active: false,
tier: 'free',
features: [],
premiumFeatures: PREMIUM_FEATURES
premiumFeatures: PREMIUM_FEATURES,
};
}
@@ -267,7 +267,7 @@ class LicenseManager {
expired,
features: expired ? [] : (this.activation.features || Object.keys(PREMIUM_FEATURES)),
premiumFeatures: PREMIUM_FEATURES,
validationMethod: this.activation.validationMethod
validationMethod: this.activation.validationMethod,
};
}
@@ -320,7 +320,7 @@ class LicenseManager {
featureName: featureInfo.name,
featureDescription: featureInfo.description,
currentTier: this.isExpired() ? 'free' : 'expired',
upgradeUrl: '/settings#license'
upgradeUrl: '/settings#license',
});
};
}
@@ -359,7 +359,7 @@ class LicenseManager {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code, machineId }),
signal: AbortSignal.timeout(10000) // 10s timeout
signal: AbortSignal.timeout(10000), // 10s timeout
});
if (!response.ok) {
@@ -379,8 +379,8 @@ class LicenseManager {
expiresAt: data.expiresAt,
machineId,
features: data.features || Object.keys(PREMIUM_FEATURES),
serverToken: data.token
}
serverToken: data.token,
},
};
}
@@ -388,7 +388,7 @@ class LicenseManager {
} catch (error) {
// Server unreachable — return null to fallback to offline
this.log.warn?.('license', 'License server unreachable, falling back to offline validation', {
error: error.message
error: error.message,
});
return null;
}
@@ -405,9 +405,9 @@ class LicenseManager {
body: JSON.stringify({
code: this.activation.code,
machineId: this.activation.machineId,
serverToken: this.activation.serverToken
serverToken: this.activation.serverToken,
}),
signal: AbortSignal.timeout(10000)
signal: AbortSignal.timeout(10000),
});
}
@@ -431,7 +431,7 @@ class LicenseManager {
tier: 'premium',
expiresAt: this.activation.expiresAt,
daysRemaining: this.daysRemaining(),
features: this.activation.features || Object.keys(PREMIUM_FEATURES)
features: this.activation.features || Object.keys(PREMIUM_FEATURES),
};
} else {
config.license = { active: false, tier: 'free' };