From 2d70a3817de1fd6108f625cb2b41398e77cd9813 Mon Sep 17 00:00:00 2001 From: Bruno Bernardino Date: Sun, 17 Mar 2024 08:10:36 +0000 Subject: [PATCH] Make baseUrl dynamic and tweak invalid input style's contrast --- .env.sample | 1 + deno.json | 2 +- lib/utils.ts | 12 +++++++++++- static/styles.css | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.env.sample b/.env.sample index 31e48f8..c0db539 100644 --- a/.env.sample +++ b/.env.sample @@ -1,4 +1,5 @@ PORT=8000 +BASE_URL="http://localhost:8000" POSTGRESQL_HOST="localhost" POSTGRESQL_USER="postgres" diff --git a/deno.json b/deno.json index a03b525..ef3ce61 100644 --- a/deno.json +++ b/deno.json @@ -23,7 +23,7 @@ "fresh", "recommended" ], - "exclude": ["no-explicit-any", "no-empty-interface", "ban-types"] + "exclude": ["no-explicit-any", "no-empty-interface", "ban-types", "no-window"] } }, "exclude": [ diff --git a/lib/utils.ts b/lib/utils.ts index 3464f85..3d5069c 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,6 +1,16 @@ import { Contact, ContactAddress, ContactField } from './types.ts'; -export const baseUrl = 'https://app.bewcloud.com'; +let BASE_URL = typeof window !== 'undefined' && window.location + ? `${window.location.protocol}//${window.location.host}` + : ''; + +if (typeof Deno !== 'undefined') { + await import('std/dotenv/load.ts'); + + BASE_URL = Deno.env.get('BASE_URL') || ''; +} + +export const baseUrl = BASE_URL || 'http://localhost:8000'; export const defaultTitle = 'bewCloud is a modern and simpler alternative to Nextcloud and ownCloud'; export const defaultDescription = `Have your calendar, contacts, tasks, and files under your own control.`; export const helpEmail = 'help@bewcloud.com'; diff --git a/static/styles.css b/static/styles.css index 1b08992..ec86fac 100644 --- a/static/styles.css +++ b/static/styles.css @@ -39,7 +39,7 @@ form { } .input-field:required:invalid:not(:placeholder-shown) { - @apply bg-red-100 !important; + @apply bg-red-400 !important; } .notification-error {