Add docker environment and fix sharing folder
All checks were successful
epubreader / nextcloud-22 (push) Successful in 51s
epubreader / nextcloud-27 (push) Successful in 46s

This commit is contained in:
Michel Roux 2023-08-02 22:28:07 +02:00
parent 4a30c02521
commit 0fe00a2654
3 changed files with 34 additions and 6 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
.idea
*.iml
/vendor/
/build/
node_modules/
/.php-cs-fixer.cache
js/*hot-update.*

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM nextcloud:27
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

View File

@ -45,19 +45,19 @@ class Hooks
{
// 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
$user = Server::get(IUserSession::class)->getUser();
if ($user
&& is_array($settings['array'])
if (is_array($settings['array'])
&& array_key_exists('oc_appconfig', $settings['array'])
) {
$isJson = self::isJson($settings['array']['oc_appconfig']);
$user = Server::get(IUserSession::class)->getUser();
$userId = $user ? $user->getUID() : null;
/** @var array $array */
$array = ($isJson) ? json_decode((string) $settings['array']['oc_appconfig'], true) : $settings['array']['oc_appconfig'];
$array['filesReader'] = [
'enableEpub' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'epub_enable', true),
'enablePdf' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'pdf_enable', true),
'enableCbx' => Server::get(IConfig::class)->getUserValue($user->getUID(), Application::APP_ID, 'cbx_enable', true),
'enableEpub' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'epub_enable', true),
'enablePdf' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'pdf_enable', true),
'enableCbx' => Server::get(IConfig::class)->getUserValue($userId, Application::APP_ID, 'cbx_enable', true),
];
$settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array;
}