Added advanced branding

pull/1621/head
Sebastian Weise 2022-10-31 11:55:53 +01:00
parent 29fa4fe3bd
commit 7bf83d65b9
8 changed files with 50 additions and 12 deletions

View File

@ -7,7 +7,11 @@ import styles from './EmptyPlaceholder.module.css';
function EmptyPlaceholder({ msg, children }) {
return (
<div className={styles.placeholder}>
<Icon className={styles.icon} icon={<Logo />} size="xlarge" />
<Icon
icon={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || <Logo />}
size="xlarge"
className={styles.icon}
/>
<h2 className={styles.msg}>{msg}</h2>
{children}
</div>

View File

@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Image from 'next/image';
import styles from './Icon.module.css';
function Icon({ icon, className, size = 'medium', ...props }) {
@ -15,7 +16,7 @@ function Icon({ icon, className, size = 'medium', ...props }) {
})}
{...props}
>
{icon}
{typeof icon === 'string' ? <Image src={icon} width={20} height={20} /> : icon}
</div>
);
}

View File

@ -76,7 +76,11 @@ export default function LoginForm() {
{() => (
<Form>
<div className={styles.header}>
<Icon icon={<Logo />} size="xlarge" className={styles.icon} />
<Icon
icon={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || <Logo />}
size="xlarge"
className={styles.icon}
/>
<h1 className="center">{process.env.NEXT_PUBLIC_CUSTOM_TITLE || 'umami'}</h1>
</div>
<FormRow>

View File

@ -26,7 +26,11 @@ export default function Header() {
{allowUpdate && <UpdateNotice />}
<header className={classNames(styles.header, 'row')}>
<div className={styles.title}>
<Icon icon={<Logo />} size="large" className={styles.logo} />
<Icon
icon={process.env.NEXT_PUBLIC_CUSTOM_FAVICON_URL || <Logo />}
size="large"
className={styles.logo}
/>
<Link
href={isSharePage ? process.env.NEXT_PUBLIC_CUSTOM_HOMEPAGE_URL || HOMEPAGE_URL : '/'}
>

View File

@ -79,7 +79,7 @@
"message.no-data-available": "Keine Daten vorhanden.",
"message.no-websites-configured": "Es ist keine Webseite vorhanden.",
"message.page-not-found": "Seite nicht gefunden.",
"message.powered-by": "Betrieben durch {name}",
"message.powered-by": "Powered by {name}",
"message.reset-warning": "Alle Daten für diese Webseite werden gelöscht, jedoch bleibt der Tracking Code bestehen.",
"message.save-success": "Erfolgreich gespeichert.",
"message.share-url": "Dies ist die öffentliche URL zum Teilen für {target}.",

View File

@ -3,7 +3,7 @@ const pkg = require('./package.json');
const contentSecurityPolicy = `
default-src 'self';
img-src *;
img-src * 'self' data:;
script-src 'self' 'unsafe-eval';
style-src 'self' 'unsafe-inline';
connect-src 'self' api.umami.is;
@ -52,6 +52,10 @@ module.exports = {
return config;
},
images: {
dangerouslyAllowSVG: true,
domains: [new URL(process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL).hostname],
},
async headers() {
return [
{

View File

@ -27,12 +27,33 @@ export default function App({ Component, pageProps }) {
return (
<Intl>
<Head>
<link rel="icon" href={`${basePath}/favicon.ico`} />
<link rel="apple-touch-icon" sizes="180x180" href={`${basePath}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
<link
rel="icon"
href={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || `${basePath}/favicon.ico`}
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || `${basePath}/apple-touch-icon.png`}
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || `${basePath}/favicon-32x32.png`}
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || `${basePath}/favicon-16x16.png`}
/>
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
<link
rel="mask-icon"
href={process.env.NEXT_PUBLIC_CUSTOM_LOGO_URL || `${basePath}/safari-pinned-tab.svg`}
color="#5bbad5"
/>
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />

View File

@ -582,7 +582,7 @@
"message.powered-by": [
{
"type": 0,
"value": "Betrieben durch "
"value": "Powered by "
},
{
"type": 1,