license checking

This commit is contained in:
Jan Prochazka
2024-07-31 15:36:55 +02:00
parent 07cb4defe6
commit 2e847eee9b
6 changed files with 108 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ module.exports = {
allowShellScripting: platformInfo.allowShellScripting,
isDocker: platformInfo.isDocker,
isElectron: platformInfo.isElectron,
isLicenseValid: platformInfo.isLicenseValid,
permissions,
login,
...additionalConfigProps,

View File

@@ -0,0 +1,7 @@
function checkLicense() {
return true;
}
module.exports = {
checkLicense,
};

View File

@@ -3,6 +3,7 @@ const os = require('os');
const path = require('path');
const processArgs = require('./processArgs');
const isElectron = require('is-electron');
const { checkLicense } = require('./checkLicense');
const platform = process.env.OS_OVERRIDE ? process.env.OS_OVERRIDE : process.platform;
const isWindows = platform === 'win32';
@@ -12,6 +13,7 @@ const isDocker = fs.existsSync('/home/dbgate-docker/public');
const isDevMode = process.env.DEVMODE == '1';
const isNpmDist = !!global['IS_NPM_DIST'];
const isForkedApi = processArgs.isForkedApi;
const isLicenseValid = checkLicense();
// function moduleAvailable(name) {
// try {
@@ -30,6 +32,7 @@ const platformInfo = {
isElectronBundle: isElectron() && !isDevMode,
isForkedApi,
isElectron: isElectron(),
isLicenseValid,
isDevMode,
isNpmDist,
isSnap: process.env.ELECTRON_SNAP == 'true',