Yetangitu / owncloud-apps

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

Aldiko problem #66

Closed azfirefighter closed 6 years ago

azfirefighter commented 6 years ago

Used FBreader with no problem. Everything worked as expected. Switched to Aldiko and all I get is raw XML. Switched to Aldiko Premium and it's the same issue. Maybe the plugin is NOT compatible with Aldiko after all. Using current version of plugin with NC 12.0.3.

Yetangitu commented 6 years ago

I'll download Aldiko and test again, it has been a while since I tested that app.

azfirefighter commented 6 years ago

Updated to the last version you released (0.8.5) and when I access the catalog in FBreader, I still get redirected to my browser and get just XML.

Yetangitu commented 6 years ago

I just tested with both Aldiko as well as FBReader, both work as expected. Aldiko does not show cover images which is a known problem with this program but downloading works fine.

That you get XML means that OPDS Catalog works as intended. As to why your OPDS client does not accept it is puzzling though.

Try this: select the XML (minus the <?xml version="1.0" encoding="UTF-8"?> header), copy it to the clipboard, open the following site:

http://opds-validator.appspot.com/

select 'validate by direct input', paste the XML in the textfield and click the 'check' button. It should say 'Validation Successful' in a green field, like so:

image

azfirefighter commented 6 years ago

The online validator says the output isn't valid. Can't attach pics on my phone's client, so I will attach them in the morning.

azfirefighter commented 6 years ago

Images removed

azfirefighter commented 6 years ago

Did a couple of other tests. No matter how I put the URL into Aldiko, it doesn't recognize anything as usable XML and dumps it off to the browser. I tested the URLs with Firefox Mobile, Firefox Focus Mobile and Samsung Internet browsers. None of them recognize the XML as usable. To them it's just and XML with no style information. However, Firefox Nightly Desktop actually recognizes the XML format and gives me clickable links. Don't know if it helps you or not.

Yetangitu commented 6 years ago

Have a look at the source to the XML page in a browser. Something seems to be filtering the XML namespace declaration from that page, the header as defined in the template looks like this:

<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:dc="http://purl.org/dc/terms/"
      xmlns:dcterms="http://purl.org/dc/terms/"
      xmlns:opds="http://opds-spec.org/2010/catalog">

…while your examples only show:

<feed>

Check the template file in your installation, it should contain those 4 lines I quoted above (line 23-36 of files_opds/templates/feed.php)

Yetangitu commented 6 years ago

BTW, that browsers don't recognise the XML as usable in any way is not surprising, to a browser it is nothing but XML without any style declaration. OPDS clients should recognise it though.

Yetangitu commented 6 years ago

Do you happen to use a proxy (direct or reverse) when accessing NC?

azfirefighter commented 6 years ago

Nope. No proxies of any kind.

azfirefighter commented 6 years ago

Question. My installation shows 0 books on my bookshelf and still shows the same after I rescan. Would that have anything to do with my issue?

Yetangitu commented 6 years ago

No, the bookshelf just shows a chronological list of books you've downloaded recently. I should probably rename it to 'recent books' as I get so many questions about this.

What about the missing namespace declarations? Do they show up when you access the site through curl like so?

curl -basic -u username https://yoursite.example.org/apps/files_opds/

It will ask for your password, then dump the OPDS root page. Does this still say <feed> or does it now contain the full namespace declaration?

azfirefighter commented 6 years ago

I'm getting other errors now. Have no CLUE what's going on now. Uninstalled the module yesterday because of the same issue. Reinstalled this AM and still getting the same error. Ran an integrity test on both the core and the module and everything comes back as unmodified. I'll run a few more tests and get some info for you.

azfirefighter commented 6 years ago

I reinstalled the module directly from github (still getting the invalid signature error). I've attached either php or text versions of the errors I'm receiving now. Before THIS set of errors popped up, the full namespace declarations were being sent, Aldiko would just dump me into a browser.

Attachments Deleted

Yetangitu commented 6 years ago

As long as NC and OC don't come together on a solution to the appinfo/signature.json collision (https://github.com/nextcloud/server/issues/8001) you'll get those invalid signature errors when installing directly from Github (...until I remove appinfo/signature.json from the repository...), this is why the latest release comes in two versions - one for NC without that file, one for OC with.

This also invalidates the results from those integrity checks. BTW, remove those files ASAP as one of them contains a hint to your usage of Google Analytics.

The last file (PDF) indicates things are not working at all at the moment, the browser tries to interpret the NC front page as XML (<head> is HTML, line 39 column 8 in the front page is a link to a stylesheet).

I'd say the best way to go to get to the bottom of this problem is to remove _filesopds from your system (i.e. remove NC_ROOT/apps/files_opds), run occ upgrade --no-app-disable (it should install the latest version from the app repository) and try again. This way you should not get any signature errors, if you do something else is amiss. Once installed and configured try to access the feed in a browser, you should get the OPDS root page. If the XML namespace statements are missing there is something on your system - or between your browser and your server - which removes them. Without those headers OPDS clients won't know how to interpret the feed.

azfirefighter commented 6 years ago

It was just a proof for Google API access, but I nuked it and killed the other images and attachments. I'm in the process of upgrading the base to 13 (need access to another app that's only compatible with that version). Will see what happens. All else fails, I'll just use my Kindle or Google libraries with Aldiko.

azfirefighter commented 6 years ago

