n8n-license-patch/patches/default/license.ts.patch
2025-06-18 10:44:00 +00:00

67 lines
2.2 KiB
Diff

diff --git a/packages/cli/src/license.ts b/packages/cli/src/license.ts
index eec82fe9e..2dd0429e3 100644
--- a/packages/cli/src/license.ts
+++ b/packages/cli/src/license.ts
@@ -89,34 +89,6 @@ export class License implements LicenseProvider {
this.logger.warn(LICENSE_RENEWAL_DISABLED_WARNING);
}
- try {
- this.manager = new LicenseManager({
- server,
- tenantId: this.globalConfig.license.tenantId,
- productIdentifier: `n8n-${N8N_VERSION}`,
- autoRenewEnabled: shouldRenew,
- renewOnInit: shouldRenew,
- autoRenewOffset,
- detachFloatingOnShutdown: this.globalConfig.license.detachFloatingOnShutdown,
- offlineMode,
- logger: this.logger,
- loadCertStr: async () => await this.loadCertStr(),
- saveCertStr,
- deviceFingerprint: () => this.instanceSettings.instanceId,
- collectUsageMetrics,
- collectPassthroughData,
- onFeatureChange,
- onLicenseRenewed,
- });
-
- await this.manager.initialize();
-
- this.logger.debug('License initialized');
- } catch (error: unknown) {
- if (error instanceof Error) {
- this.logger.error('Could not initialize license manager sdk', { error });
- }
- }
}
async loadCertStr(): Promise<TLicenseBlock> {
@@ -213,7 +185,9 @@ export class License implements LicenseProvider {
}
isLicensed(feature: BooleanLicenseFeature) {
- return this.manager?.hasFeatureEnabled(feature) ?? false;
+ if(feature == "feat:showNonProdBanner") { return false; }
+ if(feature == "feat:apiDisabled") { return false; }
+ return true;
}
/** @deprecated Use `LicenseState.isSharingLicensed` instead. */
@@ -341,7 +315,14 @@ export class License implements LicenseProvider {
}
getValue<T extends keyof FeatureReturnType>(feature: T): FeatureReturnType[T] {
- return this.manager?.getFeatureValue(feature) as FeatureReturnType[T];
+ if(feature == "planName") { return "PatchedLicenseCheck" as FeatureReturnType[T]; }
+ if(feature in LICENSE_FEATURES || feature.startsWith("feat:")) {
+ return this.isLicensed(feature as BooleanLicenseFeature) as FeatureReturnType[T];
+ }
+ if(feature in LICENSE_QUOTAS || feature.startsWith("quota:")) {
+ return UNLIMITED_LICENSE_QUOTA as FeatureReturnType[T];
+ }
+ return undefined;
}
getManagementJwt(): string {