autodl-community / autodl-rutorrent

ruTorrent plugin for autodl-community fork of autodl-irssi
http://autodl.community
93 stars 23 forks source link

Return value from attemptZeroConfig() is not checked #37

Closed weaselBuddha closed 7 years ago

weaselBuddha commented 7 years ago

What the user sees: Error downloading files. Make sure autodl-irssi is started and configured properly (eg. password, port number): Error getting files listing: Error: Invalid port ()! Initialize port in conf.php

If ~/.autodl/autodl.cfg exists and is local, the port and password from conf.php is not used. But if autodl.cfg is empty the zero configuration process fails to recognize it did not get a port or password.

In getConf.php, after calling attemptZeroConfig( ), $config is not checked as null, giving both a null port and null password.

We use autodl2.cfg for just the port and and password settings. This allows the tracker and filter configurations to be portable. An empty autodl.cfg is created by running irssi/autodl the first time.

thebigmunch commented 7 years ago

Sorry, I kept forgetting to respond to this.

I forgot that the gui-server options could be set in autodl2.cfg when @anthonyryan1 submitted that PR. Frankly, I've never found a good reason for it to exist and specify those options in autodl.cfg. It doesn't really help with portability, since you'll have to set them in one file or another anyway. However, it should still be checked by parsing the file and conditionally merging the two config files with autodl2.cfg over autodl.cfg to match autodl-irssi behavior.

As for the error when these options aren't set, I will likely just update it to inform user to set the gui-server options in autodl.cfg rather than conf.php. That is what would be required either way. And once the above problem is fixed, conf.php never comes into play.

anthonyryan1 commented 7 years ago

I'll have a pull request ready for testing first thing in the morning. My apologies for the regression.

anthonyryan1 commented 7 years ago

Could I ask you to please test the version of getConf here, and let me know if it properly resolves the issue for you:

https://github.com/anthonyryan1/autodl-rutorrent/blob/master/getConf.php