feat: Random subdomain for demo

This commit is contained in:
Andras Bacsai 2022-02-23 13:20:17 +01:00
parent 6e32421172
commit bb32d0f7d1

View File

@ -45,6 +45,8 @@
import { notNodeDeployments, staticDeployments } from '$lib/components/common';
import { toast } from '@zerodevx/svelte-toast';
import { post } from '$lib/api';
import cuid from 'cuid';
import { browser } from '$app/env';
const { id } = $page.params;
let domainEl: HTMLInputElement;
@ -55,6 +57,10 @@
let previews = application.settings.previews;
let dualCerts = application.settings.dualCerts;
if (browser && window.location.hostname === 'demo.coolify.io') {
application.fqdn = `${cuid()}.demo.coolify.io`;
}
onMount(() => {
domainEl.focus();
});
@ -255,6 +261,11 @@
<div class="grid grid-cols-2">
<div class="flex-col">
<label for="fqdn" class="pt-2 text-base font-bold text-stone-100">Domain (FQDN)</label>
{#if browser && window.location.hostname === 'demo.coolify.io'}
<Explainer
text="<span class='text-white font-bold'>You can use the predefined random domain name or enter your own domain name.</span>"
/>
{/if}
<Explainer
text="If you specify <span class='text-green-500 font-bold'>https</span>, the application will be accessible only over https. SSL certificate will be generated for you.<br>If you specify <span class='text-green-500 font-bold'>www</span>, the application will be redirected (302) from non-www and vice versa.<br><br>To modify the domain, you must first stop the application.<br><br><span class='text-white font-bold'>You must set your DNS to point to the server IP in advance.</span>"
/>