diff --git a/.directory b/.directory new file mode 100644 index 0000000..a1f0c13 --- /dev/null +++ b/.directory @@ -0,0 +1,6 @@ +[Dolphin] +Timestamp=2019,11,25,12,16,0 +Version=4 + +[Settings] +HiddenFilesShown=true diff --git a/dist/files_opds-1.2.3-patched-4-NC.tar.gz b/dist/files_opds-1.2.3-patched-4-NC.tar.gz new file mode 100644 index 0000000..a8d47e0 Binary files /dev/null and b/dist/files_opds-1.2.3-patched-4-NC.tar.gz differ diff --git a/dist/files_opds-1.2.3-patched-4-OC.tar.gz b/dist/files_opds-1.2.3-patched-4-OC.tar.gz new file mode 100644 index 0000000..46f0d90 Binary files /dev/null and b/dist/files_opds-1.2.3-patched-4-OC.tar.gz differ diff --git a/dist/files_opds-1.2.3-patched-5-NC.tar.gz b/dist/files_opds-1.2.3-patched-5-NC.tar.gz new file mode 100644 index 0000000..5dcb1c2 Binary files /dev/null and b/dist/files_opds-1.2.3-patched-5-NC.tar.gz differ diff --git a/dist/files_opds-1.2.3-patched-5-OC.tar.gz b/dist/files_opds-1.2.3-patched-5-OC.tar.gz new file mode 100644 index 0000000..53af0fd Binary files /dev/null and b/dist/files_opds-1.2.3-patched-5-OC.tar.gz differ diff --git a/dist/files_reader-1.2.3-patched-4-NC.tar.gz b/dist/files_reader-1.2.3-patched-4-NC.tar.gz new file mode 100644 index 0000000..8565712 Binary files /dev/null and b/dist/files_reader-1.2.3-patched-4-NC.tar.gz differ diff --git a/dist/files_reader-1.2.3-patched-4-OC.tar.gz b/dist/files_reader-1.2.3-patched-4-OC.tar.gz new file mode 100644 index 0000000..b5829bc Binary files /dev/null and b/dist/files_reader-1.2.3-patched-4-OC.tar.gz differ diff --git a/dist/files_reader-1.2.3-patched-5-NC.tar.gz b/dist/files_reader-1.2.3-patched-5-NC.tar.gz new file mode 100644 index 0000000..5c331e2 Binary files /dev/null and b/dist/files_reader-1.2.3-patched-5-NC.tar.gz differ diff --git a/dist/files_reader-1.2.3-patched-5-OC.tar.gz b/dist/files_reader-1.2.3-patched-5-OC.tar.gz new file mode 100644 index 0000000..46a302f Binary files /dev/null and b/dist/files_reader-1.2.3-patched-5-OC.tar.gz differ diff --git a/dist/files_reader-1.2.3-patched-NC.tar.gz b/dist/files_reader-1.2.3-patched-NC.tar.gz new file mode 100644 index 0000000..cb66054 Binary files /dev/null and b/dist/files_reader-1.2.3-patched-NC.tar.gz differ diff --git a/files_opds/ajax/admin.php b/files_opds/ajax/admin.php index 75f99d7..7a48fa7 100644 --- a/files_opds/ajax/admin.php +++ b/files_opds/ajax/admin.php @@ -12,8 +12,8 @@ namespace OCA\Files_Opds; -\OCP\JSON::callCheck(); -\OCP\JSON::checkLoggedIn(); +\OC_JSON::callCheck(); +\OC_JSON::checkLoggedIn(); $defaults = new \OC_Defaults(); $l = \OC::$server->getL10N('files_opds'); @@ -53,11 +53,10 @@ if (isset($_POST['opdsCoverX'])) { Config::setPreview('OC\Preview\MSOffice2007',$opdsPreviewMsOffice); } -\OCP\JSON::success( +\OC_JSON::success( array( 'data' => array('message'=> $l->t('Settings updated successfully.')) ) ); exit(); - diff --git a/files_opds/ajax/clear_bookshelf.php b/files_opds/ajax/clear_bookshelf.php index 0ba1604..727a76a 100644 --- a/files_opds/ajax/clear_bookshelf.php +++ b/files_opds/ajax/clear_bookshelf.php @@ -14,8 +14,8 @@ namespace OCA\Files_Opds; $l = \OC::$server->getL10N('files_opds'); -\OCP\JSON::checkLoggedIn(); -\OCP\JSON::callCheck(); +\OC_JSON::checkLoggedIn(); +\OC_JSON::callCheck(); Bookshelf::clear(); -\OCP\JSON::success(array( "data" => array( "message" => $l->t("Bookshelf cleared")))); +\OC_JSON::success(array( "data" => array( "message" => $l->t("Bookshelf cleared")))); diff --git a/files_opds/ajax/personal.php b/files_opds/ajax/personal.php index 2d019b8..6d86ea7 100644 --- a/files_opds/ajax/personal.php +++ b/files_opds/ajax/personal.php @@ -12,8 +12,8 @@ namespace OCA\Files_Opds; -\OCP\JSON::callCheck(); -\OCP\JSON::checkLoggedIn(); +\OC_JSON::callCheck(); +\OC_JSON::checkLoggedIn(); $l = \OC::$server->getL10N('files_opds'); @@ -21,25 +21,27 @@ $opdsEnable = isset($_POST['opdsEnable']) ? $_POST['opdsEnable'] : 'false'; $rootPath = isset($_POST['rootPath']) ? $_POST['rootPath'] : '/Library'; $fileTypes = isset($_POST['fileTypes']) ? $_POST['fileTypes'] : ''; $skipList = isset($_POST['skipList']) ? $_POST['skipList'] : 'metadata.opf,cover.jpg'; -$feedTitle = isset($_POST['feedTitle']) ? $_POST['feedTitle'] : $l->t("%s's Library", \OCP\User::getDisplayName()); +$feedTitle = isset($_POST['feedTitle']) ? $_POST['feedTitle'] : $l->t("%s's Library", \OC_User::getDisplayName()); +$opdsoldMime = isset($_POST['opdsoldMime']) ? $_POST['opdsoldMime'] : ''; if (!strlen($rootPath) || - \OC\Files\Filesystem::isValidPath($rootPath) === false || + \OC\Files\Filesystem::isValidPath($rootPath) === false || \OC\Files\Filesystem::file_exists($rootPath) === false ) { - \OCP\JSON::error( + \OC_JSON::error( array( 'data' => array('message'=> $l->t('Directory does not exist!')) ) ); } else { Config::set('root_path', $rootPath); - Config::set('enable', $opdsEnable); - Config::set('file_types', $fileTypes); - Config::set('skip_list', $skipList); - Config::set('feed_title', $feedTitle); + Config::set('enable', $opdsEnable); + Config::set('file_types', $fileTypes); + Config::set('skip_list', $skipList); + Config::set('feed_title', $feedTitle); + Config::set('old_mime', $opdsoldMime); Config::set('id', Util::genUuid()); - \OCP\JSON::success( + \OC_JSON::success( array( 'data' => array('message'=> $l->t('Settings updated successfully.')) ) @@ -47,4 +49,3 @@ if (!strlen($rootPath) || } exit(); - diff --git a/files_opds/ajax/schedule_rescan.php b/files_opds/ajax/schedule_rescan.php index 0f266c3..5d91c3e 100644 --- a/files_opds/ajax/schedule_rescan.php +++ b/files_opds/ajax/schedule_rescan.php @@ -14,8 +14,8 @@ namespace OCA\Files_Opds; $l = \OC::$server->getL10N('files_opds'); -\OCP\JSON::checkLoggedIn(); -\OCP\JSON::callCheck(); +\OC_JSON::checkLoggedIn(); +\OC_JSON::callCheck(); Meta::rescan(); -\OCP\JSON::success(array( "data" => array( "message" => $l->t("Rescan scheduled")))); +\OC_JSON::success(array( "data" => array( "message" => $l->t("Rescan scheduled")))); diff --git a/files_opds/appinfo/info.xml b/files_opds/appinfo/info.xml index 699df24..e4e3cd8 100644 --- a/files_opds/appinfo/info.xml +++ b/files_opds/appinfo/info.xml @@ -37,7 +37,7 @@ See [README] for more information on (mis)features of this app. sqlite mysql - + OCA\Files_Opds\Settings\Admin diff --git a/files_opds/js/personal.js b/files_opds/js/personal.js index 73c0992..db68273 100644 --- a/files_opds/js/personal.js +++ b/files_opds/js/personal.js @@ -39,8 +39,10 @@ $(document).ready(function(){ var opdsSettings = { save : function() { var opdsEnable = document.getElementById('opds-enable').checked ? 'true' : 'false'; + var opdsoldMime = document.getElementById('opds-oldmime').checked ? 'true' : 'false'; var data = { opdsEnable : opdsEnable, + opdsoldMime : opdsoldMime, rootPath : $('#opds-root-path').val(), fileTypes : $('#opds-file-types').val(), skipList : $('#opds-skip-list').val(), @@ -61,5 +63,6 @@ $(document).ready(function(){ } }); $('#opds-enable').on("change", opdsSettings.save); + $('#opds-oldmime').on("change", opdsSettings.save); }); diff --git a/files_opds/lib/config.php b/files_opds/lib/config.php index 6e84a54..a468767 100644 --- a/files_opds/lib/config.php +++ b/files_opds/lib/config.php @@ -25,7 +25,7 @@ class Config * @return string retrieved value or default */ public static function get($key, $default) { - return \OCP\Config::getUserValue(\OCP\User::getUser(), 'files_opds', $key, $default); + return \OC::$server->getConfig()->getUserValue(\OC::$server->getUserSession()->getUser()->getUID(), 'files_opds', $key, $default); } /** @@ -36,7 +36,7 @@ class Config * @return bool success */ public static function set($key, $value) { - return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_opds', $key, $value); + return \OC::$server->getConfig()->setUserValue(\OC::$server->getUserSession()->getUser()->getUID(), 'files_opds', $key, $value); } /** @@ -47,7 +47,7 @@ class Config * @return string retrieved value or default */ public static function getApp($key, $default) { - return \OCP\Config::getAppValue('files_opds', $key, $default); + return \OC::$server->getConfig()->getAppValue('files_opds', $key, $default); } /** @@ -58,17 +58,17 @@ class Config * @return bool success */ public static function setApp($key, $value) { - return \OCP\Config::setAppValue('files_opds', $key, $value); + return \OC::$server->getConfig()->setAppValue('files_opds', $key, $value); } - + /** * @brief get preview status - * + * * @param string format * @return bool (true = enabled, false = disabled) */ public static function getPreview($format) { - $enablePreviewProviders = \OCP\Config::getSystemValue('enabledPreviewProviders', null); + $enablePreviewProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', null); if (!($enablePreviewProviders === null)) { return in_array($format, $enablePreviewProviders); } @@ -83,7 +83,7 @@ class Config * @return bool */ public static function setPreview($format, $enable = 'false') { - $enablePreviewProviders = \OCP\Config::getSystemValue('enabledPreviewProviders', null); + $enablePreviewProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', null); if ($enable == 'true') { if ($enablePreviewProviders === null) { // set up default providers @@ -103,7 +103,7 @@ class Config } } - if (!(\OCP\Config::setSystemValue('enabledPreviewProviders', $enablePreviewProviders))) { + if (!(\OC::$server->getConfig()->setSystemValue('enabledPreviewProviders', $enablePreviewProviders))) { logWarn("Failed to enable " . $format . " preview provider (config.php readonly?)"); return true; } diff --git a/files_opds/lib/feed.php b/files_opds/lib/feed.php index 493764c..3cf127a 100644 --- a/files_opds/lib/feed.php +++ b/files_opds/lib/feed.php @@ -24,7 +24,7 @@ class Feed * @return string feed id */ public static function getFeedId() { - return Config::get('id', ''); + return Config::get('id', ''); } /** @@ -66,8 +66,8 @@ class Feed $tmpl->assign('id', $id); $tmpl->assign('type', $type); $tmpl->assign('dir', $dir); - $tmpl->assign('user', \OCP\User::getDisplayName()); - $tmpl->assign('feed_title', Config::get('feed_title',\OCP\User::getDisplayName() . "'s Library")); + $tmpl->assign('user', \OC_User::getDisplayName()); + $tmpl->assign('feed_title', Config::get('feed_title',\OC_User::getDisplayName() . "'s Library")); $tmpl->assign('feed_subtitle', Config::getApp('feed_subtitle', $defaults->getName() . " OPDS catalog")); $tmpl->assign('feed_updated', time()); $tmpl->printPage(); diff --git a/files_opds/lib/meta.php b/files_opds/lib/meta.php index a3c12cb..bb4aaa6 100644 --- a/files_opds/lib/meta.php +++ b/files_opds/lib/meta.php @@ -64,7 +64,7 @@ class Meta protected static function load($id) { $sql = 'SELECT * FROM `*PREFIX*opds_metadata` WHERE id = ?'; $args = array($id); - $query = \OCP\DB::prepare($sql); + $query = \OC_DB::prepare($sql); $result = $query->execute($args); return ($row = $result->fetchRow()) ? $row : false; @@ -79,7 +79,7 @@ class Meta protected static function save($meta) { $sql = "SELECT `id` FROM *PREFIX*opds_metadata WHERE `id`=?"; $args = array($meta['id']); - $query = \OCP\DB::prepare($sql); + $query = \OC_DB::prepare($sql); $result = $query->execute($args); $data = $result->fetchRow(); if (isset($data['id'])) { @@ -118,7 +118,7 @@ class Meta $meta['rescan'] ); } - $query = \OCP\DB::prepare($sql); + $query = \OC_DB::prepare($sql); return $query->execute($args); } @@ -150,7 +150,7 @@ class Meta public static function remove($id) { $sql = "DELETE FROM *PREFIX*opds_metadata WHERE `id`=?"; $args = array($id); - $query = \OCP\DB::prepare($sql); + $query = \OC_DB::prepare($sql); return $query->execute($args); } @@ -162,7 +162,7 @@ class Meta public static function rescan() { $sql = "UPDATE *PREFIX*opds_metadata SET `rescan`=?"; $args = array(date("Y-m-d H:i:s")); - $query = \OCP\DB::prepare($sql); + $query = \OC_DB::prepare($sql); $result = $query->execute($args); } diff --git a/files_opds/lib/util.php b/files_opds/lib/util.php index b33cafe..c771c1a 100644 --- a/files_opds/lib/util.php +++ b/files_opds/lib/util.php @@ -113,7 +113,7 @@ class Util */ public static function genUuid() { $defaults = new \OC_Defaults(); - $hash = md5(\OCP\User::getDisplayName() . $defaults->getBaseUrl()); + $hash = md5(\OC_User::getDisplayName() . $defaults->getBaseUrl()); $hash = substr($hash, 0, 8 ) .'-'. substr($hash, 8, 4) .'-3'. substr($hash, 13, 3) .'-9'. diff --git a/files_opds/personal.php b/files_opds/personal.php index 5fac311..5a36565 100644 --- a/files_opds/personal.php +++ b/files_opds/personal.php @@ -18,14 +18,17 @@ $l = \OC::$server->getL10N('files_opds'); $tmpl = new \OCP\Template('files_opds', 'personal'); $opdsEnable = Config::get('enable', false); +$opdsoldMime = Config::get('old_mime', false); $tmpl->assign('opdsEnable-checked', ($opdsEnable === 'true') ? 'checked="checked"' : ''); $tmpl->assign('opdsEnable-value', ($opdsEnable === 'true') ? '1' : '0'); $tmpl->assign('rootPath', Config::get('root_path', '/Library')); $tmpl->assign('fileTypes', Config::get('file_types', '')); $tmpl->assign('skipList', Config::get('skip_list', 'metadata.opf,cover.jpg')); -$tmpl->assign('feedTitle', Config::get('feed_title', $l->t("%s's Library", \OCP\User::getDisplayName()))); +$tmpl->assign('feedTitle', Config::get('feed_title', $l->t("%s's Library", \OC_User::getDisplayName()))); $tmpl->assign('bookshelf-count', Bookshelf::count()); $tmpl->assign('feedUrl', Util::linkToAbsolute('','index.php') . '/apps/files_opds/'); +$tmpl->assign('opdsoldMime-checked', ($opdsoldMime === 'true') ? 'checked="checked"' : ''); +$tmpl->assign('opdsoldMime-value', ($opdsoldMime === 'true') ? '1' : '0'); return $tmpl->fetchPage(); diff --git a/files_opds/templates/feed.php b/files_opds/templates/feed.php index 1704d39..3eaf941 100644 --- a/files_opds/templates/feed.php +++ b/files_opds/templates/feed.php @@ -48,7 +48,9 @@ switch ($_['type']) { case 'bookshelf': foreach ($_['bookshelf'] as $file) { - print_unescaped($this->inc('part.feed.acquisition', [ 'file' => $file ])); + foreach( $file as $key => $value ) + $newfile["file_".$key] = $value; + print_unescaped($this->inc('part.feed.acquisition', $newfile )); } break; @@ -60,10 +62,13 @@ switch ($_['type']) { case 'directory': default: foreach ($_['files'] as $file) { + foreach( $file as $key => $value ) + $newfile["file_".$key] = $value; + if ($file['type'] == 'dir') { - print_unescaped($this->inc('part.feed.navigation', [ 'file' => $file ])); + print_unescaped($this->inc('part.feed.navigation', $newfile )); } else { - print_unescaped($this->inc('part.feed.acquisition', [ 'file' => $file ])); + print_unescaped($this->inc('part.feed.acquisition', $newfile )); } } break; diff --git a/files_opds/templates/part.feed.acquisition.php b/files_opds/templates/part.feed.acquisition.php index ab7aae0..23f82dc 100644 --- a/files_opds/templates/part.feed.acquisition.php +++ b/files_opds/templates/part.feed.acquisition.php @@ -1,38 +1,47 @@ - - <?php p($_['file']['meta']['title']); ?> - - id: - - + + + <?php p($_['file_meta']['title']); ?> + + id: + + - - urn:isbn: + + urn:isbn: - - + + - - + + - - + - + - + - - - + + - + diff --git a/files_opds/templates/part.feed.navigation.php b/files_opds/templates/part.feed.navigation.php index 70568b2..09cd880 100644 --- a/files_opds/templates/part.feed.navigation.php +++ b/files_opds/templates/part.feed.navigation.php @@ -1,12 +1,12 @@ - <?php p($_['file']['name']); ?> - - id: + <?php p($_['file_name']); ?> + + id: + href="?id="/> + href="?id="/> diff --git a/files_opds/templates/personal.php b/files_opds/templates/personal.php index ac1823d..f3f705a 100644 --- a/files_opds/templates/personal.php +++ b/files_opds/templates/personal.php @@ -23,7 +23,8 @@ style('files_opds', 'settings');
type="checkbox" class="checkbox"> - + +

@@ -43,6 +44,10 @@ style('files_opds', 'settings'); + + + +
" value="" />
type="checkbox" title="For example use application/x-cbr instead of application/comicbook+rar"/>

diff --git a/files_reader/ajax/personal.php b/files_reader/ajax/personal.php index b2db6a8..c3a3602 100644 --- a/files_reader/ajax/personal.php +++ b/files_reader/ajax/personal.php @@ -21,9 +21,9 @@ $EpubEnable = isset($_POST['EpubEnable']) ? $_POST['EpubEnable'] : 'false'; $PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false'; $CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false'; -\OC::$server->getAppConfig()->setValue('files_reader', 'epub_enable', $EpubEnable); -\OC::$server->getAppConfig()->setValue('files_reader', 'pdf_enable', $PdfEnable); -\OC::$server->getAppConfig()->setValue('files_reader', 'cbx_enable', $CbxEnable); +Config::set('epub_enable', $EpubEnable); +Config::set('pdf_enable', $PdfEnable); +Config::set('cbx_enable', $CbxEnable); \OC_JSON::success( array( diff --git a/files_reader/appinfo/info.xml b/files_reader/appinfo/info.xml index ec61ad1..9bac62a 100644 --- a/files_reader/appinfo/info.xml +++ b/files_reader/appinfo/info.xml @@ -30,7 +30,7 @@ See [README] for more exhaustive information on features and potential misfeatur [README]: https://github.com/Yetangitu/owncloud-apps/blob/master/files_reader/README.md ]]> - 1.2.3 + 1.3.0 AGPL Frank de Lange @@ -47,15 +47,7 @@ See [README] for more exhaustive information on features and potential misfeatur files multimedia office - - - - - - pgsql - sqlite - mysql + - 167127 diff --git a/files_reader/js/plugin.js b/files_reader/js/plugin.js index 20ba0e5..2df289e 100644 --- a/files_reader/js/plugin.js +++ b/files_reader/js/plugin.js @@ -65,6 +65,8 @@ $('.directDownload').show(); } $('iframe').remove(); + $('body').off('focus.filesreader'); + $(window).off('popstate.filesreader'); }, /** @@ -73,10 +75,10 @@ */ show: function(downloadUrl, mimeType, isFileList) { var self = this; - var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType}); - // launch in new window on mobile and touch devices... + var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType}); + // launch in new window on all devices window.open(viewer, downloadUrl); - }, + }, /** * @param fileActions @@ -84,6 +86,16 @@ */ _extendFileActions: function(fileActions) { var self = this; + var cbxMime = [ + 'application/x-cbr', + 'application/comicbook+7z', + 'application/comicbook+ace', + 'application/comicbook+rar', + 'application/comicbook+tar', + 'application/comicbook+truecrypt', + 'application/comicbook+zip' + ]; + fileActions.registerAction({ name: 'view-epub', displayName: 'View', @@ -93,15 +105,22 @@ return actionHandler(fileName, 'application/epub+zip', context); } }); - fileActions.registerAction({ - name: 'view-cbr', - displayName: 'View', - mime: 'application/x-cbr', - permissions: OC.PERMISSION_READ, - actionHandler: function(fileName, context) { - return actionHandler(fileName, 'application/x-cbr', context); - } + + cbxMime.forEach(function(mime, i){ + fileActions.registerAction({ + name: 'view-cbr-' + i, + displayName: 'View', + mime: mime, + permissions: OC.PERMISSION_READ, + actionHandler: function (fileName, context) { + return actionHandler(fileName, 'application/x-cbr', context); + } + }); + + if (oc_appconfig.filesReader.enableCbx === 'true') + fileActions.setDefault(mime, 'view-cbr-' + i); }); + fileActions.registerAction({ name: 'view-pdf', displayName: 'View', @@ -114,8 +133,6 @@ if (oc_appconfig.filesReader.enableEpub === 'true') fileActions.setDefault('application/epub+zip', 'view-epub'); - if (oc_appconfig.filesReader.enableCbx === 'true') - fileActions.setDefault('application/x-cbr', 'view-cbr'); if (oc_appconfig.filesReader.enablePdf === 'true') fileActions.setDefault('application/pdf', 'view-pdf'); } diff --git a/files_reader/lib/Hooks.php b/files_reader/lib/Hooks.php index 3d3f1cb..15025e2 100644 --- a/files_reader/lib/Hooks.php +++ b/files_reader/lib/Hooks.php @@ -19,7 +19,7 @@ use \OC\User\User as User; class Hooks { public static function register() { - Util::connectHook('js', 'OCA\Files_Reader\Hooks', 'announce_settings'); + Util::connectHook('\OCP\Config', 'js', 'OCA\Files_Reader\Hooks', 'announce_settings'); \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) { $fileId = $node->getId(); @@ -38,9 +38,9 @@ class Hooks { // TODO: rmeove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties $isJson = self::isJson($settings['array']['oc_appconfig']); $array = ($isJson) ? json_decode($settings['array']['oc_appconfig'], true) : $settings['array']['oc_appconfig']; - $array['filesReader']['enableEpub'] = \OC::$server->getConfig()->getAppValue('epub_enable', 'true'); - $array['filesReader']['enablePdf'] = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true'); - $array['filesReader']['enableCbx'] = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true'); + $array['filesReader']['enableEpub'] = Config::get('epub_enable', 'true'); + $array['filesReader']['enablePdf'] = Config::get('pdf_enable', 'true'); + $array['filesReader']['enableCbx'] = Config::get('cbx_enable', 'true'); $settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array; } diff --git a/files_reader/lib/config.php b/files_reader/lib/config.php index 56e5427..210bed5 100644 --- a/files_reader/lib/config.php +++ b/files_reader/lib/config.php @@ -25,7 +25,7 @@ class Config * @return string retrieved value or default */ public static function get($key, $default) { - return \OCP\Config::getUserValue(\OCP\User::getUser(), 'files_reader', $key, $default); + return \OC::$server->getConfig()->getUserValue(\OCP\User::getUser(), 'files_reader', $key, $default); } /** @@ -36,7 +36,7 @@ class Config * @return bool success */ public static function set($key, $value) { - return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_reader', $key, $value); + return \OC::$server->getConfig()->setUserValue(\OCP\User::getUser(), 'files_reader', $key, $value); } /** @@ -47,7 +47,7 @@ class Config * @return string retrieved value or default */ public static function getApp($key, $default) { - return \OCP\Config::getAppValue('files_reader', $key, $default); + return \OC::$server->getConfig()->getAppValue('files_reader', $key, $default); } /** @@ -58,6 +58,6 @@ class Config * @return bool success */ public static function setApp($key, $value) { - return \OCP\Config::setAppValue('files_reader', $key, $value); + return \OC::$server->getConfig()->setAppValue('files_reader', $key, $value); } } diff --git a/files_reader/personal.php b/files_reader/personal.php index 6a071c5..2b0dd18 100644 --- a/files_reader/personal.php +++ b/files_reader/personal.php @@ -15,9 +15,9 @@ use OCP\Util; #$l = \OC::$server->getL10N('files_reader'); $tmpl = new \OCP\Template('files_reader', 'settings-personal'); -$EpubEnable = \OC::$server->getConfig()->getAppValue('epub_enable', 'true'); -$PdfEnable = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true'); -$CbxEnable = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true'); +$EpubEnable = Config::get('epub_enable', 'true'); +$PdfEnable = Config::get('pdf_enable', 'true'); +$CbxEnable = Config::get('cbx_enable', 'true'); $tmpl->assign('EpubEnable', $EpubEnable); $tmpl->assign('PdfEnable', $PdfEnable); $tmpl->assign('CbxEnable', $CbxEnable); diff --git a/files_reader/templates/cbreader.php b/files_reader/templates/cbreader.php index 24bac88..6e47a48 100644 --- a/files_reader/templates/cbreader.php +++ b/files_reader/templates/cbreader.php @@ -36,9 +36,9 @@ <?php p($title);?> - - - + + + @@ -109,7 +109,9 @@ - + diff --git a/files_reader/templates/epubreader.php b/files_reader/templates/epubreader.php index 8f2a9dc..da6ca87 100644 --- a/files_reader/templates/epubreader.php +++ b/files_reader/templates/epubreader.php @@ -36,7 +36,7 @@ <?php p($title);?> - + @@ -155,7 +155,7 @@
@@ -209,7 +209,7 @@
@@ -283,7 +283,7 @@
- +
diff --git a/files_reader/templates/pdfreader.php b/files_reader/templates/pdfreader.php index 7513ce4..a47410e 100644 --- a/files_reader/templates/pdfreader.php +++ b/files_reader/templates/pdfreader.php @@ -36,7 +36,7 @@ <?php p($title);?> - + @@ -113,7 +113,7 @@
- + diff --git a/files_reader/vendor/cbrjs/cbr.js b/files_reader/vendor/cbrjs/cbr.js index 503f2fa..077369c 100644 --- a/files_reader/vendor/cbrjs/cbr.js +++ b/files_reader/vendor/cbrjs/cbr.js @@ -50,7 +50,7 @@ CBRJS.Reader = function(bookPath, _options) { } xhr.open('GET',url, true); - + options.start(filename); xhr.responseType = "arraybuffer"; @@ -70,10 +70,10 @@ CBRJS.Reader = function(bookPath, _options) { reader.options.session.size = e.total; }; - xhr.onload = function () { + xhr.onload = function () { if ((this.status === 200) && this.response) { var done = false; - var ua = new bitjs.archive[archive_class](this.response, 'vendor/bitjs/'); + var ua = new bitjs.archive[archive_class](this.response, document.head.dataset.basepath + 'vendor/bitjs/'); ua.addEventListener(bitjs.archive.UnarchiveEvent.Type.START, function (e) { $progressbar.css('width', '0%'); @@ -120,9 +120,9 @@ CBRJS.Reader = function(bookPath, _options) { $('.icon-unarchive').removeClass('active'); $('.icon-unarchive').addClass('error'); $('#message').text('Failed to extract images from archive, file corrupted?'); - + }); - } + } ua.start(); }; @@ -261,7 +261,7 @@ ComicBook = (function ($) { thumbnails: true, // true / false (use thumbnails in index) thumbnailWidth: 200, // width of thumbnail sidebarWide: false, // use wide sidbar - currentPage: 0, // current page + currentPage: 0, // current page keyboard: { 32: 'next', // space 34: 'next', // page-down @@ -276,7 +276,7 @@ ComicBook = (function ($) { 70: 'toggleFullscreen', // f 27: 'closeSidebar' // esc }, - vendorPath: 'vendor/', + vendorPath: document.head.dataset.basepath + 'vendor/', forward_buffer: 3, session: { getCursor: function() {}, @@ -442,7 +442,7 @@ ComicBook = (function ($) { break; default: console.log("unknown enhancement: " + JSON.stringify(prop)); - } + } } }; @@ -570,7 +570,7 @@ ComicBook = (function ($) { }; /** - * Insert thumbnail into TOC + * Insert thumbnail into TOC */ ComicBook.prototype.tocInsert = function (image, page, replace) { var placeholder = toc.children[page].firstChild; @@ -578,7 +578,7 @@ ComicBook = (function ($) { placeholder.parentNode.replaceChild( self.getThumb(image), placeholder - ); + ); } toc.children[page].addEventListener('click', function (e) { @@ -1407,7 +1407,7 @@ ComicBook = (function ($) { page = options.currentPage; } - document.getElementById('toc').parentNode.scrollTop = + document.getElementById('toc').parentNode.scrollTop = document.getElementById('page-' + String(page + 1)).offsetTop - Math.floor($('.panels').height() * 1.5); }; @@ -1474,5 +1474,3 @@ ComicBook = (function ($) { } })(window, jQuery); - - diff --git a/files_reader/vendor/cbrjs/css/cbr.css b/files_reader/vendor/cbrjs/css/cbr.css index ffdbfd1..00d3164 100644 --- a/files_reader/vendor/cbrjs/css/cbr.css +++ b/files_reader/vendor/cbrjs/css/cbr.css @@ -116,7 +116,13 @@ body:not(.mobile) .navigate:hover { #cbr-loading-overlay { z-index: 100; - background: #000 url("img/loading.gif") no-repeat center; + padding: 0; + width: 20px; + height: 20px; +} + +#cbr-loading-overlay > img { + width: 100%; } .overlay {