Skip to content

Commit

Permalink
feat(kobo): Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusa87 committed May 25, 2024
1 parent 1c7c020 commit 885ede5
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 11 deletions.
2 changes: 1 addition & 1 deletion templates/kobo_admin/_delete_form.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form method="post" action="{{ path('app_kobo_admin_delete', {'id': kobo.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ kobo.id) }}">
<button class="btn">Delete</button>
<button class="btn btn-danger">Delete</button>
</form>
2 changes: 1 addition & 1 deletion templates/kobo_admin/_form.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}
9 changes: 6 additions & 3 deletions templates/kobo_admin/edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
{% block title %}Edit Kobo{% endblock %}

{% block body %}
<h1>Edit Kobo</h1>

{{ include('kobo_admin/_form.html.twig', {'button_label': 'Update'}) }}

<a href="{{ path('app_kobo_admin_index') }}">back to list</a>

{{ include('kobo_admin/_delete_form.html.twig') }}
<div class="mt-3">
{{ include('kobo_admin/_delete_form.html.twig') }}
</div>

{{ include('kobo_admin/instructions.html.twig') }}

{% endblock %}
5 changes: 3 additions & 2 deletions templates/kobo_admin/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{% block title %}Kobo index{% endblock %}

{% block body %}
<h1>Kobo index</h1>

<table class="table">
<thead>
<tr>
Expand Down Expand Up @@ -34,4 +32,7 @@
</table>

<a href="{{ path('app_kobo_admin_new') }}">Create new</a>


{{ include('kobo_admin/instructions.html.twig') }}
{% endblock %}
58 changes: 58 additions & 0 deletions templates/kobo_admin/instructions.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<div class="row">
<div class="col-md-12 mt-5">
<h3>Instructions</h3>
<p>To use a <a href="https://en.wikipedia.org/wiki/Kobo_eReader">Kobo</a> with this application, you will need to manually edit a configuration file on your Kobo.</p>
<ul>
<li>Plug your Kobo to your computer and browse the files on it.</li>
<li>Find a hidden file located at <code>.kobo/Kobo/Kobo eReader.conf</code>.</li>
<li>Edit the file with a text editor (vs-code, vim, etc).</li>
<li>
Alter the line <code>api_endpoint</code> under the section <code>[OneStoreServices]</code> (or create it if it doesn't exist).
<pre>
{% apply spaceless -%}
<code>
{{- "\n" }}[OneStoreServices]
{{- "\n" }}...{{ "" -}}
{% if token is not defined %}
{{- "\n" }}api_endpoint={{ app.request.getUriForPath("/kobo/" ~ (token|default("<token>"))~ "/") -}}
{% else %}
{{- "\n" }}api_endpoint={{ url('koboapi_endpoint', {'accessKey': token}) -}}
{% endif %}
{{- "\n"}}...
</code>
{%- endapply %}
</pre>
</li>
{% if token is not defined %}
<li>
The <code>{{ "<token>"|escape }}</code> placeholder must be replaced with your access key.
</li>
{% endif %}
<li>When the configuration is over, save the file, eject your kobo and click on the sync button !</li>
</ul>
</div>
</div>

<div class="row">
<div class="col-md-12">
<h3>Known limitations</h3>
<ul>
<li>This is an experimental feature, only basic book syncing is currently supported.</li>
<li>
The domain name <code>{{ app.request.getUriForPath("/") }}</code> must be protected with a valid HTTPS certificate and accessible from the internet.
</li>
<li>So far, you will not be able to access the books you bought via the Official store (Except if you revert the configuration on your Kobo).</li>
<li>Some features are known to be not working, or haven't been tested at all. Example: Bookmarks, Syncing Read progression, Syncing big collections, etc.</li>
<li>You need to explicitly "add a book in a specific shelf", and configure the shelf to be synced with your Kobo under <strong>Sync with Shelves</strong> from this admin panel. </li>
</ul>
</div>
</div>

<div class="row">
<div class="col-md-12">
<h3>Sources</h3>
<ul>
<li>Kobo sync implementation is inspired by <a href="https://github.com/janeczku/calibre-web">Calibre Web</a>. Thanks for the hard work on it. You can read the <a href="https://github.com/janeczku/calibre-web/wiki/Kobo-Integration">doc</a> they have.</li>
</ul>
</div>
</div>
9 changes: 6 additions & 3 deletions templates/kobo_admin/new.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{% extends 'base.html.twig' %}

{% block title %}New Kobo{% endblock %}
{% block title %}Create new Kobo{% endblock %}

{% block body %}
<h1>Create new Kobo</h1>

{{ include('kobo_admin/_form.html.twig') }}

<a href="{{ path('app_kobo_admin_index') }}">back to list</a>
<div>
<a href="{{ path('app_kobo_admin_index') }}">back to list</a>
</div>

{{ include('kobo_admin/instructions.html.twig') }}
{% endblock %}
4 changes: 3 additions & 1 deletion templates/kobo_admin/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% block title %}Kobo{% endblock %}

{% block body %}
<h1>Kobo</h1>

<table class="table">
<tbody>
Expand All @@ -27,4 +26,7 @@
<a href="{{ path('app_kobo_admin_edit', {'id': kobo.id}) }}">edit</a>

{{ include('kobo_admin/_delete_form.html.twig') }}

{% include('kobo_admin/instructions.html.twig') with {'token': kobo.accessKey} only %}

{% endblock %}

0 comments on commit 885ede5

Please sign in to comment.