Skip to content

Commit 19130dc

Browse files
authored
Merge pull request element-hq#13235 from TheStranjer/allow-random-welcome-bgs
Allow Riot Web to randomly pick welcome backgrounds
2 parents 8122c62 + b3f3126 commit 19130dc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For a good example, see https://riot.im/develop/config.json.
3232
homeserver know what email template to use when talking to you.
3333
1. `branding`: Configures various branding and logo details, such as:
3434
1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app
35-
during authentication flows
35+
during authentication flows. If an array is passed, an image is chosen randomly for each visit.
3636
1. `authHeaderLogoUrl`: An logo image that is shown in the header during
3737
authentication flows
3838
1. `authFooterLinks`: a list of links to show in the authentication page footer:

src/components/views/auth/VectorAuthPage.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export default class VectorAuthPage extends React.PureComponent {
2929
const brandingConfig = SdkConfig.get().branding;
3030
let backgroundUrl = "themes/riot/img/backgrounds/valley.jpg";
3131
if (brandingConfig && brandingConfig.welcomeBackgroundUrl) {
32-
backgroundUrl = brandingConfig.welcomeBackgroundUrl;
32+
if (Array.isArray(brandingConfig.welcomeBackgroundUrl)) {
33+
backgroundUrl = brandingConfig.welcomeBackgroundUrl[Math.floor(Math.random() * brandingConfig.welcomeBackgroundUrl.length)];
34+
} else {
35+
backgroundUrl = brandingConfig.welcomeBackgroundUrl;
36+
}
3337
}
3438

3539
const pageStyle = {

0 commit comments

Comments
 (0)