mirror of
https://github.com/suitenumerique/meet.git
synced 2026-11-16 21:03:10 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 043875e804 | |||
| b3e99a9f8b |
@@ -30,6 +30,7 @@ and this project adheres to
|
||||
- 🍱(frontend) add Portuguese glyphs to Marianne subsetted fonts
|
||||
- 🚸(frontend) bring new speakers to the top of the carousel
|
||||
- 🚸(frontend) bring raised hands into view in the carousel
|
||||
- ⚡️(frontend) serve illustrations as WebP with a PNG fallback
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
+24
@@ -16,6 +16,30 @@ the following command inside your docker container:
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Illustrations served as WebP with a PNG fallback
|
||||
|
||||
The illustrations in `assets/intro-slider/` are now served as WebP, the PNG files being kept as a fallback for browsers
|
||||
that do not support WebP.
|
||||
|
||||
> [!WARNING]
|
||||
> If you override these illustrations, as described in
|
||||
> [the theming guide](docs/self-hosting/configuration/theming.md), you should now provide a `.webp` file next to each
|
||||
> `.png` one. If you override only a `.png` file while the default `.webp` one remains, your users see the default
|
||||
> illustration instead of yours. If the `.webp` file is missing from your mount altogether, the frontend falls back to
|
||||
> your `.png` file, at the cost of a failed request and without the benefit of WebP.
|
||||
|
||||
Generate the WebP files from your PNG ones with [cwebp](https://developers.google.com/speed/webp/docs/cwebp), using the
|
||||
same settings as the default illustrations:
|
||||
|
||||
```bash
|
||||
for file in assets/intro-slider/*.png; do
|
||||
cwebp -q 90 -m 6 "$file" -o "${file%.png}.webp"
|
||||
done
|
||||
```
|
||||
|
||||
If you maintain your own nginx configuration, add `webp` to the extensions of the `location ~* ^/assets/` block, as in
|
||||
`src/frontend/default.conf`, so that the new files are served with the cache headers.
|
||||
|
||||
### Compose env files: `KEYCLOAK_HOST` renamed, internal hosts removed
|
||||
|
||||
`env.d/production.dist/hosts` and the OIDC endpoints of
|
||||
|
||||
@@ -33,7 +33,7 @@ server {
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|webp|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ server {
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|webp|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
@@ -54,7 +54,10 @@ fi
|
||||
|
||||
# The stack's .env holds MEET_HOST, which the realm and the webhook URL need.
|
||||
if [[ -f "${STACK_DIR}/.env" ]]; then
|
||||
set -a; . "${STACK_DIR}/.env"; set +a
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
. "${STACK_DIR}/.env"
|
||||
set +a
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ENV_DIR" ]]; then
|
||||
|
||||
+5
-2
@@ -84,8 +84,11 @@ export MEET_HOST IDP_HOST LIVEKIT_HOST LETSENCRYPT_EMAIL
|
||||
# ── Docker network ────────────────────────────────────────────────────────────
|
||||
|
||||
section "Docker network"
|
||||
docker network create proxy 2>/dev/null && success "Created 'proxy' network." \
|
||||
|| info "'proxy' network already exists."
|
||||
if docker network create proxy 2>/dev/null; then
|
||||
success "Created 'proxy' network."
|
||||
else
|
||||
info "'proxy' network already exists."
|
||||
fi
|
||||
|
||||
# ── Write shared hosts file ───────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -66,6 +66,22 @@ Set [`FRONTEND_CUSTOM_CSS_URL`](../../reference/env-variables.md#FRONTEND_CUSTOM
|
||||
|
||||
Mount your own file over a built-in one in the frontend container, under `/usr/share/nginx/html/assets`. The landing page carousel shows `1.png` to `3.png`; the recording and transcription panels show `3.png` and `4.png`, and the recording download page `4.png`, all four under `assets/intro-slider/`.
|
||||
|
||||
> [!WARNING]
|
||||
> Provide each illustration in **both formats** to benefit from WebP. Browsers supporting WebP load the `.webp` file
|
||||
> first, the `.png` one being the fallback.
|
||||
>
|
||||
> - If you override a `.png` while the default `.webp` remains, most of your users keep seeing the default
|
||||
> illustration instead of yours.
|
||||
> - If the `.webp` file is missing from your mount altogether, for instance when you mount a directory containing only
|
||||
> `.png` files, the frontend falls back to your `.png` file, at the cost of a failed request and without the benefit
|
||||
> of WebP.
|
||||
|
||||
You can generate the WebP version of an illustration with [cwebp](https://developers.google.com/speed/webp/docs/cwebp):
|
||||
|
||||
```bash
|
||||
cwebp -q 90 -m 6 1.png -o 1.webp
|
||||
```
|
||||
|
||||
The favicon is six files directly under `/usr/share/nginx/html`:
|
||||
|
||||
- `favicon.ico`
|
||||
|
||||
@@ -11,7 +11,7 @@ server {
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|webp|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
@@ -1,6 +1,6 @@
|
||||
import { styled } from '@/styled-system/jsx'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { Button } from '@/primitives'
|
||||
import { Button, Picture } from '@/primitives'
|
||||
import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -30,12 +30,10 @@ const Body = styled('p', {
|
||||
},
|
||||
})
|
||||
|
||||
const Image = styled('img', {
|
||||
base: {
|
||||
maxHeight: '362px',
|
||||
height: '100%',
|
||||
width: 'fit-content',
|
||||
},
|
||||
const image = css({
|
||||
maxHeight: '362px',
|
||||
height: '100%',
|
||||
width: 'fit-content',
|
||||
})
|
||||
|
||||
const Dot = styled('div', {
|
||||
@@ -165,7 +163,6 @@ const carouselNavButton = css({
|
||||
},
|
||||
})
|
||||
|
||||
// todo - optimize how images are imported
|
||||
const SLIDES: Slide[] = [
|
||||
{
|
||||
key: 'slide1',
|
||||
@@ -251,7 +248,13 @@ export const IntroSlider = () => {
|
||||
visible={index === slideIndex}
|
||||
key={index}
|
||||
>
|
||||
<Image src={slide.src} alt="" role="presentation" />
|
||||
<Picture
|
||||
src={slide.src}
|
||||
webp
|
||||
alt=""
|
||||
role="presentation"
|
||||
className={image}
|
||||
/>
|
||||
<TextAnimation visible={index == slideIndex}>
|
||||
<Heading>{t(`${slide.key}.title`)}</Heading>
|
||||
<Body>{t(`${slide.key}.body`)}</Body>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { A, Div, H, Text } from '@/primitives'
|
||||
import { A, Div, H, Picture, Text } from '@/primitives'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { LoginPrompt } from './LoginPrompt'
|
||||
@@ -45,8 +45,9 @@ export const NoAccessView = ({
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
>
|
||||
<img
|
||||
<Picture
|
||||
src={imagePath}
|
||||
webp
|
||||
alt=""
|
||||
className={css({
|
||||
minHeight: '250px',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Div, Text } from '@/primitives'
|
||||
import { Button, Div, Picture, Text } from '@/primitives'
|
||||
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useRoomId } from '@/features/rooms/livekit/hooks/useRoomId'
|
||||
@@ -169,8 +169,9 @@ export const ScreenRecordingSidePanel = () => {
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
>
|
||||
<img
|
||||
<Picture
|
||||
src="/assets/intro-slider/4.png"
|
||||
webp
|
||||
alt=""
|
||||
className={css({
|
||||
minHeight: '250px',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { A, Button, Div, Text } from '@/primitives'
|
||||
import { A, Button, Div, Picture, Text } from '@/primitives'
|
||||
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useRoomId } from '@/features/rooms/livekit/hooks/useRoomId'
|
||||
@@ -183,8 +183,9 @@ export const TranscriptSidePanel = () => {
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
>
|
||||
<img
|
||||
<Picture
|
||||
src="/assets/intro-slider/3.png"
|
||||
webp
|
||||
alt=""
|
||||
className={css({
|
||||
minHeight: '250px',
|
||||
|
||||
@@ -9,7 +9,7 @@ import { mediaUrl } from '@/api/mediaUrl'
|
||||
import { useUser } from '@/features/auth/api/useUser'
|
||||
import { UserAware } from '@/features/auth/components/UserAware'
|
||||
import { Screen } from '@/layout/Screen'
|
||||
import { H, LinkButton, Text } from '@/primitives'
|
||||
import { H, LinkButton, Picture, Text } from '@/primitives'
|
||||
import { formatDate } from '@/utils/formatDate'
|
||||
import { ErrorScreen } from '@/components/ErrorScreen'
|
||||
import { LoadingScreen } from '@/components/LoadingScreen'
|
||||
@@ -118,8 +118,9 @@ const RecordingDownload = () => {
|
||||
<Screen layout="centered" footer={false}>
|
||||
<Center>
|
||||
<VStack>
|
||||
<img
|
||||
<Picture
|
||||
src="/assets/intro-slider/4.png"
|
||||
webp
|
||||
alt={''}
|
||||
className={css({
|
||||
maxHeight: '309px',
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import {
|
||||
type ComponentPropsWithoutRef,
|
||||
type SyntheticEvent,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { css } from '@/styled-system/css'
|
||||
|
||||
const EXTENSION = /\.(png|jpe?g)$/i
|
||||
|
||||
export type PictureProps = Omit<ComponentPropsWithoutRef<'img'>, 'src'> & {
|
||||
src: string
|
||||
webp?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an image. With `webp`, browsers supporting WebP load the WebP
|
||||
* version of the image, `src` being the fallback for the others.
|
||||
*
|
||||
* A browser never falls back on its own when the WebP file fails to load, for
|
||||
* instance when a deployment overrides an illustration without providing its
|
||||
* WebP version. The WebP source is then dropped, so `src` gets loaded instead
|
||||
* of leaving a broken image.
|
||||
*
|
||||
* The `<picture>` wrapper uses `display: contents`, so the `<img>` is laid out
|
||||
* exactly as if it was rendered alone: style it through the usual props.
|
||||
*/
|
||||
export const Picture = ({
|
||||
src,
|
||||
webp = false,
|
||||
alt,
|
||||
onError,
|
||||
...props
|
||||
}: PictureProps) => {
|
||||
const [failedWebpSrc, setFailedWebpSrc] = useState<string>()
|
||||
const webpSrc =
|
||||
webp && EXTENSION.test(src) ? src.replace(EXTENSION, '.webp') : undefined
|
||||
const hasWebpSource = !!webpSrc && webpSrc !== failedWebpSrc
|
||||
|
||||
const handleError = (event: SyntheticEvent<HTMLImageElement, Event>) => {
|
||||
if (hasWebpSource) {
|
||||
setFailedWebpSrc(webpSrc)
|
||||
return
|
||||
}
|
||||
onError?.(event)
|
||||
}
|
||||
|
||||
return (
|
||||
<picture className={css({ display: 'contents' })}>
|
||||
{hasWebpSource && <source srcSet={webpSrc} type="image/webp" />}
|
||||
<img src={src} alt={alt} onError={handleError} {...props} />
|
||||
</picture>
|
||||
)
|
||||
}
|
||||
@@ -23,6 +23,7 @@ export { Link } from './Link'
|
||||
export { Menu } from './Menu'
|
||||
export { MenuList } from './MenuList'
|
||||
export { P } from './P'
|
||||
export { Picture } from './Picture'
|
||||
export { Popover } from './Popover'
|
||||
export { ScreenReaderAnnouncer } from './ScreenReaderAnnouncer'
|
||||
export { Text } from './Text'
|
||||
|
||||
@@ -80,7 +80,7 @@ data:
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|webp|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user