Ikabot-Collective / ikabot

A Python-based bot designed for automating tasks in the game Ikariam
https://discord.com/invite/3hyxPRj
MIT License
89 stars 62 forks source link

Ikabot web server #242

Closed ikagod closed 3 months ago

ikagod commented 3 months ago

This PR will add the Ikabot web server. The ikabot web server is a web server that runs locally on a randomly chosen port between 43000 and 45000 based on the user's email address used to log into Ikabot, and the hostname of the Ikariam world server they are currently playing on. The web server acts like a reverse proxy. For each request sent to it, it will forward it to the appropriate Ikariam world server through Ikabot's post and get functions, and then return that result back to the browser that send the request. The purpose of this web server is to avoid having to synchronize the cookies between your browser and ikabot, as this is a complicated process that very often fails if it's not done precisely and correctly. Some requests are intercepted, and modified, while others are intercepted and their cached results are returned. This minimizes the number of requests ikabot sends to ikariam, but it could result in the user not getting appropriate updates when ikariam is updated. If this happens it's enough to clear the ikabot web server cache, located in /tmp/ikabot.webcache or %temp%/ikabot.webcache.

It's important to note that for this web server to work, the user must install and additional external dependency called flask. If this dependency is not installed, the web server will not run and instead prompt the user to install flask first before running the module again.

ElieTaillard commented 3 months ago

For the version, it may be worth creating a version.py file

# version.py
__version__ = '0.1.0'
__commit_sha__ = 'abcdef1234567890'

So that we can import this file in setup.py and other files to get the version easily What do you think ?

ikagod commented 3 months ago

For the version, it may be worth creating a version.py file

# version.py
__version__ = '0.1.0'
__commit_sha__ = 'abcdef1234567890'

So that we can import this file in setup.py and other files to get the version easily What do you think ?

Sounds great, although I don't think having the commit_sha is even possible due to the fact that the commit sha is calculated based on the current commit, so it can never find itself within the source code itself.

ElieTaillard commented 3 months ago

For the version, it may be worth creating a version.py file

# version.py
__version__ = '0.1.0'
__commit_sha__ = 'abcdef1234567890'

So that we can import this file in setup.py and other files to get the version easily What do you think ?

Sounds great, although I don't think having the commit_sha is even possible due to the fact that the commit sha is calculated based on the current commit, so it can never find itself within the source code itself.

Yeah, we'll see about sha later. In any case, you'll also have to modify the release pipeline to bump the version in the new file and maybe change the regex depending on the variable name you decide