ilpersi / BHBot

A bot that automates a game called Bit Heroes
GNU General Public License v3.0
28 stars 32 forks source link

url check at bot start #156

Closed DieNastie closed 4 years ago

DieNastie commented 4 years ago

this might be just one line of code let the bot check if the url at the start of chromium is already the correct one

i use useDoNotShareURL 1 as my homepage but the bot then frist goes to kong only then to load the actual url after that thats 3 siteloads back to back

ilpersi commented 4 years ago

I would like to have it so as well. 😄

TL;DR I'll try to keep this simple and the reasons why this is the way you see now are that:

To handle this, the bot has to:

The restart is required cause when the bot is not using the kong interface the graphics are in a different position and many different considerations have to be done at the code level to handle this.

I tweaked the logic many times before getting to the current solution that is the most conservative one: the URL switch is done one single time per run so if you leave the bot running for days this should not bother you.

The current solution also accounts for the safest security posture: if for any reason the URL is leaked to someone that is not you, this person will be able to use your account just pasting the URL in a browser (no user & pass would be required to log in) that's why the URL is not saved anywhere and it is only available in memory while the bot is running.

Most of the explanations above are also the reason why this parameter is "experimental" and not present in the standard settings.ini.

I hope this is clear enough. 👍

If you look in Chrome history you can see how the URL is changing over time:

image

DieNastie commented 4 years ago

ok this is all well but would at least the frist check be too much to ask? that would get rid of the frist kong load

i start/restart the bot multiple times per day

ilpersi commented 4 years ago

What the check should be?

DieNastie commented 4 years ago

just to check for https://www.kongregate.com/games/Juppiomenz/bit-heroes its simple but its a start

ilpersi commented 4 years ago

I don't get it.

I check for https://www.kongregate.com/games/Juppiomenz/bit-heroes .... And?

DieNastie commented 4 years ago

if that url is already being loaded skip loading it

ilpersi commented 4 years ago

Maybe I was not clear in my first explanation, so I will try to put in more simple terms.

When the bot is started the DO_NOT_SHARE_URL is unknwon. The only way to retrieve it is to load the standard URL (https://www.kongregate.com/games/Juppiomenz/bit-heroes) once.

There's no way that loading https://www.kongregate.com/games/Juppiomenz/bit-heroes can be skipped.

DieNastie commented 4 years ago

no you were clear enough but i wasnt sorry about that

issue is the normal kong link is being called twice chrome starts and loads BH on kong cus that is the homepage then the bots comes and loads the same url again after that it loads the DO_NOT_SHARE_URL

with my slow connection thats a 5 sec loss (or more) every restart/crash

ilpersi commented 4 years ago

I think I get it now!

You have the standard URL as homepage and you want the bot to check for that.

I'll have a look 🙂👍🏻

ilpersi commented 4 years ago

v45 is in with this feature packed in