pr0gramm-iOS icon indicating copy to clipboard operation
pr0gramm-iOS copied to clipboard

Adding posts to favorites seems broken

Open Flatric opened this issue 1 year ago • 8 comments

If you add a post to your favorites it looks like it will be updated and the heart button will light up. However the post will not show up in your favorites

Flatric avatar Nov 18 '24 06:11 Flatric

Hi there,

This behaviour is probably expected. When you add a post to your favourites, the heart icon automatically lights up to indicate that it has been marked as a favourite.

If the post isn't appearing in your Favourites section, it might be due to content filters such as "SFW", "NSFW" or "NSFL". Another potential solution is to switch the view from "Beliebt" to "Neu."

I hope this helps! I encountered the same issue when I first started using the iOS app.

Best regards, Silas

SiBurgmaier avatar Nov 18 '24 08:11 SiBurgmaier

Hi Silas, No that is not what’s happening. I’m using the app for about a year now and the issue only started to appear recently. It has nothing to do with the filters

Flatric avatar Nov 18 '24 08:11 Flatric

Yo, no idea what's wrong. I get {"error":"badRequest","code":400,"msg":null} back. Something in the API changed recently. Too bad nothing is versioned. I could fix adding tags but I am in the dark with favs.

The app is basically abandonware, I will do small fixes if needed. There is some mobile app coming from the pr0 owners soon. At least that's what I heard about the redesign.

NickAtGit avatar Nov 19 '24 01:11 NickAtGit

Hi Nick, i did some investigation on how to fix the favorites. The solution could be quite simple.

For adding a post to the favorites (default collection): POST https://pr0gramm.com/api/collections/add Header contains all the usual stuff Body requires following content: itemId=6445071&_nonce=3c079e66f9fe1505 itemId is obviously the current pic or vid _nonce looks like trash to me. You did handle the parameter already in the tags-function... The response after adding content to the collection looks like this: {"success":true,"collectionId":0815,"ts":1735283871,"cache":null,"rt":6,"qc":4} collectionId is favorite list (maybe different for each user) ts is the current unix timestamp

For removing a post from a collection: POST https://pr0gramm.com/api/collections/remove Header contains all the usual stuff Body requires following content: itemId=6445071&collectionId=0815&_nonce=3c079e66f9fe1505 itemId is obviously the current pic or vid collectionId is required to tell the backend from which list the content should be removed _nonce looks like trash to me. You did handle the parameter already in the tags-function... The response after removing content looks like this: {"success":true,"collectionId":0815,"ts":1735285107,"cache":null,"rt":7,"qc":4}

Important note: I changed to collectionId and _nonce to a random number. The "default"/favorites collection probably always has the same id. The _nonce value did change in my testing.

I hope this helps to fix the broken favorites function. Im a long time user (started around 2020) of your app and really appreciate your work.

3rr0r404 avatar Dec 27 '24 07:12 3rr0r404

Wtf what a coincidence :O

i just wanted to get into iOS development and what would be better than fixing some small stuff in an already existing repo. But i would have never thought that someone will do the same thing at the same time xD

Anyways, i can confirm everything @3rr0r404 just wrote and i guess that would be enough to fix this issue.

Sashimiyo avatar Dec 27 '24 11:12 Sashimiyo

@Sashimiyo @3rr0r404 make a pull request please. It's a small fix I guess and a great learning opportunity!

NickAtGit avatar Dec 27 '24 19:12 NickAtGit

Hi Nick,

Any updates here? I would help if I could, but I have never touched anything aside from Python. Would love to see this resolved. It seems like the problem is tracked down already.

TheFiMo avatar Jan 15 '25 18:01 TheFiMo

@TheFiMo I semi fixed it locally but it doesnt feel ready for a PR and unfortunately dont have the time to continue on that. if you are interested (and have a mac at hand, of course) just clone the project and look around. at least thats what i did even though i have never seen a line of swift before (and the more i see and use it the more i like it :D).

if you have enough experience in software development it should not be a huge deal but to give you a heads up check out InfoView where the logic of tapping the button is and follow it through until the Pr0grammConnector which is the interface to the pr0 api.

Sashimiyo avatar Jan 15 '25 19:01 Sashimiyo