Yetangitu / owncloud-apps

Applications for Nextcloud and Owncloud personal cloud server
GNU Affero General Public License v3.0
86 stars 41 forks source link

Fix deprecated calls in files_reader app #108

Open e-alfred opened 6 years ago

e-alfred commented 6 years ago

Hello,

I fixed up the deprecated OCP\JSON and OCP\Config calls for Nextcloud 14+.

onliniak commented 6 years ago

Hmm … now I have problem with OPDS.

Internal server error → https://github.com/Yetangitu/owncloud-apps/tree/cf484a2ab4a77c350be63522cd03bb8e7fd76074/files_reader

Błąd wewnętrzny serwera
Serwer nie był w stanie dokończyć Twojego żądania.

Jeśli to się powtórzy, wyślij proszę szczegóły techniczne administratorowi serwera.

Więcej szczegółów można znaleźć w logu serwera.

Szczegóły techniczne
Adres zdalny: my ip
ID żądania: kHDtPoAPvyQwwtDJx2RK
Typ: Error
Kod: 0
Komunikat: Class 'OCP\Config' not found
Plik: /usr/home/www/nextcloud/public_html/apps/files_opds/lib/config.php
Linia: 28

Ślad
#0 /usr/home/www/nextcloud/public_html/apps/files_opds/personal.php(20): OCA\Files_Opds\Config::get('enable', false)
#1 /usr/home/www/nextcloud/public_html/lib/private/legacy/app.php(622): include('/usr/home/onlin...')
#2 /usr/home/www/nextcloud/public_html/lib/private/Settings/Manager.php(365): OC_App::getForms('personal')
#3 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(93): OC\Settings\Manager->getPersonalSections()
#4 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(46): OC\Settings\Controller\PersonalSettingsController->formatPersonalSections('personal', 'personal-info')
#5 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(125): OC\Settings\Controller\PersonalSettingsController->getNavigationParameters('personal', 'personal-info')
#6 /usr/home/www/nextcloud/public_html/settings/Controller/PersonalSettingsController.php(57): OC\Settings\Controller\PersonalSettingsController->getIndexResponse('personal', 'personal-info')
#7 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Http/Dispatcher.php(166): OC\Settings\Controller\PersonalSettingsController->index('personal-info')
#8 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Http/Dispatcher.php(99): OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Settings\Controller\PersonalSettingsController), 'index')
#9 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/App.php(118): OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Settings\Controller\PersonalSettingsController), 'index')
#10 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\AppFramework\App::main('OC\\Settings\\Con...', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#11 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#12 /usr/home/www/nextcloud/public_html/lib/private/Route/Router.php(297): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#13 /usr/home/www/nextcloud/public_html/lib/base.php(987): OC\Route\Router->match('/settings/user')
#14 /usr/home/www/nextcloud/public_html/index.php(42): OC::handleRequest()
#15 {main}

Of course without fixed files_reader OPDS works. For info.

scurrvy2020 commented 6 years ago

I'm getting this error with these commits: ArgumentCountError: Too few arguments to function OCP\Util::connectHook(), 3 passed in /srv/http/nextcloud/apps/files_reader/lib/Hooks.php on line 22 and exactly 4 expected

I think this is the relevant section of Hooks.php: class Hooks {

20
21     public static function register() {
22         Util::connectHook('js', 'OCA\Files_Reader\Hooks', 'announce_settings');
23
24         \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) {
25             $fileId = $node->getId();
26             $connection = \OC::$server->getDatabaseConnection();
27             self::deleteFile($connection, $fileId);
28         });
29         \OC::$server->getUserManager()->listen('\OC\User', 'preDelete', function (User $user) {
30             $userId = $user->getUID();
31             $connection = \OC::$server->getDatabaseConnection();
32             self::deleteUser($connection, $userId);
33         });
34     }
35
manvalls commented 5 years ago

@onliniak @scurrvy2020 I've managed to get this to work, you can get my version here: https://github.com/manvalls/owncloud-apps/blob/master/dist/files_reader-1.2.3-patched-4-NC.tar.gz?raw=true https://github.com/manvalls/owncloud-apps/blob/master/dist/files_opds-1.2.3-patched-4-NC.tar.gz?raw=true

Related code: https://github.com/manvalls/owncloud-apps/commit/8bdd623ca431d4c43148e2fb6abb5928e1d34d3c

