BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Allow override or customization of PWA/manifest generation

Open matt-beamish opened this issue 1 year ago • 1 comments

Describe the feature you'd like

Ideally, for Bookstack to have a native ability to to customise the various features of the web manifest file generated by Bookstack. However, an alternative may be the ability to override the built-in manifest output in some fashion, for example:

  1. Having a field in the configuration that allows the entry of a valid manifest JSON file as text/file upload which would replace the generated output;
  2. If a file called "manifest.json" (or some other known/reserved name) is found in the /public root, use this to populate the manifest tag instead of linking to the generated file; or
  3. If an existing tag is found in the Custom Head Content, Bookstack does not add a further manifest file.

Describe the benefits this would bring to existing BookStack users

Allows advanced users to customize the web manifest file over and above the default, and therefore gain the ability to alter how a Bookstack instance is presented as a PWA, for example.

Can the goal of this request already be achieved via other means?

  • Specifying a second manifest file with a more specific start_url field should allow overriding in certain specific cases.
  • Editing /app/App/PwaManifestBuilder.php within a deployed instance
  • Overriding the content of manifest.json within the http server software (eg. Caddy/Nginx) or at a reverse proxy

These are workarounds and thus brittle and may not survive upgrades or spec changes.

Have you searched for an existing open/closed issue?

  • [X] I have searched for existing issues and none cover my fundamental request

How long have you been using BookStack?

1 to 5 years

Additional context

Would potentially also resolve issues such as pull/4828 by allowing per-instance customization of the manifest file.

matt-beamish avatar Feb 14 '24 04:02 matt-beamish

Thanks for the request @matt-beamish. Personally, I'm doubtful there's enough use-case/demand to be worth maintaining extra controls/options specifically for this, especially as there are workaround options, but we can leave this open for a little bit to guage interest. It would be helpful to understand the actual changes you're intending to make.

Editing /app/App/PwaManifestBuilder.php within a deployed instance

I think it should also be possible to extend this class via our logical theme system. Would still be somewhat dependant on internals, but it's not altering them directly.

If a file called "manifest.json" (or some other known/reserved name) is found in the /public root, use this to populate the manifest tag instead of linking to the generated file;

This is what should already happen in the majority of hosting cases of common server/instance setups. It's not something we specifically expect or handle BookStack side, but I can't really see us changing the manifest endpoint anytime soon, think that'd be pretty stable over time.

ssddanbrown avatar Feb 14 '24 17:02 ssddanbrown