Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespub committed Dec 23, 2024
1 parent 9fa7bfa commit b3a5d10
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ x.x.x - TODO
* ...

3.x.x - 2024xxxx

3.5.4 - 20241223 Update translations, adapt templates for PageId + refactor
* Move base url and slugify from Route to UriGenerator
* Use RequestContext and instance methods in Framework for future adapters
* Add HasRouteTrait to simplify handler route() calls and future migrations
Expand All @@ -25,6 +27,8 @@ x.x.x - TODO
* Add PageQueryScope enum and PageFilter class (wip)
* Group entries by filter group for twigged template - see 'filters.html'
* Split off ProxyRequest class to handle trusted proxy headers for base url

3.5.1 - 20241211 Fix issues, add formats + replace transliterator
* Use symfony/string package as alternative for normAndUp and slugify with Transliterator
* Get request locale based on Translation and HTTP_ACCEPT_LANGUAGE
* Clean up Route url methods and test generating route urls
Expand Down
2 changes: 1 addition & 1 deletion resources/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "COPS REST API",
"version": "3.4.6"
"version": "3.5.4"
},
"servers": [
{
Expand Down
1 change: 1 addition & 0 deletions src/Calibre/BookList.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ public function getBooksByIdList($idlist)
// @todo this is already covered in Filter::addBookIdListFilter()
$query = self::SQL_BOOKS_BY_ID_LIST;
$query = str_replace('books.id = ? ', 'books.id IN (' . str_repeat('?,', count($idlist) - 1) . '?) ', $query);
// no page limit here
[$entryArray, $totalNumber] = $this->getEntryArray($query, $idlist, -1);
$sorted = $this->orderBy ?? "id";
if ($sorted == "id") {
Expand Down
2 changes: 1 addition & 1 deletion src/Input/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class Config
{
public const VERSION = '3.4.6';
public const VERSION = '3.5.4';
public const ENDPOINT = [
"html" => "index.php",
"feed" => "feed.php",
Expand Down
2 changes: 2 additions & 0 deletions src/Output/JsonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ public function getJson($request, $complete = false)
// @todo get rid of extraParams as filters should be included in navlink now
$extraParams = $currentPage->filterParams;
$out ["isFilterPage"] = true;
} elseif ($currentPage->idPage == PageId::FILTER_ID) {
$out ["isFilterPage"] = true;
}
foreach ($currentPage->entryArray as $entry) {
array_push($entries, $this->getContentArray($entry, $extraParams));
Expand Down
15 changes: 15 additions & 0 deletions src/Pages/PageFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use SebLucas\Cops\Calibre\VirtualLibrary;
use SebLucas\Cops\Input\Config;
use SebLucas\Cops\Input\Request;
use SebLucas\Cops\Model\Entry;

class PageFilter extends Page
{
Expand Down Expand Up @@ -174,4 +175,18 @@ public function getEntries()
}
*/
}

/**
* Summary of addEntries
* @param array<Entry> $entries
* @return void
*/
public function addEntries($entries)
{
foreach ($entries as $idx => $entry) {
// @todo replace instance link with filter link
// ...
}
$this->entryArray = array_merge($this->entryArray, $entries);
}
}
17 changes: 17 additions & 0 deletions tests/BookListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,23 @@ public function testGetBooksByPubYear(): void
$this->assertCount(9, $entryArray);
}

public function testGetBooksByIdList(): void
{
$booklist = new BookList(self::$request);

// All books in idlist
[$entryArray, $totalNumber] = $booklist->getBooksByIdList([17, 19, 42]);
$this->assertEquals(-1, $totalNumber);
$this->assertCount(2, $entryArray);

// All books sorted by id
[$entryArray, $totalNumber] = $booklist->getBooksByIdList([]);
$this->assertEquals(16, $totalNumber);
$this->assertCount(16, $entryArray);
$this->assertEquals('id', $booklist->orderBy);
$this->assertEquals(2, $entryArray[0]->book->id);
}

public function testGetBatchQuery(): void
{
// All recent books
Expand Down
2 changes: 1 addition & 1 deletion tests/restapi/page-about.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"filters": false,
"abouturl": "vendor/bin/index.php/restapi/about",
"customizeurl": "vendor/bin/index.php/restapi/customize",
"fullhtml": "<div class=\"bookpopup\" style=\"max-width:700px;\">\n<h1>About COPS 3.4.6</h1>\n<h2>This Fork</h2>\n<p>See <a href=\"https://github.com/mikespub-org/seblucas-cops/blob/main/CHANGELOG.md\">CHANGELOG</a> on Github for details: <a href=\"https://github.com/mikespub-org/seblucas-cops\">https://github.com/mikespub-org/seblucas-cops</a></p>\n\n<h2>Authors</h2>\n<p>COPS is developed and maintained by Sébastien Lucas.</p>\n\n<p>See full history on <a href=\"https://github.com/seblucas/cops/graphs/contributors\">Github</a> to check all authors.</p>\n\n<p>COPS use some external libraries, check README for the details.</p>\n<h2>Copyright</h2>\n<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 or later as published by the Free Software Foundation.</p>\n\n<p>The complete content of license is provided in file LICENSE within distribution and also available <a href=\"http://www.gnu.org/licenses/gpl.html\">online</a>.</p>\n<h2>Contact</h2>\n<p>For more info please visit <a href=\"http://blog.slucas.fr/en/oss/calibre-opds-php-server\">COPS Home Page</a></p>\n\n<p>You can also check <a href=\"http://www.mobileread.com/forums/showthread.php?t=170903\">COPS's topic on MobileRead forum</a>.</p>\n\n<p>DISCLAIMER : COPS is an open source software free to install everywhere. So if you have questions about any books available with any installation of COPS, please ask the owner of the website and not COPS's maintainer.</p>\n<h2>Thanks</h2>\n<p>Thanks a lot to Kovid Goyal for <a href=\"http://calibre-ebook.com\">Calibre</a>.</p>\n\n<p>And many thanks to all those who helped test COPS.</p>\n</div>\n",
"fullhtml": "<div class=\"bookpopup\" style=\"max-width:700px;\">\n<h1>About COPS 3.5.4</h1>\n<h2>This Fork</h2>\n<p>See <a href=\"https://github.com/mikespub-org/seblucas-cops/blob/main/CHANGELOG.md\">CHANGELOG</a> on Github for details: <a href=\"https://github.com/mikespub-org/seblucas-cops\">https://github.com/mikespub-org/seblucas-cops</a></p>\n\n<h2>Authors</h2>\n<p>COPS is developed and maintained by Sébastien Lucas.</p>\n\n<p>See full history on <a href=\"https://github.com/seblucas/cops/graphs/contributors\">Github</a> to check all authors.</p>\n\n<p>COPS use some external libraries, check README for the details.</p>\n<h2>Copyright</h2>\n<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 or later as published by the Free Software Foundation.</p>\n\n<p>The complete content of license is provided in file LICENSE within distribution and also available <a href=\"http://www.gnu.org/licenses/gpl.html\">online</a>.</p>\n<h2>Contact</h2>\n<p>For more info please visit <a href=\"http://blog.slucas.fr/en/oss/calibre-opds-php-server\">COPS Home Page</a></p>\n\n<p>You can also check <a href=\"http://www.mobileread.com/forums/showthread.php?t=170903\">COPS's topic on MobileRead forum</a>.</p>\n\n<p>DISCLAIMER : COPS is an open source software free to install everywhere. So if you have questions about any books available with any installation of COPS, please ask the owner of the website and not COPS's maintainer.</p>\n<h2>Thanks</h2>\n<p>Thanks a lot to Kovid Goyal for <a href=\"http://calibre-ebook.com\">Calibre</a>.</p>\n\n<p>And many thanks to all those who helped test COPS.</p>\n</div>\n",
"homeurl": "vendor/bin/index.php",
"parenturl": "vendor/bin/index.php",
"hierarchy": false,
Expand Down
2 changes: 1 addition & 1 deletion tests/restapi/page-filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Filters",
"parentTitle": "",
"baseurl": "vendor/bin/index.php",
"isFilterPage": false,
"isFilterPage": true,
"databaseId": "",
"databaseName": "",
"libraryId": "",
Expand Down
2 changes: 1 addition & 1 deletion tests/restapi/restapi-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "COPS REST API",
"version": "3.4.6"
"version": "3.5.4"
},
"servers": [
{
Expand Down

0 comments on commit b3a5d10

Please sign in to comment.