mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 18:34:01 +00:00
handle expired license
This commit is contained in:
@@ -64,6 +64,7 @@ module.exports = {
|
|||||||
isDocker: platformInfo.isDocker,
|
isDocker: platformInfo.isDocker,
|
||||||
isElectron: platformInfo.isElectron,
|
isElectron: platformInfo.isElectron,
|
||||||
isLicenseValid,
|
isLicenseValid,
|
||||||
|
isLicenseExpired: checkedLicense?.isExpired,
|
||||||
checkedLicense,
|
checkedLicense,
|
||||||
configurationError,
|
configurationError,
|
||||||
logoutUrl: await authProvider.getLogoutUrl(),
|
logoutUrl: await authProvider.getLogoutUrl(),
|
||||||
|
|||||||
@@ -500,3 +500,12 @@ export function extractErrorLogData(err, additionalFields = {}) {
|
|||||||
...additionalFields,
|
...additionalFields,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function safeFormatDate(date) {
|
||||||
|
try {
|
||||||
|
const v = new Date(date);
|
||||||
|
return v.toISOString().substring(0, 10);
|
||||||
|
} catch (e) {
|
||||||
|
return date?.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,11 +12,20 @@
|
|||||||
import { apiCall } from './utility/api';
|
import { apiCall } from './utility/api';
|
||||||
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
||||||
import getElectron from './utility/getElectron';
|
import getElectron from './utility/getElectron';
|
||||||
|
import { openWebLink } from './utility/exportFileTools';
|
||||||
|
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
const values = writable({ amoid: null, databaseServer: null });
|
const values = writable({ amoid: null, databaseServer: null });
|
||||||
|
|
||||||
|
$: isExpired = $config?.isLicenseExpired;
|
||||||
|
|
||||||
let errorMessage = '';
|
let errorMessage = '';
|
||||||
|
let expiredMessageSet = false;
|
||||||
|
|
||||||
|
$: if (isExpired && !expiredMessageSet) {
|
||||||
|
errorMessage = 'Your license is expired';
|
||||||
|
expiredMessageSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const removed = document.getElementById('starting_dbgate_zero');
|
const removed = document.getElementById('starting_dbgate_zero');
|
||||||
@@ -50,17 +59,28 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if !isExpired}
|
||||||
|
<div class="submit">
|
||||||
|
<FormStyledButton
|
||||||
|
value="Start 30-day trial"
|
||||||
|
on:click={async e => {
|
||||||
|
errorMessage = '';
|
||||||
|
const license = await apiCall('config/start-trial');
|
||||||
|
if (license?.status == 'ok') {
|
||||||
|
internalRedirectTo('/index.html');
|
||||||
|
} else {
|
||||||
|
errorMessage = license?.errorMessage || 'Error starting trial';
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="submit">
|
<div class="submit">
|
||||||
<FormStyledButton
|
<FormStyledButton
|
||||||
value="Start 30-day trial"
|
value="Purchase DbGate Premium"
|
||||||
on:click={async e => {
|
on:click={async e => {
|
||||||
errorMessage = '';
|
openWebLink('https://auth.dbgate.eu/create-checkout-session-simple');
|
||||||
const license = await apiCall('config/start-trial');
|
|
||||||
if (license?.status == 'ok') {
|
|
||||||
internalRedirectTo('/index.html');
|
|
||||||
} else {
|
|
||||||
errorMessage = license?.errorMessage || 'Error starting trial';
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,9 +101,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="purchase-info">
|
<div class="purchase-info">
|
||||||
If you want to purchase Premium license, please contact us at <Link href="mailto:sales@dbgate.eu"
|
For more info about DbGate licensing, you could visit <Link href="https://dbgate.eu/">dbgate.eu</Link> web or contact
|
||||||
>sales@dbgate.eu</Link
|
us at <Link href="mailto:sales@dbgate.eu">sales@dbgate.eu</Link>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { useSettings } from '../utility/metadataLoaders';
|
import { useSettings } from '../utility/metadataLoaders';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
|
import { safeFormatDate } from 'dbgate-tools';
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
let restartWarning = false;
|
let restartWarning = false;
|
||||||
@@ -372,10 +373,14 @@ ORDER BY
|
|||||||
<div>
|
<div>
|
||||||
<FontIcon icon="img ok" /> License key is valid
|
<FontIcon icon="img ok" /> License key is valid
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{#if licenseKeyCheckResult.validTo}
|
||||||
License valid to: {licenseKeyCheckResult.validTo}
|
<div>
|
||||||
</div>
|
License valid to: {licenseKeyCheckResult.validTo}
|
||||||
<div>License key expiration: {licenseKeyCheckResult.expiration}</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if licenseKeyCheckResult.expiration}
|
||||||
|
<div>License key expiration: <b>{safeFormatDate(licenseKeyCheckResult.expiration)}</b></div>
|
||||||
|
{/if}
|
||||||
{:else if licenseKeyCheckResult.status == 'error'}
|
{:else if licenseKeyCheckResult.status == 'error'}
|
||||||
<FontIcon icon="img error" /> License key is invalid
|
<FontIcon icon="img error" /> License key is invalid
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user