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

kiwix-serve should propose widgets #585

Open
kelson42 opened this issue Jul 23, 2017 · 12 comments · May be fixed by #797
Open

kiwix-serve should propose widgets #585

kelson42 opened this issue Jul 23, 2017 · 12 comments · May be fixed by #797
Assignees
Milestone

Comments

@kelson42
Copy link
Collaborator

kelson42 commented Jul 23, 2017

For now there is no solution to export (part of) the ZIM library served by a kiwix-serve instance in a human readable fashion. For computers, we have the OPDS feed, but for humans there is nothing. If this is need, for the moment, there is only two solutions:

  • build an OPDS parser
  • maintain manually via a third party tool links to the content (but most of ZIM files are renewed monthly)
  • Just provide a simple link to the homepage of kiwix-serve (so no integrated experience)

This is not realistic to expect this to satsify all use cases like:

  • Our own library https://wiki.kiwix.org/wiki/Content_in_all_languages (currently updated via a dedicated script)
  • Our own Web Site which should advert the most proeminent ZIM files
  • Tools like Rachel, IIAB, OLIPS which might be interested to have a simpler solution to integrate the content
  • Any Web site which for example has its content scraped and would be interested to advert it
  • Basically any Web site which want to put an emphasis on a ZIM file or a set of ZIM files.

This is why, all these use-cases, would benefit of kiwix-serve providing a new-endpoint exporting a widget on the kiwix-serve home page.

Here a few ideas/properties of this new feature:

  • Widget should be laded in an iframe on client side
  • It should be possible to make a filter to select which ZIM files we want to display (reuse same system like already working on kiwix-serve)
  • It should be possible to decide if the widget content has the search filters or no (maybe just through CSS tweaking?)
  • Tiles should allow (but should be possible to disable) - if available at all - to view the content via a simple click on the tile. Then probably the content should open in a new tab (to be discussed).
  • Tiles should allow (but should be possible to disable) - if available at all - to download a ZIM file
  • Solution to integrate the widget should be easy, ie. the end-point should provide the HTML code via a simple click.
  • Documentation about all the options of this new feature should be written in the kiwix-tools documentation
  • It should be able to change the stylesheet via a custom CSS within the iframe
  • It should be possible to run a custom javascript to custom the DOM within the ifram

Copied from original issue: kiwix/kiwix-xulrunner#245

@kelson42 kelson42 self-assigned this Jul 29, 2019
@kelson42 kelson42 removed their assignment May 11, 2021
@kelson42 kelson42 transferred this issue from kiwix/kiwix-tools Jul 13, 2021
@kelson42 kelson42 self-assigned this Aug 20, 2021
@stale
Copy link

stale bot commented Mar 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Mar 30, 2022
@mgautierfr
Copy link
Member

I'm not sure this enhancement is still wanted.
At least of BSF side, they have replaced ideascube by olip. And olip proposes the kiwix application like a whole instead of displaying each individual contents.
And even if they were presenting content, the widget would probably be specific to their use case (ie, not generic enough to have kiwix-serve generate it).
We should propose them to build the widget based on the new catalog api : <library_root>/catalog/v2/entry/<bookId> which return all informations about bookId.

@kelson42
Copy link
Collaborator Author

This is not for BSF, this is for our own Web sites and it is important to provide an easy way to anybody wanting to list tiles on his own Web site.

@stale stale bot removed the stale label Mar 30, 2022
@mgautierfr
Copy link
Member

What you describe in your first message explicitly speak about make life easier for people integrating kiwix in there solution.
Can you be more explicit about what is wanted ? Do you want us to provide html subset on a API endpoint the integrator could embedded blindly in their own webpages ?

@kelson42
Copy link
Collaborator Author

Do you want us to provide html subset on a API endpoint the integrator could embedded blindly in their own webpages ?

Yes this is the idea.

@mgautierfr
Copy link
Member

As I said, the structure of this widget would be probably specific to the application, it will be pretty useless to provide a generic one.

@kelson42 kelson42 changed the title kiwix-serve (ZIM?) should propose widgets kiwix-serve should propose widgets May 8, 2022
@kelson42 kelson42 assigned juuz0 and unassigned MananJethwani May 15, 2022
@kelson42 kelson42 pinned this issue Jun 14, 2022
@kelson42 kelson42 added this to the 11.1.0 milestone Jun 14, 2022
@kelson42 kelson42 removed their assignment Jun 25, 2022
@kelson42
Copy link
Collaborator Author

@juuz0 To custom the CSS within the iframe, the styling shoukd probably be given as a URL parameter and integrate within the HTML code. Agree? Let me know if you think we should do that differently.

@juuz0
Copy link
Collaborator

juuz0 commented Jun 27, 2022

@kelson42 I assume you mean CSS in URL parameter like this:
http://192.168.18.8:8080/widget/?style="tag{color:green;}"

Though we can parse this and definitely make it work, I think it's very prone to an XSS vulnerability like earlier. Obviously better parsing can help reduce it.
An alternative I thought was to add parameter similar to customIndex in kiwix-serve for the custom CSS in widget. This custom file styles will override the default ones.
Along with this, some general tweaks like toggling search filters, only text search box, etc. could be added as a parameter like Manan's PR

@kelson42
Copy link
Collaborator Author

The widget user has no access to launch the kiwix-serve. In addition, many different users can use widgets with differrent CSS.

@juuz0
Copy link
Collaborator

juuz0 commented Jun 30, 2022

@kelson42
Only for users who want a custom CSS and JS, would adding a small JS code by themselves be convenient enough?

The host website:

<iframe id="receiver" src="http://library.kiwix.org/widget/" width="2500" height="2000">
  <p>Your browser does not support iframes.</p>
</iframe>

<script>
  window.onload = function() {
  var receiver = document.getElementById('receiver').contentWindow;
  function sendMessage(e) {
    e.preventDefault();

    let css = `custom CSS rules here`
    receiver.postMessage(css, 'http://library.kiwix.org/widget/');
  }
  sendMessage();
}
</script>

This host website code will not change, except only the CSS rules part.

@kelson42
Copy link
Collaborator Author

@juuz0 Sounds more secure indeed. Lets try that way

@kelson42
Copy link
Collaborator Author

@veloman-yunkan Now that other PRs are merged, can we move forward with this?

@kelson42 kelson42 modified the milestones: 12.1.0, 12.2.0 Jun 2, 2023
@kelson42 kelson42 modified the milestones: 13.0.0, 13.1.0 Jul 26, 2023
@kelson42 kelson42 modified the milestones: 13.2.0, 13.3.0 Jun 1, 2024
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.

5 participants