mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 23:26:00 +00:00
license checker
This commit is contained in:
@@ -44,6 +44,7 @@ module.exports = {
|
||||
isDocker: platformInfo.isDocker,
|
||||
isElectron: platformInfo.isElectron,
|
||||
isLicenseValid: platformInfo.isLicenseValid,
|
||||
licenseError: platformInfo.licenseError,
|
||||
permissions,
|
||||
login,
|
||||
...additionalConfigProps,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function checkLicense() {
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -13,7 +13,8 @@ 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();
|
||||
const licenseError = checkLicense();
|
||||
const isLicenseValid = licenseError == null;
|
||||
|
||||
// function moduleAvailable(name) {
|
||||
// try {
|
||||
@@ -33,6 +34,7 @@ const platformInfo = {
|
||||
isForkedApi,
|
||||
isElectron: isElectron(),
|
||||
isLicenseValid,
|
||||
licenseError,
|
||||
isDevMode,
|
||||
isNpmDist,
|
||||
isSnap: process.env.ELECTRON_SNAP == 'true',
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
<div class="box">
|
||||
<div class="heading">Configuration error</div>
|
||||
{#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}
|
||||
<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}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +43,7 @@ export function handleOauthCallback() {
|
||||
export async function handleAuthOnStartup(config, isAdminPage = false) {
|
||||
if (!config.isLicenseValid) {
|
||||
internalRedirectTo(`?page=error`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.isAdminLoginForm && isAdminPage) {
|
||||
|
||||
Reference in New Issue
Block a user