diff --git a/JSON_renderer.php b/JSON_renderer.php
index 130395a..8e63a67 100644
--- a/JSON_renderer.php
+++ b/JSON_renderer.php
@@ -72,10 +72,13 @@ class JSONRenderer
$out ["datas"] = array ();
$dataKindle = $book->GetMostInterestingDataToSendToKindle ();
foreach ($book->getDatas() as $data) {
- $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0);
+ $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0, "readerUrl" => "");
if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) {
$tab ["mail"] = 1;
}
+ if ($data->format == "EPUB") {
+ $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db=0"; //TODO fix the database
+ }
array_push ($out ["datas"], $tab);
}
$out ["authors"] = array ();
diff --git a/templates/default/bookdetail.html b/templates/default/bookdetail.html
index 9049978..b9ed403 100644
--- a/templates/default/bookdetail.html
+++ b/templates/default/bookdetail.html
@@ -12,6 +12,9 @@
{{? data.mail == 1}}
{{?}}
+ {{? data.readerUrl != ""}}
+
+ {{?}}
{{~}}
diff --git a/templates/default/main.html b/templates/default/main.html
index 063d594..bcbd614 100644
--- a/templates/default/main.html
+++ b/templates/default/main.html
@@ -32,7 +32,7 @@