thomas2403 commented 5 years ago

@manvalls Sorry, but files_opds still seems to have a problem. When I try to enter settings as admin I'm getting:

Error: Call to undefined method OCP\User::getDisplayName()

manvalls commented 5 years ago

Right, didn't test opds. But hey, at least the reader is working! :D

e-alfred commented 5 years ago

@manvalls Your version works well, except that it doesn't open *.cbr/cbz files even if they are enabled in the settings menu.

hcharbonnier commented 5 years ago

I fixed files_opds, if any of you is interested : https://github.com/hcharbonnier/owncloud-apps

manvalls commented 5 years ago

Alright guys I've merged @hcharbonnier's changes and fixed the cbr/cbz issue:

https://github.com/manvalls/owncloud-apps/blob/master/dist/files_reader-1.2.3-patched-5-NC.tar.gz?raw=true

https://github.com/manvalls/owncloud-apps/blob/master/dist/files_opds-1.2.3-patched-5-NC.tar.gz?raw=true

scurrvy2020 commented 5 years ago

@manvalls are all of your changes in a pull request? (I'm just curious)

Thanks so much for making these changes so it will work in 14.

psychodogg commented 5 years ago

Seems to be having issues saving settings and opening to last page opened.

scurrvy2020 commented 5 years ago

How is it looking for this app and NC15? Has anyone tried it?

e-alfred commented 5 years ago

The new grid view button introduced by Nextcloud 15 overlaps the close button of this app, otherwise it works pretty well.

scurrvy2020 commented 5 years ago

Ok, I've upgraded and it works just fine. The grid view button gets in the way of other apps as well.

scurrvy2020 commented 4 years ago

@e-alfred I've been using your patches through NC16 and it was working great. However, with NC17 there are some changes and it seems the frame to display the book isn't being handled correctly.

Are you still trying to maintain this app?

I noticed on mobile (chrome and firefox) the app will open in a new tab and everything renders correctly. Do you know of a way to get it to open a new tab on desktop?

noci2012 commented 4 years ago

i took a stab @ files_opds https://github.com/Yetangitu/owncloud-apps/pull/121

e-alfred commented 4 years ago

@scurrvy2020 I still use @manvalls release which is more complete than my quick fix. I can reproduce your problem and mobile works because it loads the viewer in a new tab without the Files app interfering.

e-alfred commented 4 years ago

@scurrvy2020 I fixed this in https://github.com/e-alfred/owncloud-apps/commit/0678c795e235ce56649eaec715a8d9e72bde8f4c. It loads in a new tab now instead of an Iframe.

scurrvy2020 commented 4 years ago

Thanks a lot! I'll add it to @manvalis fork.

e-alfred commented 4 years ago

@scurrvy2020 I could start to maintain this app and push a new version to the app store (under a different name) if some people want to help me fix problems that arise.

Maybe @manvalls @noci2012 @hcharbonnier want to help out?

noci2012 commented 4 years ago

why not. (i am no wizard on the Nextcloud API, maybe an apprentice, if a can help i will).

scurrvy2020 commented 4 years ago

@e-alfred I'm in! I think it would be great. I was thinking of doing that myself, but I'm still too novice.

e-alfred commented 4 years ago

I will publish the app into the app store once again and therefore already requested a certificate for it: https://github.com/nextcloud/app-certificate-requests/pull/293

If anynone wants to help me maintaining the app, all PRs are welcome on my repository.

scurrvy2020 commented 4 years ago

Thanks! Still working fine with your latest patches.

On Sat, 21 Mar 2020, 06:11 e-alfred, notifications@github.com wrote:

I will publish the app into the app store once again and therefore already requested a certificate for it: nextcloud/app-certificate-requests#293 https://github.com/nextcloud/app-certificate-requests/pull/293

If anynone wants to help me maintaining the app, all PRs are welcome on my repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yetangitu/owncloud-apps/pull/108#issuecomment-601931833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE5J4B3I7UFMEHEDPYUNZWDRIPSYTANCNFSM4FXSOY5A .

e-alfred commented 4 years ago

Future app development will happen in this repository: https://github.com/e-alfred/epubreader

@manvalls @noci2012 @everybody Any help is appreciated to continue the the development of this app.