2024-08-13 14:29:07 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
import { useConfig } from './utility/metadataLoaders';
|
|
|
|
import ErrorInfo from './elements/ErrorInfo.svelte';
|
|
|
|
import Link from './elements/Link.svelte';
|
|
|
|
import { internalRedirectTo } from './clientAuth';
|
|
|
|
import TextAreaField from './forms/TextAreaField.svelte';
|
|
|
|
import { writable } from 'svelte/store';
|
|
|
|
import FormProviderCore from './forms/FormProviderCore.svelte';
|
|
|
|
import FormTextAreaField from './forms/FormTextAreaField.svelte';
|
|
|
|
import FormSubmit from './forms/FormSubmit.svelte';
|
|
|
|
import { apiCall } from './utility/api';
|
2024-09-04 10:51:57 +00:00
|
|
|
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
2024-09-04 12:46:59 +00:00
|
|
|
import getElectron from './utility/getElectron';
|
2024-09-04 10:51:57 +00:00
|
|
|
|
2024-08-13 14:29:07 +00:00
|
|
|
const config = useConfig();
|
|
|
|
const values = writable({ amoid: null, databaseServer: null });
|
|
|
|
|
2024-09-04 10:51:57 +00:00
|
|
|
let errorMessage = '';
|
2024-08-13 14:29:07 +00:00
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
const removed = document.getElementById('starting_dbgate_zero');
|
|
|
|
if (removed) removed.remove();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<FormProviderCore {values}>
|
|
|
|
<div class="root theme-light theme-type-light">
|
|
|
|
<div class="text">DbGate</div>
|
|
|
|
<div class="wrap">
|
|
|
|
<div class="logo">
|
|
|
|
<img class="img" src="logo192.png" />
|
|
|
|
</div>
|
|
|
|
<div class="box">
|
|
|
|
<div class="heading">License</div>
|
2024-09-04 10:51:57 +00:00
|
|
|
<FormTextAreaField label="Enter your license key" name="licenseKey" rows={5} />
|
2024-08-13 14:29:07 +00:00
|
|
|
|
|
|
|
<div class="submit">
|
|
|
|
<FormSubmit
|
|
|
|
value="Save license"
|
|
|
|
on:click={async e => {
|
|
|
|
const { licenseKey } = e.detail;
|
2024-09-04 12:46:59 +00:00
|
|
|
const resp = await apiCall('config/save-license-key', { licenseKey });
|
|
|
|
if (resp?.status == 'ok') {
|
|
|
|
internalRedirectTo('/index.html');
|
|
|
|
} else {
|
|
|
|
errorMessage = resp?.errorMessage || 'Error saving license key';
|
|
|
|
}
|
2024-08-13 14:29:07 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-09-03 08:57:33 +00:00
|
|
|
|
2024-09-04 10:51:57 +00:00
|
|
|
<div class="submit">
|
|
|
|
<FormStyledButton
|
|
|
|
value="Start 30-day trial"
|
|
|
|
on:click={async e => {
|
|
|
|
errorMessage = '';
|
|
|
|
const license = await apiCall('config/start-trial');
|
2024-09-04 12:46:59 +00:00
|
|
|
if (license?.status == 'ok') {
|
2024-09-04 10:51:57 +00:00
|
|
|
internalRedirectTo('/index.html');
|
|
|
|
} else {
|
2024-09-04 12:46:59 +00:00
|
|
|
errorMessage = license?.errorMessage || 'Error starting trial';
|
2024-09-04 10:51:57 +00:00
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
2024-09-03 08:57:33 +00:00
|
|
|
</div>
|
|
|
|
|
2024-09-04 12:46:59 +00:00
|
|
|
{#if getElectron()}
|
|
|
|
<div class="submit">
|
|
|
|
<FormStyledButton
|
|
|
|
value="Exit"
|
|
|
|
on:click={e => {
|
|
|
|
getElectron().send('quit-app');
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
|
2024-09-04 10:51:57 +00:00
|
|
|
{#if errorMessage}
|
|
|
|
<div class="error">{errorMessage}</div>
|
|
|
|
{/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
|
|
|
|
>
|
|
|
|
</div>
|
2024-08-13 14:29:07 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</FormProviderCore>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.logo {
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
.img {
|
|
|
|
width: 80px;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
position: fixed;
|
|
|
|
top: 1rem;
|
|
|
|
left: 1rem;
|
|
|
|
font-size: 30pt;
|
|
|
|
font-family: monospace;
|
|
|
|
color: var(--theme-bg-2);
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
|
|
|
|
|
|
|
.root {
|
|
|
|
color: var(--theme-font-1);
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
background-color: var(--theme-bg-1);
|
|
|
|
align-items: baseline;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.box {
|
|
|
|
width: 600px;
|
|
|
|
max-width: 80vw;
|
|
|
|
/* max-width: 600px;
|
|
|
|
width: 40vw; */
|
|
|
|
border: 1px solid var(--theme-border);
|
|
|
|
border-radius: 4px;
|
|
|
|
background-color: var(--theme-bg-0);
|
|
|
|
}
|
|
|
|
|
|
|
|
.wrap {
|
|
|
|
margin-top: 20vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
.heading {
|
|
|
|
text-align: center;
|
|
|
|
margin: 1em;
|
|
|
|
font-size: xx-large;
|
|
|
|
}
|
|
|
|
|
|
|
|
.submit {
|
|
|
|
margin: var(--dim-large-form-margin);
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.submit :global(input) {
|
|
|
|
flex: 1;
|
|
|
|
font-size: larger;
|
|
|
|
}
|
2024-09-03 08:57:33 +00:00
|
|
|
|
2024-09-04 10:51:57 +00:00
|
|
|
.error {
|
|
|
|
margin: var(--dim-large-form-margin);
|
|
|
|
color: red;
|
|
|
|
}
|
|
|
|
|
|
|
|
.purchase-info {
|
2024-09-03 08:57:33 +00:00
|
|
|
margin: var(--dim-large-form-margin);
|
|
|
|
}
|
2024-08-13 14:29:07 +00:00
|
|
|
</style>
|