Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic CSS support #4940

Merged
merged 4 commits into from
Nov 11, 2024
Merged

Add dynamic CSS support #4940

merged 4 commits into from
Nov 11, 2024

Commits on Nov 11, 2024

  1. Add dynamic CSS support

    Together with dani-garcia/bw_web_builds#180 this PR will add support for dynamic CSS changes.
    
    For example, we could hide the register link if signups are not allowed.
    In the future show or hide the SSO button depending on if it is enabled or not.
    
    There also is a special `user.vaultwarden.scss` file so that users can add custom CSS without the need to modify the default (static) changes.
    This will prevent future changes from not being applied and still have the custom user changes to be added.
    
    Also added a special redirect when someone goes directly to `/index.html` as that might cause issues with loading other scripts and files.
    
    Signed-off-by: BlackDex <black.dex@gmail.com>
    BlackDex committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    4ea04e4 View commit details
    Browse the repository at this point in the history
  2. Add versions and fallback to built-in

    - Add both Vaultwarden and web-vault versions to the css_options.
    - Fallback to the inner templates if rendering or compiling the scss fails.
      This ensures the basics are always working even if someone breaks the templates.
    
    Signed-off-by: BlackDex <black.dex@gmail.com>
    BlackDex committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    a1f5238 View commit details
    Browse the repository at this point in the history
  3. Fix fallback code to actually work

    The fallback now works by using an alternative `reg!` macro.
    This adds an extra template register which prefixes the template with `fallback_`.
    
    Signed-off-by: BlackDex <black.dex@gmail.com>
    BlackDex committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    698f0c7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0b91254 View commit details
    Browse the repository at this point in the history