Open kelson42 opened 6 years ago
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.
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.
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.
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 ?
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.
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.
@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.
@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
The widget user has no access to launch the kiwix-serve. In addition, many different users can use widgets with differrent CSS.
@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.
@juuz0 Sounds more secure indeed. Lets try that way
@veloman-yunkan Now that other PRs are merged, can we move forward with this?
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:kiwix-serve
(so no integrated experience)This is not realistic to expect this to satsify all use cases like:
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:
iframe
on client sideCopied from original issue: kiwix/kiwix-xulrunner#245