Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespub committed May 7, 2024
1 parent 36985a2 commit af075d9
Show file tree
Hide file tree
Showing 15 changed files with 692 additions and 293 deletions.
16 changes: 8 additions & 8 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]
RewriteRule ^view/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub&view=1 [L]
RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L]
RewriteRule ^view/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3&view=1 [L]
RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L]
RewriteRule ^view/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub&view=1 [L]
RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L]
RewriteRule ^view/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2&view=1 [L]
RewriteRule ^download/(\d+)/(\d+)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]
RewriteRule ^download/(\d+)/(\d+)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L]
RewriteRule ^download/(\d+)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L]
RewriteRule ^download/(\d+)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L]
RewriteRule ^view/(\d+)/(\d+)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub&view=1 [L]
RewriteRule ^view/(\d+)/(\d+)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3&view=1 [L]
RewriteRule ^view/(\d+)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub&view=1 [L]
RewriteRule ^view/(\d+)/.*\.(.*)$ fetch.php?data=$1&type=$2&view=1 [L]
</IfModule>

<IfModule mod_expires.c>
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ x.x.x - TODO
* ...

2.6.x - 2024xxxx
* ...

2.6.1 - 20240507 Reverse proxies, url rewriting with docker + clean-up
* Changes in config_default.php file:
- new $config['cops_trusted_proxies'] (dev only)
- new $config['cops_trusted_headers'] (dev only)
* ...
* Upgrade swagger-ui-dist package and link to 5.17.6
* Fix rewriting rules in nginx default site conf - see linuxserver/docker-cops#31
* Support X-Forwarded-* and Forwarded headers from trusted proxies (dev only)
* Add Wiki page to clarify [Reverse proxy configurations](https://github.com/mikespub-org/seblucas-cops/wiki/Reverse-proxy-configurations)
* Rename JSON_renderer and OPDS_renderer files and classes
* Add HtmlRenderer class and move html template rendering from index.php
* Use dcterms:modified instead of mtime as link attribute in OPDS feeds
* Support X-Forwarded-* and Forwarded headers from trusted proxies (dev only)

2.5.6 - 20240503 Support TXT files in OPDS feeds + add length and mtime
* Add length + mtime to OPDS acquisition links - perhaps for #79
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"require-dev": {
"kiwilan/php-opds": "^2.0",
"phpunit/phpunit": "^10.5",
"phing/phing": "^2.17",
"phing/phing": "^3.0",
"php-webdriver/webdriver": "dev-main",
"symfony/browser-kit": "^6.4||^7.0",
"symfony/http-client": "^6.4||^7.0",
Expand Down
669 changes: 624 additions & 45 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Input/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class Config
{
public const VERSION = '2.5.6';
public const VERSION = '2.6.1';
public const ENDPOINT = [
"index" => "index.php",
"feed" => "feed.php",
Expand Down
30 changes: 22 additions & 8 deletions lib/Input/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class Request
*/
public $urlParams = [];
protected string $queryString = '';
protected bool $online = true;
protected bool $parsed = true;
protected ?string $content = null;

/**
* Summary of __construct
* @param bool $online
* @param bool $parse
*/
public function __construct($online = true)
public function __construct($parse = true)
{
$this->online = $online;
$this->init();
$this->parseParams($parse);
}

/**
Expand Down Expand Up @@ -103,14 +103,16 @@ public function uri()
}

/**
* Summary of init
* Summary of parseParams
* @param bool $parse
* @return void
*/
public function init()
public function parseParams($parse = true)
{
$this->parsed = $parse;
$this->urlParams = [];
$this->queryString = '';
if (!$this->online) {
if (!$this->parsed) {
return;
}
$path = $this->path();
Expand Down Expand Up @@ -255,6 +257,18 @@ public function files($name)
return $_FILES[$name] ?? null;
}

/**
* Summary of content
* @return mixed
*/
public function content()
{
if (!isset($this->content)) {
$this->content = file_get_contents('php://input');
}
return $this->content;
}

/**
* Summary of option
* @param string $option
Expand Down
4 changes: 3 additions & 1 deletion lib/Input/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,9 @@ public static function getEndpoints()
public static function setBaseUrl($base)
{
static::$baseUrl = $base;
static::$proxyRequest = null;
if (is_null($base)) {
static::$proxyRequest = null;
}
}

/**
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "seblucas-cops",
"packageManager": "yarn@4.1.1",
"packageManager": "yarn@4.2.1",
"dependencies": {
"@mikespub/epubjs-reader": "^2024.3.5",
"@mikespub/epubjs-reader": "^2024.4.23",
"bootstrap": "^3.4.1",
"corejs-typeahead": "^1.3.4",
"dot": "^1.1.3",
Expand All @@ -11,7 +11,7 @@
"lru-fast": "^0.2.2",
"magnific-popup": "^1.1.0",
"normalize.css": "^8.0.1",
"swagger-ui-dist": "^5.12.0",
"swagger-ui-dist": "^5.17.6",
"twig": "^1.17.1"
},
"license": "GPL-2.0-or-later"
Expand Down
4 changes: 2 additions & 2 deletions templates/restapi.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
content="COPS - SwaggerUI"
/>
<title>COPS - SwaggerUI</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.12.0/swagger-ui.css" />
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.17.6/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5.12.0/swagger-ui-bundle.js" crossorigin></script>
<script src="https://unpkg.com/swagger-ui-dist@5.17.6/swagger-ui-bundle.js" crossorigin></script>
<!-- in pseudo doT syntax, but only this link is supported -->
<script>
window.onload = () => {
Expand Down
3 changes: 3 additions & 0 deletions test/BrowserKitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
use Symfony\Component\HttpClient\HttpClient;
use Exception;

/**
* @requires function \Symfony\Component\BrowserKit\HttpBrowser::__construct
*/
class BrowserKitTest extends TestCase
{
public static string $baseDir = '/cops/';
Expand Down
3 changes: 3 additions & 0 deletions test/KiwilanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
use SebLucas\Cops\Pages\Page;
use SebLucas\Cops\Pages\PageId;

/**
* @requires function \Opis\JsonSchema\Validator::__construct
*/
class KiwilanTest extends TestCase
{
public const OPDS_SCHEMAS = __DIR__ . "/schema/opds";
Expand Down
18 changes: 0 additions & 18 deletions tools/alpinePrepare.sh

This file was deleted.

71 changes: 0 additions & 71 deletions tools/export_file.txt

This file was deleted.

0 comments on commit af075d9

Please sign in to comment.