Disabled the plugin, removed it and made sure that any directory or DB entry for it was removed. Updated the system 13 RC2 and reinstalled the plug in. Now I'm getting a XML parsing error. XML Parsing Error.pdf

Yetangitu commented 6 years ago

That is not XML, just like the previous PDF. It is HTML (<script nonce=... etc.). Did you enable OPDS Catalag for your user? It is disabled by default.

Yetangitu commented 6 years ago

Any progress?

rspierenburg commented 6 years ago

I am getting the same result as the OP. Just a webpage that says "This XML file does not appear to have any style information associated with it. The document tree is shown below."

Yetangitu commented 6 years ago

Do you get that result when trying to access the feed with Aldiko or when you use a browser? Does it work with another OPDS client (FBreader, Moon Reader, etc)? If not, does the page shown in the browser actually show XML as shown above or is it HTML? If the former OPDS Catalog works, if the latter it does not (or is not enabled for the current user).

rspierenburg commented 6 years ago

It seems it only doesn't work with Aldiko. Perhaps with one of their updates their broke it. I will check out their forums. Thank you

Yetangitu commented 6 years ago

Thing is, for me it does work with Aldiko (except for the images, a known problem with Aldiko which delegates image loading to Android without handing over authentication data) so there is something amiss somewhere - question is where.

rspierenburg commented 6 years ago

For what it's worth. I am using the Premium Aldiko app on both my phone and tablet and neither one works.

Yetangitu commented 6 years ago

For those who have problems with Aldiko, please post a dump of the root feed as produced by curl or wget, e.g.:

$ curl --basic -u frank https://nextcloud.example.org/apps/files_opds/
Enter host password for user 'frank':
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:dc="http://purl.org/dc/terms/"
      xmlns:dcterms="http://purl.org/dc/terms/"
      xmlns:opds="http://opds-spec.org/2010/catalog">
  <id>id:12345678-9abc-def0-1234-567890123456</id>
  <title>Frank de Lange&#039;s Library</title>
  <subtitle>Nextcloud OPDS catalog</subtitle>
  <updated>2018-02-04T19:32:59+00:00</updated>
  <author>
    <name>Frank de Lange</name>
  </author>

  <link rel="start"   
        href="?id=root"
        type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
  <link rel="self"    
        href="?id=5"
        type="application/atom+xml;profile=opds-catalog;kind=navigation"/>

  <entry>
    <title>Browse catalog</title>
    <updated>2018-02-04T19:32:59+00:00</updated>
    <content type="text">Browse the catalog in alphabetical order</content>
    <link type="application/atom+xml;profile=opds-catalog;kind=navigation"
        href="?id=directory"/>
    <id>id:by_directory</id>
  </entry>
  <entry>
    <title>Frank de Lange&#039;s bookshelf</title>
    <updated>2018-02-04T19:32:59+00:00</updated>
    <content type="text">This bookshelf contains 45 books</content>
    <link type="application/atom+xml;profile=opds-catalog;kind=navigation"
        href="?id=bookshelf"/>
    <id>id:by_bookshelf</id>
  </entry>
</feed>

If this command does not produce XML as shown please ensure that OPDS Catalog is enabled for your user. If it is have a look at the log for anything which might be of interest, e.g. anything related to 'files_opds' or the library root directory.

If you're using a custom theme please also try with this theme disabled. There seems to be a bug somewhere in Nextcloud/Owncloud which can make the pretty URL logic fail with some themes.

Yetangitu commented 6 years ago

Here's Aldiko showing the root page for my library...

image

...and here it is showing some of its contents (without cover images due to the mentioned Aldiko problem):

image

Yetangitu commented 6 years ago

BTW, the only known way to get cover images to show in Aldiko is by having them served on an open connection, i.e. without authentication. This could be implemented in OPDS Catalog but I don't think it is worth the effort nor the risk of data leakage etc.

rspierenburg commented 6 years ago

So I tried the curl command and nothing was produced. I checked and my user has opds enabled.

Yetangitu commented 6 years ago

Hm, strange and stranger. I'm working on a modernisation of OPDS Catalog - it originated outside of the AppFramework and is not exactly a showcase of modern NC/OC programming - which will be quite different on the inside but still speak OPDS to the world. I hope to have a preview available in a few days, once it is there you might want to give it a try to see if it solves your problems.

rspierenburg commented 6 years ago

Just to let you know, I just upgraded to Nextcloud 13 and the issue seems to have resolved itself.

Yetangitu commented 6 years ago

Good, if only all bugs resolved themselves. Closing this one for now.

rspierenburg commented 6 years ago

I know this is closed but just for continuity sake the issue I was having turned out to be 100% user error. Turns out for the Web address I had input HTTP:// and not HTTPS://

pr11me commented 10 months ago

Have a look at the source to the XML page in a browser. Something seems to be filtering the XML namespace declaration from that page, the header as defined in the template looks like this:

<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:dc="http://purl.org/dc/terms/"
      xmlns:dcterms="http://purl.org/dc/terms/"
      xmlns:opds="http://opds-spec.org/2010/catalog">

…while your examples only show:

<feed>

Check the template file in your installation, it should contain those 4 lines I quoted above (line 23-36 of files_opds/templates/feed.php)

Bro, wherever you are almost six years later, I thank you from the bottom of my heart ^^ I desperately tried to make Calibre-Web work with the Android reader "Aldiko Next". It was just showing the raw xml input. After your hint, I patched cps/templates/index.html to include all namespace declarations as shown in your snippet since it contained only the first one with "Atom"...Eureka!