mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 15:15:59 +00:00
handle expired license
This commit is contained in:
@@ -12,11 +12,20 @@
|
||||
import { apiCall } from './utility/api';
|
||||
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
||||
import getElectron from './utility/getElectron';
|
||||
import { openWebLink } from './utility/exportFileTools';
|
||||
|
||||
const config = useConfig();
|
||||
const values = writable({ amoid: null, databaseServer: null });
|
||||
|
||||
$: isExpired = $config?.isLicenseExpired;
|
||||
|
||||
let errorMessage = '';
|
||||
let expiredMessageSet = false;
|
||||
|
||||
$: if (isExpired && !expiredMessageSet) {
|
||||
errorMessage = 'Your license is expired';
|
||||
expiredMessageSet = true;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const removed = document.getElementById('starting_dbgate_zero');
|
||||
@@ -50,17 +59,28 @@
|
||||
/>
|
||||
</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">
|
||||
<FormStyledButton
|
||||
value="Start 30-day trial"
|
||||
value="Purchase DbGate Premium"
|
||||
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';
|
||||
}
|
||||
openWebLink('https://auth.dbgate.eu/create-checkout-session-simple');
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -81,9 +101,8 @@
|
||||
{/if}
|
||||
|
||||
<div class="purchase-info">
|
||||
If you want to purchase Premium license, please contact us at <Link href="mailto:sales@dbgate.eu"
|
||||
>sales@dbgate.eu</Link
|
||||
>
|
||||
For more info about DbGate licensing, you could visit <Link href="https://dbgate.eu/">dbgate.eu</Link> web or contact
|
||||
us at <Link href="mailto:sales@dbgate.eu">sales@dbgate.eu</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
import { apiCall } from '../utility/api';
|
||||
import { useSettings } from '../utility/metadataLoaders';
|
||||
import { derived } from 'svelte/store';
|
||||
import { safeFormatDate } from 'dbgate-tools';
|
||||
|
||||
const electron = getElectron();
|
||||
let restartWarning = false;
|
||||
@@ -372,10 +373,14 @@ ORDER BY
|
||||
<div>
|
||||
<FontIcon icon="img ok" /> License key is valid
|
||||
</div>
|
||||
<div>
|
||||
License valid to: {licenseKeyCheckResult.validTo}
|
||||
</div>
|
||||
<div>License key expiration: {licenseKeyCheckResult.expiration}</div>
|
||||
{#if licenseKeyCheckResult.validTo}
|
||||
<div>
|
||||
License valid to: {licenseKeyCheckResult.validTo}
|
||||
</div>
|
||||
{/if}
|
||||
{#if licenseKeyCheckResult.expiration}
|
||||
<div>License key expiration: <b>{safeFormatDate(licenseKeyCheckResult.expiration)}</b></div>
|
||||
{/if}
|
||||
{:else if licenseKeyCheckResult.status == 'error'}
|
||||
<FontIcon icon="img error" /> License key is invalid
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user