Skip to content

Fix inconsistency: Use themed manifest for PWA installations to avoid breaking user theming - #58557

Open
crowetic wants to merge 2 commits into
nextcloud:masterfrom
crowetic:pwa-theming-fix
Open

Fix inconsistency: Use themed manifest for PWA installations to avoid breaking user theming#58557
crowetic wants to merge 2 commits into
nextcloud:masterfrom
crowetic:pwa-theming-fix

Conversation

@crowetic

@crowetic crowetic commented Feb 24, 2026

Copy link
Copy Markdown

…ll follow theme.

Resolves - #56135

Summary - Fix inconsistency: core/settings ship static manifests, which breaks instance branding in PWA installs. Force them to use the theming manifest so instance branding is consistent.

This PR also makes it possible to install an 'overall PWA' that stays with the instance branding applied in theme. (NOTE - the icon may still have an icon from the path if the path supplies a specific app icon, a plugin to setup an 'overall PWA' like those that were possible in older versions of NC will be made available in the near future. But this PR still fixes the naming issue being defaulted to Nextcloud and default icon.)

(Tested on NC33 installed server running installation from nextcloud/vm and updated to 33 via updater in the vm scripts. However, in theory any installation should work just fine. )

…ll follow theme.

Signed-off-by: crowetic <jason@crowetic.com>
@crowetic
crowetic requested a review from a team as a code owner February 24, 2026 22:59
@crowetic
crowetic requested review from Altahrim, artonge, nfebe and sorbaugh and removed request for a team February 24, 2026 22:59
Comment thread apps/theming/lib/ThemingDefaults.php Outdated
$route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]);
}
if ($image === 'manifest.json') {
// Force instance branding for the installable shell manifest.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is shell manifest?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry for the ambiguous comment, by 'shell manifest' I meant the Web App Manifest used when the browser installs Nextcloud as a PWA.

This ensures manifest.json is served through the theming route so the installed PWA reflects the instance’s configured branding (icons, name, colors).

I can update the comment to avoid the ambiguous wording if needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please do :)

Comment thread apps/theming/lib/ThemingDefaults.php Outdated
Comment on lines +395 to +397
if ($route !== false) {
return $route . '?v=' . $this->util->getCacheBuster();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In which case would $route be false?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Here... $route can remain false when no themed route is resolved and the logic falls back to the original asset path.

The guard keeps the behavior consistent with the surrounding logic so the cache-buster is only appended when a themed route is actually returned.

$route is initialized to false and stays false whenever no theming route applies. For manifest.json, we also explicitly return false when the app ships a static img/manifest.json (meaning 'don’t replace'). So the guard is consistent with the existing function semantics.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Right, I inverted my question. From what I understand, it can only be not false if the line above returns something else than false. Shouldn't we move that block in the previous if statement?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, you're right. In this block $route is only used for the manifest route, and linkToRoute() should always return a string here. The extra guard doesn't add value.

I will inline the return (with cache buster) directly in manifest.json branch after the static manifest check, and drop the redundant contition.

Sound okay?

@artonge artonge added enhancement feature: theming php Pull requests that update Php code 2. developing Work in progress labels Mar 4, 2026
@crowetic

crowetic commented Mar 4, 2026

Copy link
Copy Markdown
Author

This PR, however, only handles the manifest issue for the 'overall PWA' functionality I'm attempting to bring back for NC33. In previous versions you could accomplish the 'overall PWA' by installing in a pre-login state (before authenticating). You would then end up with a PWA for the entire cloud instance, that wouldn't show the annoying path bar when accessing various apps inside nextcloud.

However, given NC33's shift toward a per-app PWA installation (whichever app you happen to be accessing when you install the PWA) - the 'overall PWA' functionality is broken. (I opened an issue for this and a few others replied saying they prefer the overall PWA setup as well. When the issue wasn't fixed, I decided to fix it myself.)

This PR takes care of the manifest side, so the PWA installation has the correct naming, however, I didn't want to mess with the icon side directly in the core nextcloud code.

This PR wording can be modified to - 'Fix inconsistency: core/settings ship static manifests, which breaks instance branding in PWA installs. Force them to use the theming manifest so instance branding is consistent.'

So it is still a fix overall, and it will be a requirement for those that would like to have a PWA installed that doesn't install explicitly to an app inside the cloud instance. I am also working on a very simple plugin that will expose a page to install the 'overall PWA' with the branded cloud icon and branding naming, but this PR/fix is required as well.

Hopefully this makes sense. Let me know if I can help with anything.

@crowetic crowetic changed the title added patch for resolving 'overall PWA' installations so that they wi… Fix inconsistency: Use themed manifest for PWA installations to avoid breaking user theming on PWA installations Mar 4, 2026
@crowetic crowetic changed the title Fix inconsistency: Use themed manifest for PWA installations to avoid breaking user theming on PWA installations Fix inconsistency: Use themed manifest for PWA installations to avoid breaking user theming Mar 4, 2026
@artonge artonge added bug and removed enhancement labels Mar 4, 2026
@artonge
artonge requested a review from susnux March 5, 2026 15:08
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@artonge
artonge requested a review from skjnldsv March 18, 2026 10:43
@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 9, 2026
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress bug community pull requests from community feature: theming feedback-requested php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants