Mishiranu / Dashchan-Extensions

Dashchan extensions
GNU General Public License v3.0
48 stars 29 forks source link

Diochan extension revamp #26

Open Dashchanon opened 3 years ago

Dashchanon commented 3 years ago

A few months ago diochan switched engine from Kusaba to NPFchan, meaning the extension wouldn't work anymore. This is a working revamp based on lainchan's extension code, since lainchan also uses NPFchan.

Mishiranu commented 3 years ago

This code will need some rework, I'll take a look later.

Mishiranu commented 3 years ago

Well, as you can see, I don't have much time to do this. The problem is that I'm migrating all extensions into single branch (look at master branch), but I want to do some "generic implementations", like I already did for Wakaba and FoolFuuka engines (see master branch).

As far as I understand, NPFchan is based on vichan, which is based on tinyboard. So I need to migrate all tinyboard extensions first, then I'll work on vichan boards, and only after that I'll be able to handle NPFchan boards properly. This will take a lot of time, and I'm currently busy with other things in Dashchan client itself.

For instance, I reworked HTTP client interface (didn't push this change yet), and so on. All these changes won't be included to com.github.mishiranu:dashchan.library since this library is effectively deprecated. But I'll maintain API and ABI compatibility until all extensions will be migrated and updated (see "TODO CHAN" comments in the client code).

I'd recommended to distribute your extension yourself until I'll be able to work on it. It's not that hard, you can stick to 1.7 library until then, and host your own update data (just use a github repo with json files) and replace chan.extension.source URL in the manifest.

I didn't read the changes carefully, but I noticed you use HttpURLConnection to run HEAD requests in your DiochanModelMapper. Don't do this: you're doing HTTP requests bypassing HttpHolder, and the amount of requests may be high. Instead, just place the URL you extracted from JSON into Post entity without any additional checks. Then override onReadContent method in DiochanChanPerformer, where you can do multiple requests on demand to check 404 response for png images and try to load webp instead.