Merge branch 'master' of ssh://patema.crystalyx.net:2222/Xefir/epubreader
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2023-06-24 18:12:34 +02:00
commit dce3b5f0a4
8 changed files with 75 additions and 24 deletions

View File

@ -3,8 +3,8 @@ name: default
type: docker type: docker
steps: steps:
- name: nextcloud:21 - name: nextcloud:22
image: nextcloud:21 image: nextcloud:22
commands: commands:
- curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar - curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
- chmod +x /usr/local/bin/composer - chmod +x /usr/local/bin/composer

View File

@ -29,7 +29,7 @@ See [README] for more exhaustive information on features and potential misfeatur
[README]: https://github.com/e-alfred/epubreader/blob/master/epubreader/README.md [README]: https://github.com/e-alfred/epubreader/blob/master/epubreader/README.md
]]> ]]>
</description> </description>
<version>1.4.8</version> <version>1.4.9</version>
<licence>agpl</licence> <licence>agpl</licence>
<author>Frank de Lange</author> <author>Frank de Lange</author>
<author>e-alfred</author> <author>e-alfred</author>
@ -46,7 +46,7 @@ See [README] for more exhaustive information on features and potential misfeatur
<screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-00.jpg?raw=true</screenshot> <screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-00.jpg?raw=true</screenshot>
<screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-02.jpg?raw=true</screenshot> <screenshot>https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-02.jpg?raw=true</screenshot>
<dependencies> <dependencies>
<nextcloud min-version="21" max-version="27"/> <nextcloud min-version="22" max-version="27"/>
</dependencies> </dependencies>
<settings> <settings>
<personal>OCA\Epubreader\Settings\Personal</personal> <personal>OCA\Epubreader\Settings\Personal</personal>

View File

@ -1,7 +1,7 @@
{ {
"name": "nextcloud/epubreader", "name": "nextcloud/epubreader",
"description": "EPUB/CBZ/PDF ebook reader", "description": "EPUB/CBZ/PDF ebook reader",
"version": "1.4.8", "version": "1.4.9",
"type": "project", "type": "project",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"require-dev": { "require-dev": {
@ -18,7 +18,7 @@
}, },
"config": { "config": {
"platform": { "platform": {
"php": "7.4" "php": "8.0"
} }
} }
} }

16
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5c7be477b217d6074abc6c2f8d2c2256", "content-hash": "7b806afecf0b4bd9cf2aed44f533eaf4",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@ -94,16 +94,16 @@
}, },
{ {
"name": "php-cs-fixer/shim", "name": "php-cs-fixer/shim",
"version": "v3.17.0", "version": "v3.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git", "url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f" "reference": "a517e03dd0727336e502e071cc08e406ac878dba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f", "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/a517e03dd0727336e502e071cc08e406ac878dba",
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f", "reference": "a517e03dd0727336e502e071cc08e406ac878dba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -140,9 +140,9 @@
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues", "issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0" "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.18.0"
}, },
"time": "2023-05-22T20:00:38+00:00" "time": "2023-06-18T22:26:36+00:00"
}, },
{ {
"name": "psalm/phar", "name": "psalm/phar",
@ -389,7 +389,7 @@
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.4" "php": "8.0"
}, },
"plugin-api-version": "2.3.0" "plugin-api-version": "2.3.0"
} }

View File

@ -167,10 +167,7 @@ class PageController extends Controller {
]; ];
} }
/** private function toJson(array $value): string {
* @param mixed $value
*/
private function toJson($value): string {
return htmlspecialchars(json_encode($value), ENT_QUOTES, 'UTF-8'); return htmlspecialchars(json_encode($value), ENT_QUOTES, 'UTF-8');
} }
} }

View File

@ -24,7 +24,7 @@ abstract class ReaderEntity extends Entity {
* *
* @return string|array * @return string|array
*/ */
public function conditional_json_decode(string $el) { public function conditional_json_decode(string $el): mixed {
/** @var array $result */ /** @var array $result */
$result = json_decode($el); $result = json_decode($el);
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {

View File

@ -11,13 +11,13 @@
namespace OCA\Epubreader; namespace OCA\Epubreader;
use OCA\Epubreader\AppInfo\Application; use OCA\Epubreader\AppInfo\Application;
use OCA\Epubreader\Utility\Server;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\Files\Node; use OCP\Files\Node;
use OCP\IConfig; use OCP\IConfig;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\Server;
class Hooks { class Hooks {
@ -79,10 +79,7 @@ class Hooks {
$queryBuilder->executeStatement(); $queryBuilder->executeStatement();
} }
/** private static function isJson(mixed $string): bool {
* @param mixed $string
*/
private static function isJson($string): bool {
return is_string($string) && is_array(json_decode($string, true)) && json_last_error() == JSON_ERROR_NONE; return is_string($string) && is_array(json_decode($string, true)) && json_last_error() == JSON_ERROR_NONE;
} }
} }

57
lib/Utility/Server.php Normal file
View File

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/**
* @copyright Carl Schwan <carl@carlschwan.eu>
*
* @license AGPL-3.0-or-later
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\Epubreader\Utility;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class allowing to inject services into your application. You should
* use whenever possible dependency injections instead.
*
* ```php
* use OCP\Server;
*
* $tagManager = Server::get(ITagManager::class);
* ```
*
* @since 25.0.0
*/
final class Server {
/**
* @template T
* @param class-string<T>|string $serviceName
* @return T|mixed
* @psalm-template S as class-string<T>|string
* @psalm-param S $serviceName
* @psalm-return (S is class-string<T> ? T : mixed)
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @since 25.0.0
*/
public static function get(string $serviceName) {
/** @psalm-suppress UndefinedClass */
return \OC::$server->get($serviceName);
}
}