Skip to content

Conversation

chocolatkey
Copy link
Member

@chocolatkey chocolatkey commented Oct 10, 2025

This issue's goal is to give implementers more control over the access of a service publicly (e.g. webserver) versus in Go code, and provide the necessary building blocks to fix readium/cli#62

Changelog

All services are now hidden by default. This mainly affects implementers creating webservers, but you also shouldn't need to manually remove services just to produce clean manifest output. To restore previous functionality, set the streamer.Config's AddServiceLinks to true

Added

  • ServicesBuilder now has a convenience function Services to get the names of all services currently in the builder
  • ServicesBuilder now has a ExposeLinks and HideLinks function to toggle the exposure of a service via the links that get added to the WebPub manifest, as well as access to the service via its well-known link path. By default, services are private
  • streamer.Config has a new property, AddServiceLinks. Setting this property is equivalent to calling the aforementioned ExposeLinks function for every service

Changed

  • ServiceFactory now has a required public property. This lets a service expose itself via the Get and Links function if set to true. This also means that by default, all services are now "private". That means they will not be added to manifests as links, or callable by said link's path. They are still directly accessible in Go code using e.g. Publication.FindService, and then directly calling their functions by casting them to the correct service type (see e.g. Publication.Positions)

@chocolatkey chocolatkey marked this pull request as ready for review October 10, 2025 07:51
Copy link
Member

@mickael-menu mickael-menu left a comment

Choose a reason for hiding this comment

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

The implementation and solution are looking good 👍

Just a doubt regarding the meaning of "public" / "publicize". Technically the services are always public in the Publication object (albeit with native Go APIs). What about using ExposeAsResources or ExposeLinks instead?

@chocolatkey
Copy link
Member Author

@mickael-menu I've changed it to ExposeLinks and HideLinks

Copy link
Member

@mickael-menu mickael-menu left a comment

Choose a reason for hiding this comment

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

Thank you for making the changes.

@chocolatkey chocolatkey merged commit b5648f2 into develop Oct 14, 2025
4 checks passed
@chocolatkey chocolatkey deleted the services-improvements branch October 14, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--infer-page-count does not work

2 participants