mirror of
https://github.com/docmost/docmost.git
synced 2026-05-17 06:44:05 +08:00
1ad53c2581
* feat(ee): public sharing controls * lint
29 lines
799 B
TypeScript
29 lines
799 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { ModuleRef } from '@nestjs/core';
|
|
import { EnvironmentService } from './environment.service';
|
|
|
|
@Injectable()
|
|
export class LicenseCheckService {
|
|
constructor(
|
|
private moduleRef: ModuleRef,
|
|
private environmentService: EnvironmentService,
|
|
) {}
|
|
|
|
isValidEELicense(licenseKey: string): boolean {
|
|
if (this.environmentService.isCloud()) {
|
|
return true;
|
|
}
|
|
|
|
try {
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
const LicenseModule = require('../../ee/licence/license.service');
|
|
const licenseService = this.moduleRef.get(LicenseModule.LicenseService, {
|
|
strict: false,
|
|
});
|
|
return licenseService.isValidEELicense(licenseKey);
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
}
|