Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: convert public ip to json (#4332)
* refactor: improve retrieval and handling of public IP address The code in `info_game.sh` has been refactored to enhance the process of retrieving and handling the public IP address. The changes include: - Using the API endpoint `http://ip-api.com/json/` instead of `https://api.ipify.org` - Storing the retrieved data in `publicip.txt` - Extracting additional information such as country and country code using `jq` These improvements aim to provide more accurate and detailed information about the public IP address. * refactor: update API URL and set default values for public IP, country, and country code The commit refactors the code by updating the API URL to remove a trailing slash. Additionally, it sets default values for the variables `publicip`, `country`, and `countrycode` when the file `${tmpdir}/publicip.txt` is not found. * feat: cache and retrieve public IP address This commit adds functionality to cache the public IP address for 24 hours. If the cached IP address is older than 24 hours or doesn't exist, a new request is made to retrieve the public IP address. The retrieved IP address is then stored in a file for future use. Additionally, if there are any errors during the retrieval process, appropriate warning messages are logged and default values are set for the IP address, country, and country code. Co-authored-by: AI Assistant <[email protected]> * feat: cache and retrieve public IP address This commit adds functionality to cache the public IP address for 24 hours. If the cached IP address is older than 24 hours or doesn't exist, a new request is made to retrieve the public IP address. The retrieved IP address is then stored in a file for future use. Additionally, if there are any errors during the retrieval process, appropriate warning messages are logged and default values are set for the IP address, country, and country code. * refactor: improve caching and logging of public IP address The code has been refactored to use a JSON file instead of a text file for caching the public IP address. The log messages have also been updated to provide more informative output. * refactor(info_messages): Remove Mailgun alert This commit refactors the `info_messages.sh` module by removing the Mailgun (email) alert functionality. The code changes remove the corresponding section that displays the Mailgun alert status in the info message script. This change simplifies and streamlines the code by eliminating unused functionality. --------- Co-authored-by: AI Assistant <[email protected]>
- Loading branch information