Compare commits
No commits in common. "master" and "1.4.8" have entirely different histories.
@ -1,7 +0,0 @@
|
|||||||
.idea
|
|
||||||
*.iml
|
|
||||||
/vendor/
|
|
||||||
/build/
|
|
||||||
node_modules/
|
|
||||||
/.php-cs-fixer.cache
|
|
||||||
js/*hot-update.*
|
|
26
.drone.yml
Normal file
26
.drone.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
type: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: php7.4
|
||||||
|
image: php:7.4-cli
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y unzip
|
||||||
|
- curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
|
||||||
|
- chmod +x /usr/local/bin/composer
|
||||||
|
- composer install
|
||||||
|
- composer run lint
|
||||||
|
- composer run cs:check
|
||||||
|
- composer run psalm:check
|
||||||
|
|
||||||
|
- name: nextcloud
|
||||||
|
image: nextcloud:27.0.0
|
||||||
|
commands:
|
||||||
|
- curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
|
||||||
|
- chmod +x /usr/local/bin/composer
|
||||||
|
- composer install
|
||||||
|
- composer run lint
|
||||||
|
- composer run cs:check
|
||||||
|
- composer run psalm:check
|
@ -1,31 +0,0 @@
|
|||||||
name: epubreader
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
nextcloud-22:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: nextcloud:28
|
|
||||||
steps:
|
|
||||||
- run: apt-get update
|
|
||||||
- run: apt-get install -y git nodejs
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
|
|
||||||
- run: chmod +x /usr/local/bin/composer
|
|
||||||
- run: composer install
|
|
||||||
- run: composer run lint
|
|
||||||
- run: composer run cs:check
|
|
||||||
- run: composer run psalm:check
|
|
||||||
|
|
||||||
nextcloud-27:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: nextcloud:28
|
|
||||||
steps:
|
|
||||||
- run: apt-get update
|
|
||||||
- run: apt-get install -y git nodejs
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
|
|
||||||
- run: chmod +x /usr/local/bin/composer
|
|
||||||
- run: composer install
|
|
||||||
- run: composer run lint
|
|
||||||
- run: composer run cs:check
|
|
||||||
- run: composer run psalm:check
|
|
@ -6,21 +6,7 @@ require_once './vendor/autoload.php';
|
|||||||
|
|
||||||
use Nextcloud\CodingStandard\Config;
|
use Nextcloud\CodingStandard\Config;
|
||||||
|
|
||||||
class MyConfig extends Config
|
$config = new Config();
|
||||||
{
|
|
||||||
public function getRules(): array
|
|
||||||
{
|
|
||||||
$rules = parent::getRules();
|
|
||||||
$rules['@PhpCsFixer'] = true;
|
|
||||||
$rules['curly_braces_position']['classes_opening_brace'] = 'next_line_unless_newline_at_signature_end';
|
|
||||||
$rules['phpdoc_separation'] = false;
|
|
||||||
$rules['phpdoc_to_comment'] = false;
|
|
||||||
$rules['single_line_comment_style'] = false;
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$config = new MyConfig();
|
|
||||||
$config
|
$config
|
||||||
->getFinder()
|
->getFinder()
|
||||||
->ignoreVCSIgnored(true)
|
->ignoreVCSIgnored(true)
|
||||||
|
21
Dockerfile
21
Dockerfile
@ -1,21 +0,0 @@
|
|||||||
FROM nextcloud:28
|
|
||||||
|
|
||||||
ENV NEXTCLOUD_UPDATE 1
|
|
||||||
ENV NEXTCLOUD_ADMIN_USER epubreader
|
|
||||||
ENV NEXTCLOUD_ADMIN_PASSWORD epubreader
|
|
||||||
ENV NEXTCLOUD_INIT_HTACCESS 1
|
|
||||||
ENV SQLITE_DATABASE epubreader
|
|
||||||
|
|
||||||
RUN curl -sSLo /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar && \
|
|
||||||
chmod +x /usr/local/bin/composer && \
|
|
||||||
rm -f /usr/local/etc/php/conf.d/opcache-recommended.ini && \
|
|
||||||
/entrypoint.sh true
|
|
||||||
|
|
||||||
USER www-data
|
|
||||||
|
|
||||||
COPY --chown=www-data:www-data . apps/epubreader
|
|
||||||
RUN cd apps/epubreader && composer install && cd - && \
|
|
||||||
php occ app:enable epubreader && \
|
|
||||||
php occ config:system:set debug --value=true
|
|
||||||
|
|
||||||
USER root
|
|
@ -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.5.0</version>
|
<version>1.4.8</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="22" max-version="27"/>
|
<nextcloud min-version="21" max-version="27"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<settings>
|
<settings>
|
||||||
<personal>OCA\Epubreader\Settings\Personal</personal>
|
<personal>OCA\Epubreader\Settings\Personal</personal>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud - Epubreader App.
|
* ownCloud - Epubreader App
|
||||||
*
|
*
|
||||||
* @author Frank de Lange
|
* @author Frank de Lange
|
||||||
* @copyright 2015 Frank de Lange
|
* @copyright 2015 Frank de Lange
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nextcloud/epubreader",
|
"name": "nextcloud/epubreader",
|
||||||
"description": "EPUB/CBZ/PDF ebook reader",
|
"description": "EPUB/CBZ/PDF ebook reader",
|
||||||
"version": "1.4.9",
|
"version": "1.4.8",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"nextcloud/ocp": "^28.0.0",
|
"nextcloud/ocp": "^27.0.0",
|
||||||
"psalm/phar": "^5.14.1",
|
"psalm/phar": "^5.12.0",
|
||||||
"nextcloud/coding-standard": "^1.1.1"
|
"nextcloud/coding-standard": "^1.1.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "8.0"
|
"php": "7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
composer.lock
generated
46
composer.lock
generated
@ -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": "679331c6a73b23ca99c427cc59b72485",
|
"content-hash": "5c7be477b217d6074abc6c2f8d2c2256",
|
||||||
"packages": [],
|
"packages": [],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
@ -50,20 +50,20 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nextcloud/ocp",
|
"name": "nextcloud/ocp",
|
||||||
"version": "v28.0.1",
|
"version": "v27.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nextcloud-deps/ocp.git",
|
"url": "https://github.com/nextcloud-deps/ocp.git",
|
||||||
"reference": "646241abbb388138130331edfd6774bda62ad1b0"
|
"reference": "c374aa2d4c3491812c19a53ce14063127daea08e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/646241abbb388138130331edfd6774bda62ad1b0",
|
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/c374aa2d4c3491812c19a53ce14063127daea08e",
|
||||||
"reference": "646241abbb388138130331edfd6774bda62ad1b0",
|
"reference": "c374aa2d4c3491812c19a53ce14063127daea08e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "~8.0 || ~8.1 || ~8.2 || ~8.3",
|
"php": "^7.4 || ~8.0 || ~8.1",
|
||||||
"psr/clock": "^1.0",
|
"psr/clock": "^1.0",
|
||||||
"psr/container": "^2.0.2",
|
"psr/container": "^2.0.2",
|
||||||
"psr/event-dispatcher": "^1.0",
|
"psr/event-dispatcher": "^1.0",
|
||||||
@ -72,7 +72,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-stable28": "28.0.0-dev"
|
"dev-stable27": "27.0.0-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
@ -88,22 +88,22 @@
|
|||||||
"description": "Composer package containing Nextcloud's public API (classes, interfaces)",
|
"description": "Composer package containing Nextcloud's public API (classes, interfaces)",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
||||||
"source": "https://github.com/nextcloud-deps/ocp/tree/v28.0.1"
|
"source": "https://github.com/nextcloud-deps/ocp/tree/v27.0.0"
|
||||||
},
|
},
|
||||||
"time": "2023-12-20T00:27:31+00:00"
|
"time": "2023-06-16T07:25:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "php-cs-fixer/shim",
|
"name": "php-cs-fixer/shim",
|
||||||
"version": "v3.22.0",
|
"version": "v3.17.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": "f6692934a6d1fe40fd8bc3339487490baa4a6700"
|
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f6692934a6d1fe40fd8bc3339487490baa4a6700",
|
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f",
|
||||||
"reference": "f6692934a6d1fe40fd8bc3339487490baa4a6700",
|
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -140,22 +140,22 @@
|
|||||||
"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.22.0"
|
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0"
|
||||||
},
|
},
|
||||||
"time": "2023-07-16T23:08:49+00:00"
|
"time": "2023-05-22T20:00:38+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psalm/phar",
|
"name": "psalm/phar",
|
||||||
"version": "5.19.1",
|
"version": "5.12.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/psalm/phar.git",
|
"url": "https://github.com/psalm/phar.git",
|
||||||
"reference": "c062e477cae7068a4cbcf3dba2a176687c5565a1"
|
"reference": "e7f9306ec83c706b4dba451f6adfb865ce4688e4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/psalm/phar/zipball/c062e477cae7068a4cbcf3dba2a176687c5565a1",
|
"url": "https://api.github.com/repos/psalm/phar/zipball/e7f9306ec83c706b4dba451f6adfb865ce4688e4",
|
||||||
"reference": "c062e477cae7068a4cbcf3dba2a176687c5565a1",
|
"reference": "e7f9306ec83c706b4dba451f6adfb865ce4688e4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -175,9 +175,9 @@
|
|||||||
"description": "Composer-based Psalm Phar",
|
"description": "Composer-based Psalm Phar",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/psalm/phar/issues",
|
"issues": "https://github.com/psalm/phar/issues",
|
||||||
"source": "https://github.com/psalm/phar/tree/5.19.1"
|
"source": "https://github.com/psalm/phar/tree/5.12.0"
|
||||||
},
|
},
|
||||||
"time": "2024-01-17T11:52:12+00:00"
|
"time": "2023-05-22T21:30:41+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/clock",
|
"name": "psr/clock",
|
||||||
@ -389,7 +389,7 @@
|
|||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.0"
|
"php": "7.4"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
36
js/plugin.js
36
js/plugin.js
@ -144,37 +144,15 @@ OC.Plugins.register('OCA.Files.FileList', OCA.Epubreader.Plugin);
|
|||||||
|
|
||||||
// FIXME: Hack for single public file view since it is not attached to the fileslist
|
// FIXME: Hack for single public file view since it is not attached to the fileslist
|
||||||
window.addEventListener('DOMContentLoaded', function () {
|
window.addEventListener('DOMContentLoaded', function () {
|
||||||
var supported_mimetypes = ['application/epub+zip', 'application/pdf', 'application/x-cbr'];
|
if ($('#isPublic').val()
|
||||||
if (!$('#isPublic').val() || !supported_mimetypes.includes($('#mimetype').val())
|
&& ($('#mimetype').val() === 'application/epub+zip'
|
||||||
|
|| $('#mimetype').val() === 'application/pdf'
|
||||||
|
|| $('#mimetype').val() === 'application/x-cbr')
|
||||||
) {
|
) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sharingToken = $('#sharingToken').val();
|
var sharingToken = $('#sharingToken').val();
|
||||||
var downloadUrl = OC.generateUrl('/s/{token}/download', {token: sharingToken});
|
var downloadUrl = OC.generateUrl('/s/{token}/download', {token: sharingToken});
|
||||||
|
var viewer = OCA.Epubreader.Plugin;
|
||||||
var content = $('#files-public-content');
|
|
||||||
var footerElmt = document.querySelector('body > footer') || document.querySelector('#app-content > footer')
|
|
||||||
var mainContent = document.querySelector('#content')
|
|
||||||
|
|
||||||
var mime = $('#mimetype').val();
|
var mime = $('#mimetype').val();
|
||||||
var viewerUrl = OC.generateUrl('/apps/epubreader/?file={file}&type={type}', {file: downloadUrl, type: mime});
|
viewer.show(downloadUrl, mime, false);
|
||||||
|
}
|
||||||
// Create viewer frame
|
|
||||||
const viewerNode = document.createElement('iframe')
|
|
||||||
viewerNode.style.height = '100%'
|
|
||||||
viewerNode.style.width = '100%'
|
|
||||||
viewerNode.style.position = 'absolute'
|
|
||||||
|
|
||||||
// Inject viewer
|
|
||||||
content.empty()
|
|
||||||
content.append(viewerNode)
|
|
||||||
viewerNode.src = viewerUrl
|
|
||||||
footerElmt.style.display = 'none'
|
|
||||||
mainContent.style.minHeight = 'calc(100% - var(--header-height))' // Make the viewer take the whole height as the footer is now hidden.
|
|
||||||
// overwrite style in order to fix the viewer on public pages
|
|
||||||
mainContent.style.marginLeft = '0'
|
|
||||||
mainContent.style.marginRight = '0'
|
|
||||||
mainContent.style.width = '100%'
|
|
||||||
mainContent.style.borderRadius = 'unset'
|
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud - Epubreader App.
|
* ownCloud - Epubreader App
|
||||||
*
|
*
|
||||||
* @author Frank de Lange
|
* @author Frank de Lange
|
||||||
* @copyright 2015 - 2017 Frank de Lange
|
* @copyright 2015 - 2017 Frank de Lange
|
||||||
@ -18,20 +18,17 @@ use OCP\Files\IRootFolder;
|
|||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
class Application extends App
|
class Application extends App {
|
||||||
{
|
|
||||||
public const APP_ID = 'epubreader';
|
public const APP_ID = 'epubreader';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
parent::__construct(self::APP_ID);
|
parent::__construct(self::APP_ID);
|
||||||
|
|
||||||
/** @psalm-suppress DeprecatedInterface */
|
/** @psalm-suppress DeprecatedInterface */
|
||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
|
|
||||||
/** @var IRootFolder $rootFolder */
|
/** @var IRootFolder $rootFolder */
|
||||||
$rootFolder = $container->get(IRootFolder::class);
|
$rootFolder = $container->get(IRootFolder::class);
|
||||||
|
|
||||||
/** @var IDBConnection $dbConnection */
|
/** @var IDBConnection $dbConnection */
|
||||||
$dbConnection = $container->get(IDBConnection::class);
|
$dbConnection = $container->get(IDBConnection::class);
|
||||||
$hooks = new Hooks($rootFolder, $dbConnection);
|
$hooks = new Hooks($rootFolder, $dbConnection);
|
||||||
|
@ -15,10 +15,15 @@ use OCP\AppFramework\Controller;
|
|||||||
use OCP\AppFramework\Http\JSONResponse;
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class BookmarkController extends Controller
|
class BookmarkController extends Controller {
|
||||||
{
|
|
||||||
private BookmarkService $bookmarkService;
|
private BookmarkService $bookmarkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $AppName
|
||||||
|
* @param IRequest $request
|
||||||
|
* @param BookmarkService $bookmarkService
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $AppName,
|
string $AppName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
@ -33,9 +38,12 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
* @param ?string $type
|
||||||
*/
|
*/
|
||||||
public function get(int $fileId, ?string $name = null, ?string $type = null): JSONResponse
|
public function get(int $fileId, ?string $name = null, ?string $type = null): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->bookmarkService->get($fileId, $name, $type));
|
return new JSONResponse($this->bookmarkService->get($fileId, $name, $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +52,14 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
* @param ?string $type
|
||||||
|
* @param ?string $content
|
||||||
*/
|
*/
|
||||||
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): JSONResponse
|
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->bookmarkService->set($fileId, $name, $value, $type, $content));
|
return new JSONResponse($this->bookmarkService->set($fileId, $name, $value, $type, $content));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,9 +68,10 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
*/
|
*/
|
||||||
public function getCursor(int $fileId): JSONResponse
|
public function getCursor(int $fileId): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->bookmarkService->getCursor($fileId));
|
return new JSONResponse($this->bookmarkService->getCursor($fileId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,9 +80,11 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setCursor(int $fileId, string $value): JSONResponse
|
public function setCursor(int $fileId, string $value): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->bookmarkService->setCursor($fileId, $value));
|
return new JSONResponse($this->bookmarkService->setCursor($fileId, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,9 +93,11 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string name
|
||||||
*/
|
*/
|
||||||
public function delete(int $fileId, string $name): void
|
public function delete(int $fileId, string $name): void {
|
||||||
{
|
|
||||||
$this->bookmarkService->delete($fileId, $name);
|
$this->bookmarkService->delete($fileId, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +106,10 @@ class BookmarkController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
*/
|
*/
|
||||||
public function deleteCursor(int $fileId): void
|
public function deleteCursor(int $fileId): void {
|
||||||
{
|
|
||||||
$this->bookmarkService->deleteCursor($fileId);
|
$this->bookmarkService->deleteCursor($fileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,15 @@ use OCP\AppFramework\Http\ContentSecurityPolicy;
|
|||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
use OCP\Files\Folder;
|
use OCP\Files\Folder;
|
||||||
|
use OCP\Files\InvalidPathException;
|
||||||
use OCP\Files\IRootFolder;
|
use OCP\Files\IRootFolder;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Share\IManager;
|
use OCP\Share\IManager;
|
||||||
|
|
||||||
class PageController extends Controller
|
class PageController extends Controller {
|
||||||
{
|
|
||||||
private IURLGenerator $urlGenerator;
|
private IURLGenerator $urlGenerator;
|
||||||
private IRootFolder $rootFolder;
|
private IRootFolder $rootFolder;
|
||||||
private IManager $shareManager;
|
private IManager $shareManager;
|
||||||
@ -32,6 +33,16 @@ class PageController extends Controller
|
|||||||
private BookmarkService $bookmarkService;
|
private BookmarkService $bookmarkService;
|
||||||
private PreferenceService $preferenceService;
|
private PreferenceService $preferenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $AppName
|
||||||
|
* @param IRequest $request
|
||||||
|
* @param IURLGenerator $urlGenerator
|
||||||
|
* @param IRootFolder $rootFolder
|
||||||
|
* @param IManager $shareManager
|
||||||
|
* @param string $UserId
|
||||||
|
* @param BookmarkService $bookmarkService
|
||||||
|
* @param PreferenceService $preferenceService
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $AppName,
|
string $AppName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
@ -55,17 +66,21 @@ class PageController extends Controller
|
|||||||
* @PublicPage
|
* @PublicPage
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function showReader(): TemplateResponse
|
public function showReader(): TemplateResponse {
|
||||||
{
|
|
||||||
$templates = [
|
$templates = [
|
||||||
'application/epub+zip' => 'epubreader',
|
'application/epub+zip' => 'epubreader',
|
||||||
'application/x-cbr' => 'cbreader',
|
'application/x-cbr' => 'cbreader',
|
||||||
'application/pdf' => 'pdfreader',
|
'application/pdf' => 'pdfreader'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array{
|
||||||
|
* fileId: int,
|
||||||
|
* fileName: string,
|
||||||
|
* fileType: string
|
||||||
|
* } $fileInfo
|
||||||
|
*/
|
||||||
$fileInfo = $this->getFileInfo((string) $this->request->getParam('file'));
|
$fileInfo = $this->getFileInfo((string) $this->request->getParam('file'));
|
||||||
|
|
||||||
/** @var int $fileId */
|
|
||||||
$fileId = $fileInfo['fileId'];
|
$fileId = $fileInfo['fileId'];
|
||||||
$type = (string) $this->request->getParam('type');
|
$type = (string) $this->request->getParam('type');
|
||||||
$scope = $template = $templates[$type];
|
$scope = $template = $templates[$type];
|
||||||
@ -81,7 +96,7 @@ class PageController extends Controller
|
|||||||
'defaults' => $this->toJson($this->preferenceService->getDefault($scope)),
|
'defaults' => $this->toJson($this->preferenceService->getDefault($scope)),
|
||||||
'preferences' => $this->toJson($this->preferenceService->get($scope, $fileId)),
|
'preferences' => $this->toJson($this->preferenceService->get($scope, $fileId)),
|
||||||
'metadata' => $this->toJson([]),
|
'metadata' => $this->toJson([]),
|
||||||
'annotations' => $this->toJson($this->bookmarkService->get($fileId)),
|
'annotations' => $this->toJson($this->bookmarkService->get($fileId))
|
||||||
];
|
];
|
||||||
|
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
@ -108,20 +123,19 @@ class PageController extends Controller
|
|||||||
*
|
*
|
||||||
* @param string $path path-fragment from url
|
* @param string $path path-fragment from url
|
||||||
*
|
*
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException|InvalidPathException
|
||||||
*/
|
*/
|
||||||
private function getFileInfo(string $path): array
|
private function getFileInfo(string $path): array {
|
||||||
{
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$shareToken = preg_replace('/(?:\\/index\\.php)?\\/s\\/([A-Za-z0-9]{15,32})\\/download.*/', '$1', $path, 1, $count);
|
$shareToken = preg_replace("/(?:\/index\.php)?\/s\/([A-Za-z0-9]{15,32})\/download.*/", "$1", $path, 1, $count);
|
||||||
|
|
||||||
if (1 === $count) {
|
if ($count === 1) {
|
||||||
/* shared file or directory */
|
/* shared file or directory */
|
||||||
$node = $this->shareManager->getShareByToken($shareToken)->getNode();
|
$node = $this->shareManager->getShareByToken($shareToken)->getNode();
|
||||||
$type = $node->getType();
|
$type = $node->getType();
|
||||||
|
|
||||||
/* shared directory, need file path to continue, */
|
/* shared directory, need file path to continue, */
|
||||||
if (FileInfo::TYPE_FOLDER == $type && $node instanceof Folder) {
|
if ($type == FileInfo::TYPE_FOLDER && $node instanceof Folder) {
|
||||||
$query = [];
|
$query = [];
|
||||||
parse_str(parse_url($path, PHP_URL_QUERY), $query);
|
parse_str(parse_url($path, PHP_URL_QUERY), $query);
|
||||||
if (isset($query['path']) && is_string($query['path'])) {
|
if (isset($query['path']) && is_string($query['path'])) {
|
||||||
@ -137,22 +151,26 @@ class PageController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$filePath = $path;
|
$filePath = $path;
|
||||||
$fileId = $this->rootFolder->getUserFolder($this->userId)
|
$fileId = $this->rootFolder->getUserFolder($this->userId)
|
||||||
->get(preg_replace('/.*\\/remote.php\\/webdav(.*)/', '$1', rawurldecode((string) $this->request->getParam('file'))))
|
->get(preg_replace("/.*\/remote.php\/webdav(.*)/", "$1", rawurldecode((string) $this->request->getParam('file'))))
|
||||||
->getId()
|
->getId();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pathInfo = pathinfo($filePath);
|
$pathInfo = pathInfo($filePath);
|
||||||
|
if (!is_array($pathInfo)) {
|
||||||
|
throw new InvalidPathException("Can not get info for $filePath");
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'fileName' => $pathInfo['filename'],
|
'fileName' => $pathInfo['filename'],
|
||||||
'fileType' => strtolower($pathInfo['extension'] ?? ''),
|
'fileType' => strtolower($pathInfo['extension'] ?? ''),
|
||||||
'fileId' => $fileId,
|
'fileId' => $fileId
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,15 @@ use OCP\AppFramework\Controller;
|
|||||||
use OCP\AppFramework\Http\JSONResponse;
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class PreferenceController extends Controller
|
class PreferenceController extends Controller {
|
||||||
{
|
|
||||||
private PreferenceService $preferenceService;
|
private PreferenceService $preferenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $AppName
|
||||||
|
* @param IRequest $request
|
||||||
|
* @param PreferenceService $preferenceService
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $AppName,
|
string $AppName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
@ -34,10 +39,11 @@ class PreferenceController extends Controller
|
|||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
* @param ?string $name if null, return all preferences for $scope + $fileId
|
* @param ?string $name if null, return all preferences for $scope + $fileId
|
||||||
*/
|
*/
|
||||||
public function get(string $scope, int $fileId, ?string $name = null): JSONResponse
|
public function get(string $scope, int $fileId, ?string $name = null): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->preferenceService->get($scope, $fileId, $name));
|
return new JSONResponse($this->preferenceService->get($scope, $fileId, $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,22 +52,27 @@ class PreferenceController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function set(string $scope, int $fileId, string $name, string $value): JSONResponse
|
public function set(string $scope, int $fileId, string $name, string $value): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->preferenceService->set($scope, $fileId, $name, $value));
|
return new JSONResponse($this->preferenceService->set($scope, $fileId, $name, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief return default preference
|
* @brief return default preference
|
||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*
|
*
|
||||||
|
* @param string $scope
|
||||||
* @param string $name if null, return all default preferences for scope
|
* @param string $name if null, return all default preferences for scope
|
||||||
*/
|
*/
|
||||||
public function getDefault(string $scope, string $name): JSONResponse
|
public function getDefault(string $scope, string $name): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->preferenceService->getDefault($scope, $name));
|
return new JSONResponse($this->preferenceService->getDefault($scope, $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,25 +81,33 @@ class PreferenceController extends Controller
|
|||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setDefault(string $scope, string $name, string $value): JSONResponse
|
public function setDefault(string $scope, string $name, string $value): JSONResponse {
|
||||||
{
|
|
||||||
return new JSONResponse($this->preferenceService->setDefault($scope, $name, $value));
|
return new JSONResponse($this->preferenceService->setDefault($scope, $name, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete preference
|
* @brief delete preference
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function delete(string $scope, int $fileId, string $name): void
|
public function delete(string $scope, int $fileId, string $name): void {
|
||||||
{
|
|
||||||
$this->preferenceService->delete($scope, $fileId, $name);
|
$this->preferenceService->delete($scope, $fileId, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete default preference
|
* @brief delete default preference
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function deleteDefault(string $scope, string $name): void
|
public function deleteDefault(string $scope, string $name): void {
|
||||||
{
|
|
||||||
$this->preferenceService->deleteDefault($scope, $name);
|
$this->preferenceService->deleteDefault($scope, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud - Epubreader App.
|
* ownCloud - Epubreader App
|
||||||
*
|
*
|
||||||
* @author Frank de Lange
|
* @author Frank de Lange
|
||||||
* @copyright 2014,2018 Frank de Lange
|
* @copyright 2014,2018 Frank de Lange
|
||||||
@ -19,8 +19,8 @@ use OCP\IConfig;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class SettingsController extends Controller
|
class SettingsController extends Controller {
|
||||||
{
|
|
||||||
private string $userId;
|
private string $userId;
|
||||||
private IL10N $l10n;
|
private IL10N $l10n;
|
||||||
private IConfig $configManager;
|
private IConfig $configManager;
|
||||||
@ -42,16 +42,19 @@ class SettingsController extends Controller
|
|||||||
* @brief set preference for file type association
|
* @brief set preference for file type association
|
||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
|
*
|
||||||
|
* @param string $EpubEnable
|
||||||
|
* @param string $PdfEnable
|
||||||
|
* @param string $CbxEnable
|
||||||
*/
|
*/
|
||||||
public function setPreference(string $EpubEnable, string $PdfEnable, string $CbxEnable): JSONResponse
|
public function setPreference(string $EpubEnable, string $PdfEnable, string $CbxEnable): JSONResponse {
|
||||||
{
|
|
||||||
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'epub_enable', $EpubEnable);
|
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'epub_enable', $EpubEnable);
|
||||||
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'pdf_enable', $PdfEnable);
|
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'pdf_enable', $PdfEnable);
|
||||||
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'cbx_enable', $CbxEnable);
|
$this->configManager->setUserValue($this->userId, Application::APP_ID, 'cbx_enable', $CbxEnable);
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'data' => ['message' => $this->l10n->t('Settings updated successfully.')],
|
'data' => ['message' => $this->l10n->t('Settings updated successfully.')],
|
||||||
'status' => 'success',
|
'status' => 'success'
|
||||||
];
|
];
|
||||||
|
|
||||||
return new JSONResponse($response);
|
return new JSONResponse($response);
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
namespace OCA\Epubreader\Db;
|
namespace OCA\Epubreader\Db;
|
||||||
|
|
||||||
class Bookmark extends ReaderEntity implements \JsonSerializable
|
class Bookmark extends ReaderEntity implements \JsonSerializable {
|
||||||
{
|
|
||||||
protected string $userId; // user
|
protected string $userId; // user
|
||||||
protected int $fileId; // book (identified by fileId) for which this mark is valid
|
protected int $fileId; // book (identified by fileId) for which this mark is valid
|
||||||
protected string $type; // type, defaults to "bookmark"
|
protected string $type; // type, defaults to "bookmark"
|
||||||
@ -19,8 +19,7 @@ class Bookmark extends ReaderEntity implements \JsonSerializable
|
|||||||
protected string $value; // bookmark value (format-specific, eg. page number for PDF, CFI for epub, etc)
|
protected string $value; // bookmark value (format-specific, eg. page number for PDF, CFI for epub, etc)
|
||||||
protected string $content; // bookmark content (annotations etc), can be empty
|
protected string $content; // bookmark content (annotations etc), can be empty
|
||||||
|
|
||||||
public function jsonSerialize(): array
|
public function jsonSerialize(): array {
|
||||||
{
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->getId(),
|
'id' => $this->getId(),
|
||||||
'userId' => $this->getUserId(),
|
'userId' => $this->getUserId(),
|
||||||
@ -29,12 +28,11 @@ class Bookmark extends ReaderEntity implements \JsonSerializable
|
|||||||
'name' => $this->getName(),
|
'name' => $this->getName(),
|
||||||
'value' => $this->conditional_json_decode($this->getValue()),
|
'value' => $this->conditional_json_decode($this->getValue()),
|
||||||
'content' => $this->conditional_json_decode($this->getContent()),
|
'content' => $this->conditional_json_decode($this->getContent()),
|
||||||
'lastModified' => $this->getLastModified(),
|
'lastModified' => $this->getLastModified()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toService(): array
|
public function toService(): array {
|
||||||
{
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->getName(),
|
'name' => $this->getName(),
|
||||||
'type' => $this->getType(),
|
'type' => $this->getType(),
|
||||||
@ -44,68 +42,56 @@ class Bookmark extends ReaderEntity implements \JsonSerializable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserId(): string
|
public function getUserId(): string {
|
||||||
{
|
|
||||||
return $this->userId;
|
return $this->userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUserId(string $userId): void
|
public function setUserId(string $userId): void {
|
||||||
{
|
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->markFieldUpdated('userId');
|
$this->markFieldUpdated('userId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileId(): int
|
public function getFileId(): int {
|
||||||
{
|
|
||||||
return $this->fileId;
|
return $this->fileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFileId(int $fileId): void
|
public function setFileId(int $fileId): void {
|
||||||
{
|
|
||||||
$this->fileId = $fileId;
|
$this->fileId = $fileId;
|
||||||
$this->markFieldUpdated('fileId');
|
$this->markFieldUpdated('fileId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string {
|
||||||
{
|
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setType(string $type): void
|
public function setType(string $type): void {
|
||||||
{
|
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->markFieldUpdated('type');
|
$this->markFieldUpdated('type');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string {
|
||||||
{
|
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setName(string $name): void
|
public function setName(string $name): void {
|
||||||
{
|
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->markFieldUpdated('name');
|
$this->markFieldUpdated('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValue(): string
|
public function getValue(): string {
|
||||||
{
|
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue(string $value): void
|
public function setValue(string $value): void {
|
||||||
{
|
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
$this->markFieldUpdated('value');
|
$this->markFieldUpdated('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContent(): string
|
public function getContent(): string {
|
||||||
{
|
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setContent(string $content): void
|
public function setContent(string $content): void {
|
||||||
{
|
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
$this->markFieldUpdated('content');
|
$this->markFieldUpdated('content');
|
||||||
}
|
}
|
||||||
|
@ -13,35 +13,40 @@ namespace OCA\Epubreader\Db;
|
|||||||
use OCA\Epubreader\Utility\Time;
|
use OCA\Epubreader\Utility\Time;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
class BookmarkMapper extends ReaderMapper
|
class BookmarkMapper extends ReaderMapper {
|
||||||
{
|
|
||||||
private string $userId;
|
private string $userId;
|
||||||
|
|
||||||
public function __construct(IDBConnection $db, string $UserId, Time $time)
|
/**
|
||||||
{
|
* @param IDbConnection $db
|
||||||
|
* @param string $UserId
|
||||||
|
* @param Time $time
|
||||||
|
*/
|
||||||
|
public function __construct(IDBConnection $db, string $UserId, Time $time) {
|
||||||
parent::__construct($db, 'reader_bookmarks', Bookmark::class, $time);
|
parent::__construct($db, 'reader_bookmarks', Bookmark::class, $time);
|
||||||
$this->userId = $UserId;
|
$this->userId = $UserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get bookmarks for $fileId+$userId(+$name)
|
* @brief get bookmarks for $fileId+$userId(+$name)
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
* @param ?string $type
|
||||||
*
|
*
|
||||||
* @return ReaderEntity[]
|
* @return ReaderEntity[]
|
||||||
*/
|
*/
|
||||||
public function get(int $fileId, ?string $name = null, ?string $type = null): array
|
public function get(int $fileId, ?string $name = null, ?string $type = null): array {
|
||||||
{
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->select('*')
|
$query->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
->where($query->expr()->eq('file_id', $query->createNamedParameter($fileId)))
|
->where($query->expr()->eq('file_id', $query->createNamedParameter($fileId)))
|
||||||
->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($this->userId)))
|
->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($this->userId)));
|
||||||
;
|
|
||||||
|
|
||||||
if (null !== $type) {
|
if ($type !== null) {
|
||||||
$query->andWhere($query->expr()->eq('type', $query->createNamedParameter($type)));
|
$query->andWhere($query->expr()->eq('type', $query->createNamedParameter($type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $name) {
|
if ($name !== null) {
|
||||||
$query->andWhere($query->expr()->eq('name', $query->createNamedParameter($name)));
|
$query->andWhere($query->expr()->eq('name', $query->createNamedParameter($name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +56,15 @@ class BookmarkMapper extends ReaderMapper
|
|||||||
/**
|
/**
|
||||||
* @brief write bookmark to database
|
* @brief write bookmark to database
|
||||||
*
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
* @param ?string $type
|
||||||
|
* @param ?string $content
|
||||||
|
*
|
||||||
* @return ReaderEntity the newly created or updated bookmark
|
* @return ReaderEntity the newly created or updated bookmark
|
||||||
*/
|
*/
|
||||||
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity
|
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
||||||
{
|
|
||||||
$result = $this->get($fileId, $name);
|
$result = $this->get($fileId, $name);
|
||||||
|
|
||||||
if(empty($result)) {
|
if(empty($result)) {
|
||||||
@ -65,7 +75,7 @@ class BookmarkMapper extends ReaderMapper
|
|||||||
|
|
||||||
// default type is "bookmark"
|
// default type is "bookmark"
|
||||||
if (null === $type) {
|
if (null === $type) {
|
||||||
$type = 'bookmark';
|
$type = "bookmark";
|
||||||
}
|
}
|
||||||
|
|
||||||
$bookmark = new Bookmark();
|
$bookmark = new Bookmark();
|
||||||
|
@ -10,16 +10,15 @@
|
|||||||
|
|
||||||
namespace OCA\Epubreader\Db;
|
namespace OCA\Epubreader\Db;
|
||||||
|
|
||||||
class Preference extends ReaderEntity implements \JsonSerializable
|
class Preference extends ReaderEntity implements \JsonSerializable {
|
||||||
{
|
|
||||||
protected string $userId; // user for whom this preference is valid
|
protected string $userId; // user for whom this preference is valid
|
||||||
protected string $scope; // scope (default or specific renderer)
|
protected string $scope; // scope (default or specific renderer)
|
||||||
protected int $fileId; // file for which this preference is set
|
protected int $fileId; // file for which this preference is set
|
||||||
protected string $name; // preference name
|
protected string $name; // preference name
|
||||||
protected string $value; // preference value
|
protected string $value; // preference value
|
||||||
|
|
||||||
public function jsonSerialize(): array
|
public function jsonSerialize(): array {
|
||||||
{
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->getId(),
|
'id' => $this->getId(),
|
||||||
'scope' => $this->getScope(),
|
'scope' => $this->getScope(),
|
||||||
@ -30,65 +29,54 @@ class Preference extends ReaderEntity implements \JsonSerializable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toService(): array
|
public function toService(): array {
|
||||||
{
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->getName(),
|
'name' => $this->getName(),
|
||||||
'value' => $this->conditional_json_decode($this->getValue()),
|
'value' => $this->conditional_json_decode($this->getValue()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserId(): string
|
public function getUserId(): string {
|
||||||
{
|
|
||||||
return $this->userId;
|
return $this->userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUserId(string $userId): void
|
public function setUserId(string $userId): void {
|
||||||
{
|
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->markFieldUpdated('userId');
|
$this->markFieldUpdated('userId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getScope(): string
|
public function getScope(): string {
|
||||||
{
|
|
||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setScope(string $scope): void
|
public function setScope(string $scope): void {
|
||||||
{
|
|
||||||
$this->scope = $scope;
|
$this->scope = $scope;
|
||||||
$this->markFieldUpdated('scope');
|
$this->markFieldUpdated('scope');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileId(): int
|
public function getFileId(): int {
|
||||||
{
|
|
||||||
return $this->fileId;
|
return $this->fileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFileId(int $fileId): void
|
public function setFileId(int $fileId): void {
|
||||||
{
|
|
||||||
$this->fileId = $fileId;
|
$this->fileId = $fileId;
|
||||||
$this->markFieldUpdated('fileId');
|
$this->markFieldUpdated('fileId');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string {
|
||||||
{
|
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setName(string $name): void
|
public function setName(string $name): void {
|
||||||
{
|
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->markFieldUpdated('name');
|
$this->markFieldUpdated('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValue(): string
|
public function getValue(): string {
|
||||||
{
|
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue(string $value): void
|
public function setValue(string $value): void {
|
||||||
{
|
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
$this->markFieldUpdated('value');
|
$this->markFieldUpdated('value');
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,11 @@ namespace OCA\Epubreader\Db;
|
|||||||
use OCA\Epubreader\Utility\Time;
|
use OCA\Epubreader\Utility\Time;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
class PreferenceMapper extends ReaderMapper
|
class PreferenceMapper extends ReaderMapper {
|
||||||
{
|
|
||||||
private string $userId;
|
private string $userId;
|
||||||
|
|
||||||
public function __construct(IDBConnection $db, string $UserId, Time $time)
|
public function __construct(IDBConnection $db, string $UserId, Time $time) {
|
||||||
{
|
|
||||||
parent::__construct($db, 'reader_prefs', Preference::class, $time);
|
parent::__construct($db, 'reader_prefs', Preference::class, $time);
|
||||||
$this->userId = $UserId;
|
$this->userId = $UserId;
|
||||||
}
|
}
|
||||||
@ -26,17 +25,19 @@ class PreferenceMapper extends ReaderMapper
|
|||||||
/**
|
/**
|
||||||
* @brief get preferences for $scope+$fileId+$userId(+$name)
|
* @brief get preferences for $scope+$fileId+$userId(+$name)
|
||||||
*
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
*
|
||||||
* @return ReaderEntity[]
|
* @return ReaderEntity[]
|
||||||
*/
|
*/
|
||||||
public function get(string $scope, int $fileId, ?string $name = null): array
|
public function get(string $scope, int $fileId, ?string $name = null): array {
|
||||||
{
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->select('*')
|
$query->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
->where($query->expr()->eq('scope', $query->createNamedParameter($scope)))
|
->where($query->expr()->eq('scope', $query->createNamedParameter($scope)))
|
||||||
->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId)))
|
->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId)))
|
||||||
->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($this->userId)))
|
->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($this->userId)));
|
||||||
;
|
|
||||||
|
|
||||||
if (!empty($name)) {
|
if (!empty($name)) {
|
||||||
$query->andWhere($query->expr()->eq('name', $query->createNamedParameter($name)));
|
$query->andWhere($query->expr()->eq('name', $query->createNamedParameter($name)));
|
||||||
@ -48,10 +49,14 @@ class PreferenceMapper extends ReaderMapper
|
|||||||
/**
|
/**
|
||||||
* @brief write preference to database
|
* @brief write preference to database
|
||||||
*
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
* @return ReaderEntity the newly created or updated preference
|
* @return ReaderEntity the newly created or updated preference
|
||||||
*/
|
*/
|
||||||
public function set(string $scope, int $fileId, string $name, string $value): ReaderEntity
|
public function set(string $scope, int $fileId, string $name, string $value): ReaderEntity {
|
||||||
{
|
|
||||||
$result = $this->get($scope, $fileId, $name);
|
$result = $this->get($scope, $fileId, $name);
|
||||||
|
|
||||||
if(empty($result)) {
|
if(empty($result)) {
|
||||||
|
@ -15,44 +15,41 @@ use OCP\AppFramework\Db\Entity;
|
|||||||
/**
|
/**
|
||||||
* @psalm-type SerializedEntity = array<string|int|array>
|
* @psalm-type SerializedEntity = array<string|int|array>
|
||||||
*/
|
*/
|
||||||
abstract class ReaderEntity extends Entity
|
abstract class ReaderEntity extends Entity {
|
||||||
{
|
|
||||||
protected int $lastModified; // modification timestamp
|
protected int $lastModified; // modification timestamp
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns decoded json if input is json, otherwise returns input.
|
* returns decoded json if input is json, otherwise returns input
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return string|array
|
||||||
*/
|
*/
|
||||||
public function conditional_json_decode(string $el): mixed
|
public function conditional_json_decode(string $el) {
|
||||||
{
|
|
||||||
/** @var array $result */
|
/** @var array $result */
|
||||||
$result = json_decode($el);
|
$result = json_decode($el);
|
||||||
if (JSON_ERROR_NONE === json_last_error()) {
|
if (json_last_error() === JSON_ERROR_NONE) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
return $el;
|
return $el;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getLastModified(): int
|
public function getLastModified(): int {
|
||||||
{
|
|
||||||
return $this->lastModified;
|
return $this->lastModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastModified(int $lastModified): void
|
public function setLastModified(int $lastModified): void {
|
||||||
{
|
|
||||||
$this->lastModified = $lastModified;
|
$this->lastModified = $lastModified;
|
||||||
$this->markFieldUpdated('lastModified');
|
$this->markFieldUpdated('lastModified');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SerializedEntity
|
* @psalm-return SerializedEntity
|
||||||
*/
|
*/
|
||||||
abstract public function toService(): array;
|
abstract public function toService(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SerializedEntity
|
* @psalm-return SerializedEntity
|
||||||
*/
|
*/
|
||||||
abstract public function jsonSerialize(): array;
|
abstract public function jsonSerialize(): array;
|
||||||
}
|
}
|
||||||
|
@ -18,32 +18,28 @@ use OCP\IDBConnection;
|
|||||||
/**
|
/**
|
||||||
* @template-extends QBMapper<ReaderEntity>
|
* @template-extends QBMapper<ReaderEntity>
|
||||||
*/
|
*/
|
||||||
abstract class ReaderMapper extends QBMapper
|
abstract class ReaderMapper extends QBMapper {
|
||||||
{
|
|
||||||
private Time $time;
|
private Time $time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IDBConnection $db Instance of the Db abstraction layer
|
* @param IDBConnection $db Instance of the Db abstraction layer
|
||||||
* @param string $table the name of the table. set this to allow entity
|
* @param string $table the name of the table. set this to allow entity
|
||||||
* @param class-string<ReaderEntity> $entity the name of the entity that the sql should be mapped to queries without using sql
|
* @param class-string<ReaderEntity> $entity the name of the entity that the sql should be mapped to queries without using sql
|
||||||
|
* @param Time $time
|
||||||
*/
|
*/
|
||||||
public function __construct(IDBConnection $db, string $table, string $entity, Time $time)
|
public function __construct(IDBConnection $db, string $table, string $entity, Time $time) {
|
||||||
{
|
|
||||||
parent::__construct($db, $table, $entity);
|
parent::__construct($db, $table, $entity);
|
||||||
$this->time = $time;
|
$this->time = $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Entity $entity): Entity
|
public function update(Entity $entity): Entity {
|
||||||
{
|
|
||||||
$entity->setLastModified($this->time->getMicroTime());
|
$entity->setLastModified($this->time->getMicroTime());
|
||||||
|
|
||||||
return parent::update($entity);
|
return parent::update($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insert(Entity $entity): Entity
|
public function insert(Entity $entity): Entity {
|
||||||
{
|
|
||||||
$entity->setLastModified($this->time->getMicroTime());
|
$entity->setLastModified($this->time->getMicroTime());
|
||||||
|
|
||||||
return parent::insert($entity);
|
return parent::insert($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,27 +11,25 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
private IRootFolder $rootFolder;
|
private IRootFolder $rootFolder;
|
||||||
private IDBConnection $dbConnection;
|
private IDBConnection $dbConnection;
|
||||||
|
|
||||||
public function __construct(IRootFolder $rootFolder, IDBConnection $dbConnection)
|
public function __construct(IRootFolder $rootFolder, IDBConnection $dbConnection) {
|
||||||
{
|
|
||||||
$this->rootFolder = $rootFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
$this->dbConnection = $dbConnection;
|
$this->dbConnection = $dbConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(): void
|
public function register(): void {
|
||||||
{
|
|
||||||
$this->rootFolder->listen('\OC\Files', 'preDelete', function (Node $node) {
|
$this->rootFolder->listen('\OC\Files', 'preDelete', function (Node $node) {
|
||||||
$this->deleteFile($node->getId());
|
$this->deleteFile($node->getId());
|
||||||
});
|
});
|
||||||
@ -41,30 +39,27 @@ class Hooks
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function announce_settings(array $settings): void
|
public static function announce_settings(array $settings): void {
|
||||||
{
|
|
||||||
// Nextcloud encodes this as JSON, Owncloud does not (yet) (#75)
|
// Nextcloud encodes this as JSON, Owncloud does not (yet) (#75)
|
||||||
// TODO: remove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties
|
// TODO: remove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties
|
||||||
if (is_array($settings['array'])
|
$user = Server::get(IUserSession::class)->getUser();
|
||||||
&& array_key_exists('oc_appconfig', $settings['array'])
|
if ($user &&
|
||||||
|
is_array($settings['array']) &&
|
||||||
|
array_key_exists('oc_appconfig', $settings['array'])
|
||||||
) {
|
) {
|
||||||
$isJson = self::isJson($settings['array']['oc_appconfig']);
|
$isJson = self::isJson($settings['array']['oc_appconfig']);
|
||||||
$user = Server::get(IUserSession::class)->getUser();
|
|
||||||
$userId = $user ? $user->getUID() : null;
|
|
||||||
|
|
||||||
/** @var array $array */
|
/** @var array $array */
|
||||||
$array = ($isJson) ? json_decode((string) $settings['array']['oc_appconfig'], true) : $settings['array']['oc_appconfig'];
|
$array = ($isJson) ? json_decode((string) $settings['array']['oc_appconfig'], true) : $settings['array']['oc_appconfig'];
|
||||||
$array['filesReader'] = [
|
$array['filesReader'] = [
|
||||||
'enableEpub' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'epub_enable', true),
|
'enableEpub' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'epub_enable', true),
|
||||||
'enablePdf' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'pdf_enable', true),
|
'enablePdf' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'pdf_enable', true),
|
||||||
'enableCbx' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'cbx_enable', true),
|
'enableCbx' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'cbx_enable', true),
|
||||||
];
|
];
|
||||||
$settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array;
|
$settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function deleteFile(int $fileId): void
|
protected function deleteFile(int $fileId): void {
|
||||||
{
|
|
||||||
$queryBuilder = $this->dbConnection->getQueryBuilder();
|
$queryBuilder = $this->dbConnection->getQueryBuilder();
|
||||||
$queryBuilder->delete('reader_bookmarks')->where('file_id = file_id')->setParameter('file_id', $fileId);
|
$queryBuilder->delete('reader_bookmarks')->where('file_id = file_id')->setParameter('file_id', $fileId);
|
||||||
$queryBuilder->executeStatement();
|
$queryBuilder->executeStatement();
|
||||||
@ -74,8 +69,7 @@ class Hooks
|
|||||||
$queryBuilder->executeStatement();
|
$queryBuilder->executeStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function deleteUser(string $userId): void
|
protected function deleteUser(string $userId): void {
|
||||||
{
|
|
||||||
$queryBuilder = $this->dbConnection->getQueryBuilder();
|
$queryBuilder = $this->dbConnection->getQueryBuilder();
|
||||||
$queryBuilder->delete('reader_bookmarks')->where('user_id = user_id')->setParameter('user_id', $userId);
|
$queryBuilder->delete('reader_bookmarks')->where('user_id = user_id')->setParameter('user_id', $userId);
|
||||||
$queryBuilder->executeStatement();
|
$queryBuilder->executeStatement();
|
||||||
@ -85,8 +79,10 @@ class Hooks
|
|||||||
$queryBuilder->executeStatement();
|
$queryBuilder->executeStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function isJson(mixed $string): bool
|
/**
|
||||||
{
|
* @param mixed $string
|
||||||
return is_string($string) && is_array(json_decode($string, true)) && JSON_ERROR_NONE == json_last_error();
|
*/
|
||||||
|
private static function isJson($string): bool {
|
||||||
|
return is_string($string) && is_array(json_decode($string, true)) && json_last_error() == JSON_ERROR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,27 +4,30 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Epubreader\Migration;
|
namespace OCA\Epubreader\Migration;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use OCP\DB\ISchemaWrapper;
|
use OCP\DB\ISchemaWrapper;
|
||||||
use OCP\Migration\IOutput;
|
use OCP\Migration\IOutput;
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-generated migration step.
|
* Auto-generated migration step
|
||||||
*/
|
*/
|
||||||
class Version010404Date20201030180941 extends SimpleMigrationStep
|
class Version010404Date20201030180941 extends SimpleMigrationStep {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options): ?ISchemaWrapper
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||||
{
|
|
||||||
/** @var ISchemaWrapper $schema */
|
/** @var ISchemaWrapper $schema */
|
||||||
$schema = $schemaClosure();
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
@ -126,14 +129,14 @@ class Version010404Date20201030180941 extends SimpleMigrationStep
|
|||||||
$table->addIndex(['user_id'], 'reader_prefs_user_id_index');
|
$table->addIndex(['user_id'], 'reader_prefs_user_id_index');
|
||||||
$table->addIndex(['scope'], 'reader_prefs_scope_index');
|
$table->addIndex(['scope'], 'reader_prefs_scope_index');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,15 @@ use OCA\Epubreader\Db\ReaderEntity;
|
|||||||
/**
|
/**
|
||||||
* @psalm-import-type SerializedEntity from ReaderEntity
|
* @psalm-import-type SerializedEntity from ReaderEntity
|
||||||
*/
|
*/
|
||||||
class BookmarkService extends Service
|
class BookmarkService extends Service {
|
||||||
{
|
|
||||||
// "bookmark" name to use for the cursor (current reading position)
|
// "bookmark" name to use for the cursor (current reading position)
|
||||||
private const CURSOR = '__CURSOR__';
|
private const CURSOR = '__CURSOR__';
|
||||||
private const BOOKMARK_TYPE = 'bookmark';
|
private const BOOKMARK_TYPE = 'bookmark';
|
||||||
|
|
||||||
private BookmarkMapper $bookmarkMapper;
|
private BookmarkMapper $bookmarkMapper;
|
||||||
|
|
||||||
public function __construct(BookmarkMapper $bookmarkMapper)
|
public function __construct(BookmarkMapper $bookmarkMapper) {
|
||||||
{
|
|
||||||
parent::__construct($bookmarkMapper);
|
parent::__construct($bookmarkMapper);
|
||||||
$this->bookmarkMapper = $bookmarkMapper;
|
$this->bookmarkMapper = $bookmarkMapper;
|
||||||
}
|
}
|
||||||
@ -35,58 +34,68 @@ class BookmarkService extends Service
|
|||||||
*
|
*
|
||||||
* bookmark type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
* bookmark type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
||||||
*
|
*
|
||||||
* @return SerializedEntity[]
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
* @param ?string $type
|
||||||
|
*
|
||||||
|
* @psalm-return SerializedEntity[]
|
||||||
*/
|
*/
|
||||||
public function get(int $fileId, ?string $name = null, ?string $type = null): array
|
public function get($fileId, ?string $name = null, ?string $type = null): array {
|
||||||
{
|
|
||||||
$result = $this->bookmarkMapper->get($fileId, $name, $type);
|
$result = $this->bookmarkMapper->get($fileId, $name, $type);
|
||||||
|
|
||||||
return array_map(
|
return array_map(
|
||||||
function (ReaderEntity $entity): array {
|
function (ReaderEntity $entity): array {
|
||||||
return $entity->toService();
|
return $entity->toService();
|
||||||
},
|
}, $result);
|
||||||
$result
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief write bookmark
|
* @brief write bookmark
|
||||||
*
|
*
|
||||||
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
* @param ?string $type
|
||||||
|
* @param ?string $content
|
||||||
*/
|
*/
|
||||||
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity
|
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
||||||
{
|
|
||||||
return $this->bookmarkMapper->set($fileId, $name, $value, $type, $content);
|
return $this->bookmarkMapper->set($fileId, $name, $value, $type, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get cursor (current position in book)
|
* @brief get cursor (current position in book)
|
||||||
*
|
*
|
||||||
* @return SerializedEntity
|
* @param int $fileId
|
||||||
|
*
|
||||||
|
* @psalm-return SerializedEntity
|
||||||
*/
|
*/
|
||||||
public function getCursor(int $fileId): array
|
public function getCursor(int $fileId): array {
|
||||||
{
|
|
||||||
$result = $this->get($fileId, self::CURSOR);
|
$result = $this->get($fileId, self::CURSOR);
|
||||||
if (1 === count($result)) {
|
if (count($result) === 1) {
|
||||||
return $result[0];
|
return $result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set cursor (current position in book)
|
* @brief set cursor (current position in book)
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setCursor(int $fileId, string $value): ReaderEntity
|
public function setCursor(int $fileId, string $value): ReaderEntity {
|
||||||
{
|
|
||||||
return $this->bookmarkMapper->set($fileId, self::CURSOR, $value, self::BOOKMARK_TYPE);
|
return $this->bookmarkMapper->set($fileId, self::CURSOR, $value, self::BOOKMARK_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete bookmark
|
* @brief delete bookmark
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
* @param ?string $type
|
||||||
*/
|
*/
|
||||||
public function delete(int $fileId, ?string $name = null, ?string $type = null): void
|
public function delete($fileId, ?string $name = null, ?string $type = null): void {
|
||||||
{
|
|
||||||
foreach ($this->bookmarkMapper->get($fileId, $name, $type) as $bookmark) {
|
foreach ($this->bookmarkMapper->get($fileId, $name, $type) as $bookmark) {
|
||||||
$this->bookmarkMapper->delete($bookmark);
|
$this->bookmarkMapper->delete($bookmark);
|
||||||
}
|
}
|
||||||
@ -94,9 +103,10 @@ class BookmarkService extends Service
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete cursor
|
* @brief delete cursor
|
||||||
|
*
|
||||||
|
* @param int $fileId
|
||||||
*/
|
*/
|
||||||
public function deleteCursor(int $fileId): void
|
public function deleteCursor(int $fileId): void {
|
||||||
{
|
|
||||||
$this->delete($fileId, self::CURSOR, self::BOOKMARK_TYPE);
|
$this->delete($fileId, self::CURSOR, self::BOOKMARK_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,18 @@ use OCA\Epubreader\Db\ReaderEntity;
|
|||||||
/**
|
/**
|
||||||
* @psalm-import-type SerializedEntity from ReaderEntity
|
* @psalm-import-type SerializedEntity from ReaderEntity
|
||||||
*/
|
*/
|
||||||
class PreferenceService extends Service
|
class PreferenceService extends Service {
|
||||||
{
|
|
||||||
// (ab)use the fact that $fileId never goes below 1 by using the
|
// (ab)use the fact that $fileId never goes below 1 by using the
|
||||||
// value 0 to indicate a default preference
|
// value 0 to indicate a default preference
|
||||||
private const DEFAULTS = 0;
|
private const DEFAULTS = 0;
|
||||||
|
|
||||||
private PreferenceMapper $preferenceMapper;
|
private PreferenceMapper $preferenceMapper;
|
||||||
|
|
||||||
public function __construct(PreferenceMapper $preferenceMapper)
|
/**
|
||||||
{
|
* @param PreferenceMapper $preferenceMapper
|
||||||
|
*/
|
||||||
|
public function __construct(PreferenceMapper $preferenceMapper) {
|
||||||
parent::__construct($preferenceMapper);
|
parent::__construct($preferenceMapper);
|
||||||
$this->preferenceMapper = $preferenceMapper;
|
$this->preferenceMapper = $preferenceMapper;
|
||||||
}
|
}
|
||||||
@ -36,18 +38,18 @@ class PreferenceService extends Service
|
|||||||
* scope identifies preference source, i.e. which renderer the preference applies to
|
* scope identifies preference source, i.e. which renderer the preference applies to
|
||||||
* preference type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
* preference type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
||||||
*
|
*
|
||||||
* @return SerializedEntity
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
*
|
||||||
|
* @psalm-return SerializedEntity
|
||||||
*/
|
*/
|
||||||
public function get(string $scope, int $fileId, ?string $name = null): array
|
public function get(string $scope, int $fileId, ?string $name = null): array {
|
||||||
{
|
|
||||||
$result = $this->preferenceMapper->get($scope, $fileId, $name);
|
$result = $this->preferenceMapper->get($scope, $fileId, $name);
|
||||||
|
|
||||||
return array_map(
|
return array_map(
|
||||||
function (ReaderEntity $entity): array {
|
function (ReaderEntity $entity): array {
|
||||||
return $entity->toService();
|
return $entity->toService();
|
||||||
},
|
}, $result);
|
||||||
$result
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,33 +57,46 @@ class PreferenceService extends Service
|
|||||||
*
|
*
|
||||||
* scope identifies preference source, i.e. which renderer the preference applies to
|
* scope identifies preference source, i.e. which renderer the preference applies to
|
||||||
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function set(string $scope, int $fileId, string $name, string $value): ReaderEntity
|
public function set(string $scope, int $fileId, string $name, string $value): ReaderEntity {
|
||||||
{
|
|
||||||
return $this->preferenceMapper->set($scope, $fileId, $name, $value);
|
return $this->preferenceMapper->set($scope, $fileId, $name, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get default preference
|
* @brief get default preference
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param ?string $name
|
||||||
*/
|
*/
|
||||||
public function getDefault(string $scope, ?string $name = null): array
|
public function getDefault(string $scope, ?string $name = null): array {
|
||||||
{
|
|
||||||
return $this->get($scope, self::DEFAULTS, $name);
|
return $this->get($scope, self::DEFAULTS, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set default preference
|
* @brief set default preference
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
public function setDefault(string $scope, string $name, string $value): ReaderEntity
|
public function setDefault($scope, $name, $value): ReaderEntity {
|
||||||
{
|
|
||||||
return $this->preferenceMapper->set($scope, self::DEFAULTS, $name, $value);
|
return $this->preferenceMapper->set($scope, self::DEFAULTS, $name, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete preference
|
* @brief delete preference
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param int $fileId
|
||||||
|
* @param ?string $name
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function delete(string $scope, int $fileId, ?string $name = null): void
|
public function delete(string $scope, int $fileId, ?string $name = null): void {
|
||||||
{
|
|
||||||
foreach($this->preferenceMapper->get($scope, $fileId, $name) as $preference) {
|
foreach($this->preferenceMapper->get($scope, $fileId, $name) as $preference) {
|
||||||
$this->preferenceMapper->delete($preference);
|
$this->preferenceMapper->delete($preference);
|
||||||
}
|
}
|
||||||
@ -89,9 +104,12 @@ class PreferenceService extends Service
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete default
|
* @brief delete default
|
||||||
|
*
|
||||||
|
* @param string $scope
|
||||||
|
* @param ?string $name
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function deleteDefault(string $scope, ?string $name = null): void
|
public function deleteDefault(string $scope, ?string $name = null): void {
|
||||||
{
|
|
||||||
$this->delete($scope, self::DEFAULTS, $name);
|
$this->delete($scope, self::DEFAULTS, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,10 @@ namespace OCA\Epubreader\Service;
|
|||||||
|
|
||||||
use OCA\Epubreader\Db\ReaderMapper;
|
use OCA\Epubreader\Db\ReaderMapper;
|
||||||
|
|
||||||
abstract class Service
|
abstract class Service {
|
||||||
{
|
|
||||||
protected ReaderMapper $mapper;
|
protected ReaderMapper $mapper;
|
||||||
|
|
||||||
public function __construct(ReaderMapper $mapper)
|
public function __construct(ReaderMapper $mapper) {
|
||||||
{
|
|
||||||
$this->mapper = $mapper;
|
$this->mapper = $mapper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ownCloud - Epubreader App.
|
* ownCloud - Epubreader App
|
||||||
*
|
*
|
||||||
* @author Frank de Lange
|
* @author Frank de Lange
|
||||||
* @copyright 2014,2018 Frank de Lange
|
* @copyright 2014,2018 Frank de Lange
|
||||||
@ -16,13 +16,12 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
|
||||||
class Personal implements ISettings
|
class Personal implements ISettings {
|
||||||
{
|
|
||||||
private string $userId;
|
private string $userId;
|
||||||
private IConfig $configManager;
|
private IConfig $configManager;
|
||||||
|
|
||||||
public function __construct(string $userId, IConfig $configManager)
|
public function __construct(string $userId, IConfig $configManager) {
|
||||||
{
|
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->configManager = $configManager;
|
$this->configManager = $configManager;
|
||||||
}
|
}
|
||||||
@ -31,8 +30,7 @@ class Personal implements ISettings
|
|||||||
* @return TemplateResponse returns the instance with all parameters set, ready to be rendered
|
* @return TemplateResponse returns the instance with all parameters set, ready to be rendered
|
||||||
* @since 9.1
|
* @since 9.1
|
||||||
*/
|
*/
|
||||||
public function getForm(): TemplateResponse
|
public function getForm(): TemplateResponse {
|
||||||
{
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'EpubEnable' => $this->configManager->getUserValue($this->userId, Application::APP_ID, 'epub_enable', 'true'),
|
'EpubEnable' => $this->configManager->getUserValue($this->userId, Application::APP_ID, 'epub_enable', 'true'),
|
||||||
'PdfEnable' => $this->configManager->getUserValue($this->userId, Application::APP_ID, 'pdf_enable', 'true'),
|
'PdfEnable' => $this->configManager->getUserValue($this->userId, Application::APP_ID, 'pdf_enable', 'true'),
|
||||||
@ -43,10 +41,11 @@ class Personal implements ISettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print config section (ownCloud 10).
|
* Print config section (ownCloud 10)
|
||||||
|
*
|
||||||
|
* @return TemplateResponse
|
||||||
*/
|
*/
|
||||||
public function getPanel(): TemplateResponse
|
public function getPanel(): TemplateResponse {
|
||||||
{
|
|
||||||
return $this->getForm();
|
return $this->getForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,16 +53,16 @@ class Personal implements ISettings
|
|||||||
* @return string the section ID, e.g. 'sharing'
|
* @return string the section ID, e.g. 'sharing'
|
||||||
* @since 9.1
|
* @since 9.1
|
||||||
*/
|
*/
|
||||||
public function getSection(): string
|
public function getSection(): string {
|
||||||
{
|
|
||||||
return Application::APP_ID;
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get section ID (ownCloud 10).
|
* Get section ID (ownCloud 10)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSectionID(): string
|
public function getSectionID(): string {
|
||||||
{
|
|
||||||
return Application::APP_ID;
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +74,7 @@ class Personal implements ISettings
|
|||||||
* E.g.: 70
|
* E.g.: 70
|
||||||
* @since 9.1
|
* @since 9.1
|
||||||
*/
|
*/
|
||||||
public function getPriority(): int
|
public function getPriority(): int {
|
||||||
{
|
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ownCloud - Epubreader App.
|
* ownCloud - Epubreader App
|
||||||
*
|
*
|
||||||
* @author Frank de Lange
|
* @author Frank de Lange
|
||||||
* @copyright 2014,2018 Frank de Lange
|
* @copyright 2014,2018 Frank de Lange
|
||||||
@ -16,46 +16,49 @@ use OCP\IL10N;
|
|||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Settings\IIconSection;
|
use OCP\Settings\IIconSection;
|
||||||
|
|
||||||
class PersonalSection implements IIconSection
|
class PersonalSection implements IIconSection {
|
||||||
{
|
|
||||||
private IURLGenerator $urlGenerator;
|
private IURLGenerator $urlGenerator;
|
||||||
private IL10N $l;
|
private IL10N $l;
|
||||||
|
|
||||||
public function __construct(IURLGenerator $urlGenerator, IL10N $l)
|
public function __construct(IURLGenerator $urlGenerator, IL10N $l) {
|
||||||
{
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->l = $l;
|
$this->l = $l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the relative path to an 16*16 icon describing the section.
|
* returns the relative path to an 16*16 icon describing the section.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIcon(): string
|
public function getIcon(): string {
|
||||||
{
|
|
||||||
return $this->urlGenerator->imagePath(Application::APP_ID, 'app.svg');
|
return $this->urlGenerator->imagePath(Application::APP_ID, 'app.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the ID of the section. It is supposed to be a lower case string,.
|
* returns the ID of the section. It is supposed to be a lower case string,
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getID(): string
|
public function getID(): string {
|
||||||
{
|
|
||||||
return Application::APP_ID;
|
return Application::APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the translated name as it should be displayed.
|
* returns the translated name as it should be displayed
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName(): string
|
public function getName(): string {
|
||||||
{
|
|
||||||
return $this->l->t('EPUB/CBZ/PDF ebook reader');
|
return $this->l->t('EPUB/CBZ/PDF ebook reader');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns priority for positioning.
|
* returns priority for positioning
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPriority(): int
|
public function getPriority(): int {
|
||||||
{
|
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
<?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
|
|
||||||
* @template S as class-string<T>|string
|
|
||||||
* @psalm-param S $serviceName
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,20 +10,17 @@
|
|||||||
|
|
||||||
namespace OCA\Epubreader\Utility;
|
namespace OCA\Epubreader\Utility;
|
||||||
|
|
||||||
class Time
|
class Time {
|
||||||
{
|
|
||||||
public function getTime(): int
|
public function getTime(): int {
|
||||||
{
|
|
||||||
return time();
|
return time();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int the current unix time in miliseconds
|
* @return int the current unix time in miliseconds
|
||||||
*/
|
*/
|
||||||
public function getMicroTime(): int
|
public function getMicroTime(): int {
|
||||||
{
|
|
||||||
list($millisecs, $secs) = explode(' ', microtime());
|
list($millisecs, $secs) = explode(' ', microtime());
|
||||||
|
|
||||||
return (int) ($secs . substr($millisecs, 2, 6));
|
return (int) ($secs . substr($millisecs, 2, 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<psalm
|
<psalm
|
||||||
errorLevel="1"
|
errorLevel="2"
|
||||||
resolveFromConfigFile="true"
|
resolveFromConfigFile="true"
|
||||||
findUnusedBaselineEntry="true"
|
findUnusedBaselineEntry="true"
|
||||||
findUnusedCode="false"
|
findUnusedCode="false"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"ignorePaths": [".drone.yml"]
|
||||||
}
|
}
|
||||||
|
@ -20,20 +20,32 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
* 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/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Hooks;
|
namespace OC\Hooks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Emitter.
|
* Class Emitter
|
||||||
*
|
*
|
||||||
* interface for all classes that are able to emit events
|
* interface for all classes that are able to emit events
|
||||||
*
|
*
|
||||||
|
* @package OC\Hooks
|
||||||
* @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
|
* @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
|
||||||
*/
|
*/
|
||||||
interface Emitter
|
interface Emitter {
|
||||||
{
|
/**
|
||||||
public function listen(string $scope, string $method, callable $callback): void;
|
* @param string $scope
|
||||||
|
* @param string $method
|
||||||
|
* @param callable $callback
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function listen($scope, $method, callable $callback);
|
||||||
|
|
||||||
public function removeListener(string $scope = null, string $method = null, callable $callback = null): void;
|
/**
|
||||||
|
* @param string $scope optional
|
||||||
|
* @param string $method optional
|
||||||
|
* @param callable $callback optional
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function removeListener($scope = null, $method = null, callable $callback = null);
|
||||||
}
|
}
|
||||||
|
@ -36,20 +36,20 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<title>
|
<title>
|
||||||
<?php p($title);?>
|
<?php p($title);?>
|
||||||
</title>
|
</title>
|
||||||
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')); ?>">
|
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/css/cbr.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/css/cbr.css')) ?>?v=<?php p($version) ?>">
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pixastic/pixastic_combined.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pixastic/pixastic_combined.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bitjs/archive/archive.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bitjs/archive/archive.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/cbr.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/cbr.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
|
|
||||||
<?php if ($idevice) { ?>
|
<?php if ($idevice): ?>
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/css/idevice.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/cbrjs/css/idevice.css')) ?>?v=<?php p($version) ?>">
|
||||||
<?php } ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -109,7 +109,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
|
|
||||||
<!-- loading overlay -->
|
<!-- loading overlay -->
|
||||||
<div id="cbr-loading-overlay" class="cbr-control control overlay" name="loadingOverlay" style="display:none">
|
<div id="cbr-loading-overlay" class="cbr-control control overlay" name="loadingOverlay" style="display:none">
|
||||||
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')); ?>">
|
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')) ?>">
|
||||||
</div>
|
</div>
|
||||||
<!-- /loading overlay -->
|
<!-- /loading overlay -->
|
||||||
|
|
||||||
|
@ -36,30 +36,30 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<title>
|
<title>
|
||||||
<?php p($title);?>
|
<?php p($title);?>
|
||||||
</title>
|
</title>
|
||||||
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')); ?>">
|
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/main.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/main.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/sidebar.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/sidebar.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/popup.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/popup.css')) ?>?v=<?php p($version) ?>">
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/lib/typedarray.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/lib/typedarray.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/lib/wgxpath.install.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/lib/wgxpath.install.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bartaz/jquery.highlight.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bartaz/jquery.highlight.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/jquery/put-delete.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/jquery/put-delete.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/zip.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/zip.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/epub.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/epub.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/hooks.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/hooks.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/hooks/extensions/highlight.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/hooks/extensions/highlight.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/reader.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/reader.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
|
|
||||||
<?php if ($idevice) { ?>
|
<?php if ($idevice): ?>
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/idevice.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/css/idevice.css')) ?>?v=<?php p($version) ?>">
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.css')) ?>?v=<?php p($version) ?>">
|
||||||
<?php } ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="outerContainer">
|
<div id="outerContainer">
|
||||||
@ -113,21 +113,21 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="custom_font_family" name="font_family">
|
<input type="checkbox" id="custom_font_family" name="font_family">
|
||||||
<label for="custom_font_family"><?php echo $l->t('custom font'); ?></label>
|
<label for="custom_font_family"><?php print($l->t('custom font')); ?></label>
|
||||||
<select id="font_family" disabled="">
|
<select id="font_family" disabled="">
|
||||||
<option value="verdana, trebuchet, droid sans serif, sans, sans-serif"> sans </option>
|
<option value="verdana, trebuchet, droid sans serif, sans, sans-serif"> sans </option>
|
||||||
<option value="georgia, times new roman, droid serif, serif"> serif </option>
|
<option value="georgia, times new roman, droid serif, serif"> serif </option>
|
||||||
<option value="monospace"><?php echo $l->t('monospace'); ?> </option>
|
<option value="monospace"><?php print($l->t('monospace')); ?> </option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="custom_font_size" name="font_size">
|
<input type="checkbox" id="custom_font_size" name="font_size">
|
||||||
<label for="custom_font_size"><?php echo $l->t('font size'); ?></label>
|
<label for="custom_font_size"><?php print($l->t('font size')); ?></label>
|
||||||
<input type="number" id="font_size" value="100" min="50" max="150" disabled=""> %
|
<input type="number" id="font_size" value="100" min="50" max="150" disabled=""> %
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="custom_font_weight" name="font_weight">
|
<input type="checkbox" id="custom_font_weight" name="font_weight">
|
||||||
<label for="custom_font_weight"><?php echo $l->t('font weight'); ?></label>
|
<label for="custom_font_weight"><?php print($l->t('font weight')); ?></label>
|
||||||
<select id="font_weight" disabled="">
|
<select id="font_weight" disabled="">
|
||||||
<option value="100">thin</option>
|
<option value="100">thin</option>
|
||||||
<option value="200">extra light</option>
|
<option value="200">extra light</option>
|
||||||
@ -154,7 +154,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<input type="checkbox" id="use_custom_colors" name="use_custom_colors">
|
<input type="checkbox" id="use_custom_colors" name="use_custom_colors">
|
||||||
<label for="use_custom_colors">
|
<label for="use_custom_colors">
|
||||||
<?php echo $l->t('Use custom colors'); ?>;
|
<?php print($l->t('Use custom colors')); ?>;
|
||||||
</label>
|
</label>
|
||||||
<div class="center-box">
|
<div class="center-box">
|
||||||
<input type="color" id="day_color" value="#0a0a0a">
|
<input type="color" id="day_color" value="#0a0a0a">
|
||||||
@ -172,7 +172,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<legend>night</legend>
|
<legend>night</legend>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="center-box nightshift">
|
<div class="center-box nightshift">
|
||||||
<?php echo $l->t('night mode can be toggled by clicking the book title'); ?>;
|
<?php print($l->t('night mode can be toggled by clicking the book title')); ?>;
|
||||||
</div>
|
</div>
|
||||||
<div class="center-box">
|
<div class="center-box">
|
||||||
<input type="color" id="night_color" value="#454545">
|
<input type="color" id="night_color" value="#454545">
|
||||||
@ -202,19 +202,19 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<input type="checkbox" id="sidebarReflow" name="sidebarReflow">
|
<input type="checkbox" id="sidebarReflow" name="sidebarReflow">
|
||||||
<label for="sidebarReflow">
|
<label for="sidebarReflow">
|
||||||
<?php echo $l->t('reflow text when sidebars are open'); ?>;
|
<?php print($l->t('reflow text when sidebars are open')); ?>;
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<input type="checkbox" id="touch_nav" name="touch_nav">
|
<input type="checkbox" id="touch_nav" name="touch_nav">
|
||||||
<label for="touch_nav">
|
<label for="touch_nav">
|
||||||
<?php echo $l->t('disable extra-wide page turn areas'); ?>;
|
<?php print($l->t('disable extra-wide page turn areas')); ?>;
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<input type="checkbox" id="page_turn_arrows" name="page_turn_arrows">
|
<input type="checkbox" id="page_turn_arrows" name="page_turn_arrows">
|
||||||
<label for="page_turn_arrows">
|
<label for="page_turn_arrows">
|
||||||
<?php echo $l->t('show page turn arrows'); ?>;
|
<?php print($l->t('show page turn arrows')); ?>;
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<div id="titlebar">
|
<div id="titlebar">
|
||||||
<div id="opener">
|
<div id="opener">
|
||||||
<a id="slider" class="icon-menu">
|
<a id="slider" class="icon-menu">
|
||||||
<?php p($l->t('menu')); ?>
|
<?php p($l->t("menu")); ?>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="metainfo">
|
<div id="metainfo">
|
||||||
@ -282,7 +282,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="loader">
|
<div id="loader">
|
||||||
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')); ?>">
|
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- /navigation + viewer -->
|
<!-- /navigation + viewer -->
|
||||||
|
@ -36,42 +36,42 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<title>
|
<title>
|
||||||
<?php p($title);?>
|
<?php p($title);?>
|
||||||
</title>
|
</title>
|
||||||
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')); ?>">
|
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('epubreader', 'img/book.png')) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/icomoon/style.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/main.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/main.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/sidebar.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/sidebar.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/text_layer_builder.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/text_layer_builder.css')) ?>?v=<?php p($version) ?>">
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/annotation_layer_builder.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/annotation_layer_builder.css')) ?>?v=<?php p($version) ?>">
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/lib/pdf.worker.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/lib/pdf.worker.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bartaz/jquery.highlight.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bartaz/jquery.highlight.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/jquery/put-delete.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/jquery/put-delete.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/sindresorhus/screenfull.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/lib/pdf.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/lib/pdf.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/pdf.reader.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/pdf.reader.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/eventbus_service.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/eventbus_service.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/link_service.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/link_service.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/simple_link_service.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/services/simple_link_service.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/progress_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/progress_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/textlayer_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/textlayer_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/search_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/search_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/reader_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/reader_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/sidebar_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/sidebar_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/settings_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/settings_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/controls_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/controls_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/toc_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/toc_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/outline_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/outline_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/annotationlayer_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/annotationlayer_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/notes_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/notes_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/bookmarks_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/bookmarks_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/styles_controller.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/controllers/styles_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<?php if ($idevice) { ?>
|
<?php if ($idevice): ?>
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/idevice.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/pdfjs/css/idevice.css')) ?>?v=<?php p($version) ?>">
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.css')); ?>?v=<?php p($version); ?>">
|
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('epubreader', 'public/bgrins/spectrum.css')) ?>?v=<?php p($version) ?>">
|
||||||
<?php } ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script type="text/javascript" nonce="<?php p($nonce); ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')); ?>?v=<?php p($version); ?>"> </script>
|
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('epubreader', 'js/ready.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="outerContainer">
|
<div id="outerContainer">
|
||||||
@ -216,7 +216,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
<div id="titlebar">
|
<div id="titlebar">
|
||||||
<div id="opener">
|
<div id="opener">
|
||||||
<a id="slider" class="icon-menu">
|
<a id="slider" class="icon-menu">
|
||||||
<?php p($l->t('menu')); ?>
|
<?php p($l->t("menu")); ?>
|
||||||
</a>
|
</a>
|
||||||
<div id="status_message_left">
|
<div id="status_message_left">
|
||||||
</div>
|
</div>
|
||||||
@ -311,7 +311,7 @@ $nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="loader">
|
<div id="loader">
|
||||||
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')); ?>">
|
<img src="<?php p($urlGenerator->linkTo('epubreader', 'img/loading.gif')) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- /navigation + viewer -->
|
<!-- /navigation + viewer -->
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* later.
|
* later.
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
script('epubreader', 'settings');
|
script('epubreader', 'settings');
|
||||||
style('epubreader', 'settings');
|
style('epubreader', 'settings');
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ style('epubreader', 'settings');
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="EpubEnable" id="EpubEnable" class="checkbox"
|
<input type="checkbox" name="EpubEnable" id="EpubEnable" class="checkbox"
|
||||||
value="1" <?php if ('true' === $_['EpubEnable']) {
|
value="1" <?php if ($_['EpubEnable'] === "true") {
|
||||||
print_unescaped('checked="checked"');
|
print_unescaped('checked="checked"');
|
||||||
} ?> />
|
} ?> />
|
||||||
<label for="EpubEnable">
|
<label for="EpubEnable">
|
||||||
@ -28,7 +29,7 @@ style('epubreader', 'settings');
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="PdfEnable" id="PdfEnable" class="checkbox"
|
<input type="checkbox" name="PdfEnable" id="PdfEnable" class="checkbox"
|
||||||
value="1" <?php if ('true' === $_['PdfEnable']) {
|
value="1" <?php if ($_['PdfEnable'] === "true") {
|
||||||
print_unescaped('checked="checked"');
|
print_unescaped('checked="checked"');
|
||||||
} ?> />
|
} ?> />
|
||||||
<label for="PdfEnable">
|
<label for="PdfEnable">
|
||||||
@ -37,7 +38,7 @@ style('epubreader', 'settings');
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="CbxEnable" id="CbxEnable" class="checkbox"
|
<input type="checkbox" name="CbxEnable" id="CbxEnable" class="checkbox"
|
||||||
value="1" <?php if ('true' === $_['CbxEnable']) {
|
value="1" <?php if ($_['CbxEnable'] === "true") {
|
||||||
print_unescaped('checked="checked"');
|
print_unescaped('checked="checked"');
|
||||||
} ?> />
|
} ?> />
|
||||||
<label for="CbxEnable">
|
<label for="CbxEnable">
|
||||||
|
Reference in New Issue
Block a user