mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 20:16:00 +00:00
license checker
This commit is contained in:
@@ -44,6 +44,7 @@ module.exports = {
|
|||||||
isDocker: platformInfo.isDocker,
|
isDocker: platformInfo.isDocker,
|
||||||
isElectron: platformInfo.isElectron,
|
isElectron: platformInfo.isElectron,
|
||||||
isLicenseValid: platformInfo.isLicenseValid,
|
isLicenseValid: platformInfo.isLicenseValid,
|
||||||
|
licenseError: platformInfo.licenseError,
|
||||||
permissions,
|
permissions,
|
||||||
login,
|
login,
|
||||||
...additionalConfigProps,
|
...additionalConfigProps,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
function checkLicense() {
|
function checkLicense() {
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
|||||||
const isDevMode = process.env.DEVMODE == '1';
|
const isDevMode = process.env.DEVMODE == '1';
|
||||||
const isNpmDist = !!global['IS_NPM_DIST'];
|
const isNpmDist = !!global['IS_NPM_DIST'];
|
||||||
const isForkedApi = processArgs.isForkedApi;
|
const isForkedApi = processArgs.isForkedApi;
|
||||||
const isLicenseValid = checkLicense();
|
const licenseError = checkLicense();
|
||||||
|
const isLicenseValid = licenseError == null;
|
||||||
|
|
||||||
// function moduleAvailable(name) {
|
// function moduleAvailable(name) {
|
||||||
// try {
|
// try {
|
||||||
@@ -33,6 +34,7 @@ const platformInfo = {
|
|||||||
isForkedApi,
|
isForkedApi,
|
||||||
isElectron: isElectron(),
|
isElectron: isElectron(),
|
||||||
isLicenseValid,
|
isLicenseValid,
|
||||||
|
licenseError,
|
||||||
isDevMode,
|
isDevMode,
|
||||||
isNpmDist,
|
isNpmDist,
|
||||||
isSnap: process.env.ELECTRON_SNAP == 'true',
|
isSnap: process.env.ELECTRON_SNAP == 'true',
|
||||||
|
|||||||
@@ -21,10 +21,12 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="heading">Configuration error</div>
|
<div class="heading">Configuration error</div>
|
||||||
{#if !$config?.isLicenseValid}
|
{#if !$config?.isLicenseValid}
|
||||||
<ErrorInfo message="Invalid license, please set DBGATE_LICENSE environment variable" />
|
<ErrorInfo message={`Invalid license. Please contact sales@dbgate.eu for more details. ${$config?.licenseError}`} />
|
||||||
{:else}
|
{:else}
|
||||||
<ErrorInfo message="No error found, try to open app again" />
|
<ErrorInfo message="No error found, try to open app again" />
|
||||||
<Link href="?">Back to app</Link>
|
<div class="m-2">
|
||||||
|
<Link href="?">Back to app</Link>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export function handleOauthCallback() {
|
|||||||
export async function handleAuthOnStartup(config, isAdminPage = false) {
|
export async function handleAuthOnStartup(config, isAdminPage = false) {
|
||||||
if (!config.isLicenseValid) {
|
if (!config.isLicenseValid) {
|
||||||
internalRedirectTo(`?page=error`);
|
internalRedirectTo(`?page=error`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.isAdminLoginForm && isAdminPage) {
|
if (config.isAdminLoginForm && isAdminPage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user