Adamantcheese / Kuroba

Kuroba - imageboard browser for Android
GNU General Public License v3.0
393 stars 29 forks source link

Add embeds for DLsite from dlsite.com links and RJ codes #1394

Closed Twinov closed 1 year ago

Twinov commented 2 years ago

This PR adds embeds for dlsite.com when links or RJ codes (RJ followed by 6 digits like RJ**) are posted.

The embedder parses from the dlsite API and adds in the cover image and title, mostly based on the existing Pixiv embedder. For the RJ code parsing/embedding, I had to modify the cached embed helper method to avoid okhttp3 crashing, since the target text being replaced isn't in the form of a link. Also, I wasn't able to get span injection working, so clicking on a replaced RJ code just shows a "No applications were found to open this link" toast instead (the embedder for direct dlsite.com links works as expected and opens the work in the browser).

Usually people post dlsite links and RJ codes on Japanese game threads like /vn/ and /hgg2d/ on 4chan's /vg/ or the Voice Thread on /h/, so those are what I used to test the embeds.

Sorry if I made any mistakes, I just installed Android Studio yesterday 😅

Twinov commented 2 years ago

I made the changes requested including combining the dlsite.com and rjcode embedders into one file, thanks for the advice. Let me know if there's any other issues to resolve.

Also, unrelated to the pull request, but when I was working on the embedder, I saw in my git that Kuroba/app/src/main/assets/archives.json had changes under foolfuuka, seems like they added /c/, /mu/, /vp/ and /vrpg/. I didn't include them obviously, but I'm guessing that gradle is set up to automatically poll the archive sites for changes and update the file accordingly, so it may be worth another PR to add them in.