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

Expose counter on meta endpoint #616

Closed
rgaudin opened this issue Sep 28, 2021 · 5 comments · Fixed by #646
Closed

Expose counter on meta endpoint #616

rgaudin opened this issue Sep 28, 2021 · 5 comments · Fixed by #646
Assignees
Milestone

Comments

@rgaudin
Copy link
Member

rgaudin commented Sep 28, 2021

Currently, we can't access Counter metadata via kiwix-serve. I've set this as bug because it's a regression but might have been removed on purpose.

I know that @kelson42 also relies on this.

if (meta_name == "title") {
content = getArchiveTitle(*archive);
} else if (meta_name == "description") {
content = getMetaDescription(*archive);
} else if (meta_name == "language") {
content = getMetaLanguage(*archive);
} else if (meta_name == "name") {
content = getMetaName(*archive);
} else if (meta_name == "tags") {
content = getMetaTags(*archive);
} else if (meta_name == "date") {
content = getMetaDate(*archive);
} else if (meta_name == "creator") {
content = getMetaCreator(*archive);
} else if (meta_name == "publisher") {
content = getMetaPublisher(*archive);
} else if (meta_name == "favicon") {
getArchiveFavicon(*archive, 48, content, mimeType);
} else if (const unsigned illustrationSize = parseIllustration(meta_name)) {
getArchiveFavicon(*archive, illustrationSize, content, mimeType);
} else {
return Response::build_404(*this, request, bookName, "");
}

Side questions:

  • Why the change in case? Metadata are title case and having to switch feels unnatural.
  • Why not offering all metadata using this endpoint? I see that all of the supported ones have a dedicated getter here. Maybe we should provide a generic one as well, to be used for others?
@rgaudin rgaudin self-assigned this Sep 28, 2021
@kelson42 kelson42 added this to the 10.0.0 milestone Sep 28, 2021
@maneeshpm
Copy link
Contributor

@rgaudin I agree, title case would have been better here, the metadata are still stored in Title case inside our archive. Having a lowercase middle process might introduce confusion.

We require dedicated getters for several metadata that might require some preprocessing, like getArchiveTitle(), getMetaTags(), getArchiveFavicon() etc. But for the generic ones like Name, Language etc the dedicated getters are mere helpers for the generic getMetadata(archive, metadata) function(see archiveTools.cpp. We can expose the generic function, given the metadata can be extracted as a string.

Apart from this, we do have a dedicated function for getting counter metadata as well.

@mgautierfr
Copy link
Member

Currently, we can't access Counter metadata via kiwix-serve. I've set this as bug because it's a regression but might have been removed on purpose.

While I agree we should be able to access the M/Counter metadata (and all others), this feature was never there.
I've added the /meta endpoint mainly because the opds stream was needing to access the favicon of the zim file (to not include the icon data in the stream).
I've also add some other metadata (not used at the time) in the same change and simply "forgot" M/Counter.

@rgaudin
Copy link
Member Author

rgaudin commented Sep 29, 2021

I meant with namespaced ZIM, we could just use the full path like M/Counter

@mgautierfr
Copy link
Member

Indeed. My bad.

mgautierfr added a commit that referenced this issue Oct 25, 2021
- Serve all metadata available in the zim archive.
- Serve (almost) only metadata available in the zim archive
  (no default value).
- Provide the correct mimytype all the time
  (not only for favicon/Illustration)
- Provide a small compatibility layer for zim archive without favicon
  (Mainly because we are also providing a compatibility layer elsewhere)


Fix #616
@kelson42 kelson42 assigned mgautierfr and unassigned rgaudin Nov 21, 2021
@kelson42
Copy link
Collaborator

Kind of duplicate of #631 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants