Novik / ruTorrent

Yet another web front-end for rTorrent
Other
2.03k stars 414 forks source link

RSS plugin issues #2653

Closed ranirahn closed 6 months ago

ranirahn commented 7 months ago

Please complete the following tasks.

Tell us about your environment

Web Browser: Google Chrome 124.0.6367.79 ruTorrent: v4.3.0 PHP: PHP 8.1.2 OS: Linux Mint 21.3 x86_64

Tell us how you installed ruTorrent

I had v4.2.10 installed. git clone https://github.com/Novik/ruTorrent.git And then overwrite the rutorrent

Describe the bug

1) theWebUI.showRSS = function() { if($('#rssl').children().length) theWebUI.RSSManager(); else theDialogManager.toggle("dlgAddRSS"); }

Opens up "Add RSS Feed" window instead of "RSS Manager", even though i have ~10 RSS feeds in my list.

2) Another bug is that this RSS panel on the left does not show Feeds and Groups status anymore. Right click on it you can see status in that menu(disabled or enabled), but no changed icon on the list.

Steps to reproduce

1) Click on "RSS Downloader" button. 2) Always opens up "Add RSS Feed" window.

1) Right click on the RSS Feed 2) Click Disable Feed 3) Icon does not change.

Expected behavior

1) Click on "RSS Downloader" button. 2) If you have RSS Feeds, it opens up "RSS Manager" window and if no RSS Feeds, it opens up "Add RSS Feed" window.

1) Right click on the RSS Feed 2) Click Disable Feed 3) Icon change to disabled.

Additional context

In file plugins/rss/init.js this if($('#rssl').children().length) does not check if there are feeds or not. "rssl" does not exist anymore and I dont know what is replacement for it. Probably something similar is wrong with the RSS Feed status icon change or maybe CSS links to wrong thing. I tried to compare v.4.2.11 and v4.3 codes what changed, but that is just too much for me. There are just too many changes for me to find what is broken. In version v4.2.11 everything works.

ranirahn commented 7 months ago

I am sure its not right way to do it, but I get this RSS Manager open up correctly when i replaced if($('#rssl').children().length) with if(catlist.refreshPanel.prss().length > 1). Now when I delete my data and there is no RSS feeds it opens up Add RSS Feed window and if i have at least 1 Feed it opens up RSS Manager window.

stickz commented 7 months ago

@ranirahn Thanks for the bug report. Here is the code for the function. https://github.com/Novik/ruTorrent/blob/253da04e3900171a0cd5807f943d3ad4791c9cb7/plugins/rss/init.js#L699-L705

Could you replace if($('#rssl').children().length) with if($("#RSSList").children().length) Please let me know if this resolves your problem. If so, I will push out a hotfix for ruTorrent v4.3.

ranirahn commented 7 months ago

if($("#RSSList").children().length)

That doesn't work right. If I don't have any RSS Feeds it still opens up RSS Manager. If no Feeds it should open Add RSS Feed window instead.

If I use that line if(catlist.refreshPanel.prss().length > 1), then it works correctly, but that one makes a list from groups and feeds and All Feeds is also in that list so this list is never empty. There is always at least one element called All Feeds even if you dont have any feeds or groups. And also if you add empty RSS Group it still dont work because then it counts 2 but I am not sure if you can even make empty RSS group if you dont have any Feeds added first.

stickz commented 7 months ago

@TrimmingFool are you able to look into this regression with ruTorrent v4.3? I will distribute a hotfix once the user confirms a proper resolution to the problem. RSS is not my area of expertise. We have tried different things with no luck,

ranirahn commented 7 months ago

Figured out something. This function plugin.updatedRSSEntry = (labelId, attrs) => { attrs = { ...catlist.panelLabelAttribs.prss.get(labelId), ...attrs }; const icon = labelId in theWebUI.rssGroups ? 'rss-group' : 'rss'; const count = String( labelId === 'prss_all' ? Object.keys(theWebUI.rssItems).length : (theWebUI.rssLabels[labelId] ?? theWebUI.rssGroups[labelId]).cnt); const title =${attrs.text} (${count}); const selected = theWebUI.rssListVisible && catlist.isLabelIdSelected('prss', labelId); const alert = labelId in theWebUI.delayedRSSErrors ? '⚠' : null; return [labelId, {...attrs, icon, count, title, selected, alert}]; }

Adds icons for RSS, it does not include "rss-dis" option, and thats why disabled RSS feeds still have "rss" tags, even if Feed is disabled. So this row const icon = labelId in theWebUI.rssGroups ? 'rss-group' : 'rss'; needs 3 option.

stickz commented 7 months ago

Adds icons for RSS, it does not include "rss-dis" option, and thats why disabled RSS feeds still have "rss" tags, even if Feed is disabled. So this row const icon = labelId in theWebUI.rssGroups ? 'rss-group' : 'rss'; needs 3 option.

If you have a fix, could you test it and submit a pull request to master? I will release a hotfix.

ranirahn commented 7 months ago

Adds icons for RSS, it does not include "rss-dis" option, and thats why disabled RSS feeds still have "rss" tags, even if Feed is disabled. So this row const icon = labelId in theWebUI.rssGroups ? 'rss-group' : 'rss'; needs 3 option.

If you have a fix, could you test it and submit a pull request to master? I will release a hotfix.

I am sorry. My coding skills are way below this level. I can sometimes find the row that "can" be the issue, but rewrite something is little complicated for me. I hope someone much more skilled can fix the code.

ranirahn commented 7 months ago

The first problem could be fixed by replacing that if($('#rssl').children().length) with that if(Object.keys(this.rssLabels).length > 0) That counts only RSS Feeds and dont count groups or that "All Feeds" option. Second problem I have not managed to find solution yet.

ranirahn commented 7 months ago

I think I managed to do it with the help of ChatGPT 🤣

stickz commented 7 months ago

I think I managed to do it with the help of ChatGPT 🤣

Thanks, fix looks good. I will distribute a hot fix this weekend.

TrimmingFool commented 6 months ago

@ranirahn Thank you for the fix!