Version 1.2.0
What's Changed
-
Additional Imports: The script now includes imports for
json,os,pyfiglet,time, andgevent.pywsgi. -
Boot Screen Functionality: There is a new function
boot_screenthat seems to be designed for displaying a startup screen or banner when the application is launched. It usespyfigletfor ASCII art and includes code for clearing the screen and printing in a specific color (orange). -
WSGIServer from gevent: The import of
WSGIServerfromgevent.pywsgisuggests that there might be a change in how the Flask app is served, potentially for improved performance or concurrency handling. -
Version Information and Banner Customization: The
boot_screenfunction includes code for displaying version information ("Version 1.2.0") and a custom banner with the developer's handle (@fled-dev). This addition enhances the user interface and provides immediate visibility of the application version. -
Enhanced Logging Functionality: A new function
loghas been introduced. It appears to handle logging messages with timestamps. This function is likely used to create or append to alogfile.txt, providing a detailed and time-stamped record of events and operations. -
Use of
datetimefor Timestamps: The script now involves the use ofdatetime(presumably imported) for generating current date and time, which is then formatted and included in log entries. -
Config File Handling: The new version includes a
get_configfunction to manage the application's configuration settings. This function reads aconfig.jsonfile, presumably containing key settings like API keys, server configuration, etc. -
Improved Log Management: Before reading the
config.jsonfile, the script checks for an existinglogfile.txtand deletes it if present. This step ensures that each session starts with a fresh log file, making it easier to track current session activities without confusion from previous logs. -
Enhanced Error Handling and Logging in Config Management: The script includes error handling for cases where the
logfile.txtdoes not exist and logs relevant messages, ensuring smoother operation and better traceability of events. -
Global Variable Definition from Configuration: The
get_configfunction now sets global variables based on the contents of theconfig.jsonfile. Variables such asFLASK_API_KEYS,TG_API_KEY,TG_CHANNEL_ID, andTG_NOTIFICATIONSare being initialized, suggesting a more dynamic and configurable approach to managing API keys and Telegram integration settings. -
Enhanced Configuration Management: The script logs the process of assigning configuration values to global variables, enhancing traceability and debugging capabilities. This approach indicates a move towards a more modular and configurable application design.
-
Refined Telegram Notification Function (
tg_notify):- The updated
tg_notifyfunction includes checks to ensure Telegram notifications are enabled (TG_NOTIFICATIONS). - The function now verifies the presence of the Telegram API key (
TG_API_KEY) and channel ID (TG_CHANNEL_ID) before proceeding with sending notifications. - If either the API key or the channel ID is missing, the function logs an error and returns without attempting to send a notification.
- The updated
-
Enhanced Telegram Notification Sending Logic:
- The
tg_notifyfunction now logs a message before sending a notification, improving transparency in the notification process. - The Telegram API URL is constructed using the
TG_API_KEY, and the notification is sent using a POST request. - After sending the notification, the script logs a confirmation message, ensuring that notification delivery attempts are tracked.
- Exception handling is included to capture and log any failures in sending Telegram notifications, enhancing the robustness and reliability of this feature.
- The
-
IP Location and Current IP Functions:
- The script includes enhanced IP location and current IP retrieval functions with improved logging. This will help in tracking and logging the IP addresses of API users.
-
Updated API Endpoint Implementation:
- The
/apiroute now includes additional logging for actions like reading the API key, checking its validity, and obtaining the seed phrase and receiver. - Enhanced Telegram notification integration within the API route, providing detailed status updates for various stages of API interaction.
- The
-
Execution Flow in Main Function:
- The script now starts with a boot screen and reads the configuration using
get_config. - It defines the host IP and port for the Flask server (set to '0.0.0.0' and 8080 respectively).
- Implements a WSGI server using
geventfor running the Flask app, which can offer better performance and handle concurrent requests more efficiently.
- The script now starts with a boot screen and reads the configuration using
-
WSGIServer for Flask App:
- The use of
WSGIServerfromgevent.pywsgifor running the Flask app suggests a move towards a more production-ready setup. This server can handle multiple simultaneous requests, making it more suitable for real-world deployment than the default Flask server.
- The use of
-
Comprehensive Error Handling and Logging:
- The main function includes comprehensive error handling and logging, ensuring robustness in the application's execution and startup process.
Full Changelog: v1.1.0...v1.2.0