Skip to content

admin/files: add centralized theme variable support for file URLs#19657

Merged
dominic-r merged 17 commits intomainfrom
sdko/theme-s3-fix
Jan 27, 2026
Merged

admin/files: add centralized theme variable support for file URLs#19657
dominic-r merged 17 commits intomainfrom
sdko/theme-s3-fix

Conversation

@dominic-r
Copy link
Member

Overview:

Adds support for %(theme)s placeholder in file paths, which allows theme-specific assets (like logos, backgrounds, icons) to be served based on the user's current theme (light/dark).

This replaces the previous implementation (reverted in this PR) which only handled theme substitution in the Go file backend and instead uses the new approach which centralizes theme logic and works across both backends.

Testing:

Try out the following for the file and s3 backend:

  • Ensure themed images load
  • Ensure non-themed images load

Motivation:

Internal

@dominic-r dominic-r added this to the Release 2025.12.2 milestone Jan 22, 2026
@dominic-r dominic-r self-assigned this Jan 22, 2026
@dominic-r dominic-r requested review from a team as code owners January 22, 2026 03:46
@dominic-r dominic-r added area:frontend Features or issues related to the browser, TypeScript, Node.js, etc area:backend backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12 labels Jan 22, 2026
@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit e1bc878
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6976502860b1a80008ad350d
😎 Deploy Preview https://deploy-preview-19657--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit d2c4e51
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6972baa621ddc0000886823b
😎 Deploy Preview https://deploy-preview-19657--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 98.52217% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.26%. Comparing base (5a771fc) to head (e1bc878).
⚠️ Report is 34 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/core/models.py 80.00% 2 Missing ⚠️
authentik/admin/files/manager.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19657      +/-   ##
==========================================
+ Coverage   93.22%   93.26%   +0.04%     
==========================================
  Files         954      954              
  Lines       52401    52577     +176     
==========================================
+ Hits        48849    49038     +189     
+ Misses       3552     3539      -13     
Flag Coverage Δ
conformance 38.19% <24.63%> (-0.06%) ⬇️
e2e 44.00% <25.61%> (-0.08%) ⬇️
integration 23.11% <12.80%> (-0.04%) ⬇️
unit 91.52% <98.52%> (+0.04%) ⬆️
unit-migrate 91.55% <98.52%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in authentik Core Jan 22, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-e1bc878ea2c2ee04ad9a941f680a907a754b56ab
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-e1bc878ea2c2ee04ad9a941f680a907a754b56ab

Afterwards, run the upgrade commands from the latest release notes.

Overview:

Adds support for `%(theme)s` placeholder in file paths, which allows theme-specific assets (like logos, backgrounds, icons) to be served based on the user's current theme (light/dark).

This replaces the previous implementation (reverted in this PR) which only handled theme substitution in the Go file backend and instead uses the new approach which centralizes theme logic and works across both backends.

Testing:

Try out the following for the file and s3 backend:

* Ensure themed images load
* Ensure non-themed images load

Motivation:

Internal
.xyz is a known MIME type for chemical/molecular structure files
Copy link
Contributor

@kensternberg-authentik kensternberg-authentik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything radically broken on the front-end. I just wonder if we have documentation that describes all of these ways that logos and such get into the product.

}

public get brandingLogoThemedUrls(): ThemedUrls | null | undefined {
return this.brand.brandingLogoThemedUrls;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null | undefined is a bit of a code smell. Can you pick one or the other, and prefer null?

@rissson rissson requested a review from BeryJu January 27, 2026 12:44
@dominic-r dominic-r merged commit 33594c9 into main Jan 27, 2026
101 checks passed
@dominic-r dominic-r deleted the sdko/theme-s3-fix branch January 27, 2026 13:09
@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Jan 27, 2026
authentik-automation bot pushed a commit that referenced this pull request Jan 27, 2026
This cherry-pick has conflicts that need manual resolution.

Original PR: #19657
Original commit: 33594c9
@authentik-automation
Copy link
Contributor

⚠️ Cherry-pick to version-2025.12 has conflicts: #19793

dominic-r added a commit that referenced this pull request Jan 29, 2026
This cherry-pick has conflicts that need manual resolution.

Original PR: #19657
Original commit: 33594c9
dominic-r added a commit that referenced this pull request Jan 30, 2026
This cherry-pick has conflicts that need manual resolution.

Original PR: #19657
Original commit: 33594c9
dominic-r added a commit that referenced this pull request Jan 30, 2026
…erry-pick #19657 to version-2025.12) (#19793)

* Cherry-pick #19657 to version-2025.12 (with conflicts)

This cherry-pick has conflicts that need manual resolution.

Original PR: #19657
Original commit: 33594c9

* fix conflict

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Dominic R <dominic@sdko.org>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
kensternberg-authentik added a commit that referenced this pull request Jan 31, 2026
* main: (45 commits)
  sources/saml: Add testcases for PR #19593 (#19647)
  revert: website/integrations: wazuh: Change exchange key generation to 64 bytes (#19759)
  web: bump API Client version (#19760)
  core: bump djangoql from 0.18.2 to 0.19.1 (#19780)
  web: Vendor SFE Bootstrap (#19766)
  core, web: update translations (#19717)
  web: bump the eslint group across 1 directory with 3 updates (#19782)
  web: bump the react group across 1 directory with 2 updates (#19784)
  web: bump country-flag-icons from 1.6.8 to 1.6.9 in /web (#19785)
  providers/oauth2: Support login_hint (#19498)
  admin/files: add centralized theme variable support for file URLs (#19657)
  core: bump github.com/pires/go-proxyproto from 0.9.1 to 0.9.2 (#19778)
  core: bump openapitools/openapi-diff from 2.1.6 to 2.1.7 in /scripts/api (#19779)
  core: bump gssapi from 1.10.1 to 1.11.1 (#19781)
  ci: bump actions/attest-build-provenance from 3.1.0 to 3.2.0 (#19783)
  website/docs: endpoint devices: fix local device login (#19698)
  web: Enforce `challenge` nullish types. (#19768)
  web/elements: stabilize dual-select status height (#19734)
  web/a11y: CAPTCHA Stage Form (#19670)
  web/table: align row action icons and tooltip color (#19736)
  ...
tacerus added a commit to tacerus/authentik that referenced this pull request Feb 11, 2026
In
15c4de7 ("admin/files: add centralized theme variable support for file URLs (cherry-pick goauthentik#19657 to version-2025.12) (goauthentik#19793)")
the frontend side replacement was removed in favor of handling the
replacement in the media backend. Unfortunately, this does not seem to
work in our setup, as the logo URL containing "%(theme)s" started to
be served without any replacement after the update. This might be a bug,
but needs more investigation and, if needed, an upstream report. Until
then, as a temporary hotfix, restore the frontend/JS based replacement.

Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend area:frontend Features or issues related to the browser, TypeScript, Node.js, etc backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants