Custom Title, Description and Help Email (#54)

* Add configuration of Help email, Title, Description

* Format configuration changes

* Use fragments for help sections

* Revert cleanup in misc.ts
This commit is contained in:
Prefex
2025-03-20 16:18:09 +01:00
committed by GitHub
parent 9e05f591b8
commit 5467fb3533
5 changed files with 47 additions and 19 deletions

View File

@@ -20,3 +20,7 @@ CONFIG_ENABLE_EMAILS="false" # if true, email verification will be required for
CONFIG_ENABLE_FOREVER_SIGNUP="true" # if true, all signups become active for 100 years
# CONFIG_ALLOWED_COOKIE_DOMAINS="example.com,example.net" # can be set to allow more than the BASE_URL's domain for session cookies
# CONFIG_SKIP_COOKIE_DOMAIN_SECURITY="true" # if true, the cookie domain will not be strictly set and checked against. This skipping slightly reduces security, but is usually necessary for reverse proxies like Cloudflare Tunnel.
# CUSTOM_TITLE=""
# CUSTOM_DESCRIPTION=""
HELP_EMAIL="help@bewcloud.com" # if empty, "need help" sections will be disabled

View File

@@ -194,8 +194,13 @@ export default function Settings({ formData: formDataObject, error, notice, curr
<h2 class='text-2xl mb-4 text-left px-4 max-w-screen-md mx-auto lg:min-w-96'>Delete your account</h2>
<p class='text-left mt-2 mb-6 px-4 max-w-screen-md mx-auto lg:min-w-96'>
Deleting your account is instant and deletes all your data. If you need help, please{' '}
<a href={`mailto:${helpEmail}`}>reach out</a>.
Deleting your account is instant and deletes all your data. {helpEmail !== ''
? (
<>
If you need help, please <a href={`mailto:${helpEmail}`}>reach out</a>.
</>
)
: null}
</p>
<form method='POST' class='mb-12'>

View File

@@ -4,17 +4,24 @@ import { SupportedCurrencySymbol } from '/lib/types.ts';
let BASE_URL = typeof window !== 'undefined' && window.location
? `${window.location.protocol}//${window.location.host}`
: '';
let CUSTOM_TITLE = '';
let CUSTOM_DESCRIPTION = '';
let HELP_EMAIL = '';
if (typeof Deno !== 'undefined') {
await import('std/dotenv/load.ts');
BASE_URL = Deno.env.get('BASE_URL') || '';
CUSTOM_TITLE = Deno.env.get('CUSTOM_TITLE') || '';
CUSTOM_DESCRIPTION = Deno.env.get('CUSTOM_DESCRIPTION') || '';
HELP_EMAIL = Deno.env.get('HELP_EMAIL') || '';
}
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 files under your own control.`;
export const helpEmail = 'help@bewcloud.com';
export const defaultTitle = CUSTOM_TITLE || 'bewCloud is a modern and simpler alternative to Nextcloud and ownCloud';
export const defaultDescription = CUSTOM_DESCRIPTION || `Have your files under your own control.`;
export const helpEmail = HELP_EMAIL;
export function isRunningLocally(request: Request): boolean {
try {

View File

@@ -173,6 +173,9 @@ export default function Login({ data }: PageProps<Data, FreshContextState>) {
</strong>.
</p>
{helpEmail !== ''
? (
<>
<h2 class='text-2xl mb-4 text-center'>Need help?</h2>
<p class='text-center mt-2 mb-6'>
If you're having any issues or have any questions,{' '}
@@ -180,6 +183,9 @@ export default function Login({ data }: PageProps<Data, FreshContextState>) {
<a href={`mailto:${helpEmail}`}>please reach out</a>
</strong>.
</p>
</>
)
: null}
</section>
</main>
);

View File

@@ -144,6 +144,9 @@ export default function Signup({ data }: PageProps<Data, FreshContextState>) {
</strong>.
</p>
{helpEmail !== ''
? (
<>
<h2 class='text-2xl mb-4 text-center'>Need help?</h2>
<p class='text-center mt-2 mb-6'>
If you're having any issues or have any questions,{' '}
@@ -151,6 +154,9 @@ export default function Signup({ data }: PageProps<Data, FreshContextState>) {
<a href={`mailto:${helpEmail}`}>please reach out</a>
</strong>.
</p>
</>
)
: null}
</section>
</main>
);