From 55346eb9ead87e81e3a9e491e55ac5254a31e48e Mon Sep 17 00:00:00 2001 From: Mehedi Hasan Shojib Date: Sun, 26 Jan 2025 10:20:02 +0600 Subject: [PATCH] fix: status page and update ## Summary by Sourcery Update the Docker base image to `5hojib/aeon:beta`. Simplify the upstream repository configuration by prioritizing configuration file values over environment variables, and falling back to the default `https://github.com/AeonOrg/Aeon-MLTB` repository and `main` branch if neither is set. Improve error handling in the update script by catching all exceptions when loading the configuration file. Remove the unused `SEARCH_LIMIT` setting and update the status page UI to dynamically generate buttons for filtering by status. Bug Fixes: - Fix an issue where the status page would not display all available statuses when there were more than 20 tasks. Enhancements: - Simplify the upstream repository configuration logic. --- CHANGELOG.md | 42 ---------------------------- bot/core/config_manager.py | 2 -- bot/helper/ext_utils/status_utils.py | 2 ++ bot/modules/bot_settings.py | 9 ++---- update.py | 15 ++++++---- 5 files changed, 14 insertions(+), 56 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 6d6579a32..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,42 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## v2.0.2 - 2025-01-22 - -### Fixed - -- Resolved case sensitivity issue in document type extension checks. -- Fixed channel-related issues for mirror and leech operations. -- Addressed the issue where thumbnails were removed after a restart. - -## v2.0.1 - 2025-01-20 - -### Fixed - -- Token generation issues caused by the command suffix. - -### Removed - -- The "refresh status" and "overview status" buttons, simplifying the status interface. - -## v2.0.0 - 2025-01-18 - -### Breaking Changes - -- Rebased the project on the latest MLTB version. - -### Added - -- Integrated all new features from MLTB, excluding NZB and jDownloader. -- Introduced watermark support for videos. -- Enabled the ability to use a user session string to download private media from Telegram. -- Reintroduced RSS feed support. -- Added versioning system. -- Added `CHANGELOG.md` to track changes. - -### Removed - -- Removed certain limit-related variables such as `MIRROR LIMIT` and `LEECH LIMIT`. diff --git a/bot/core/config_manager.py b/bot/core/config_manager.py index c63815e04..ca45c9ade 100644 --- a/bot/core/config_manager.py +++ b/bot/core/config_manager.py @@ -111,7 +111,6 @@ def load(cls): "BASE_URL", "RCLONE_SERVE_URL", "INDEX_URL", - "SEARCH_API_LINK", ] and value ): @@ -130,7 +129,6 @@ def load_dict(cls, config_dict): "BASE_URL", "RCLONE_SERVE_URL", "INDEX_URL", - "SEARCH_API_LINK", ] and value ): diff --git a/bot/helper/ext_utils/status_utils.py b/bot/helper/ext_utils/status_utils.py index 47c1f402e..756a954a1 100644 --- a/bot/helper/ext_utils/status_utils.py +++ b/bot/helper/ext_utils/status_utils.py @@ -256,6 +256,8 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step= if status != "All" or tasks_no > 20: for label, status_value in list(STATUSES.items()): if status_value != status: + if not buttons: + buttons = ButtonMaker() buttons.data_button(label, f"status {sid} st {status_value}") button = buttons.build_menu(8) if buttons else None msg += f"CPU: {cpu_percent()}% | FREE: {get_readable_file_size(disk_usage(Config.DOWNLOAD_DIR).free)}" diff --git a/bot/modules/bot_settings.py b/bot/modules/bot_settings.py index 7bcf66621..5376648c2 100644 --- a/bot/modules/bot_settings.py +++ b/bot/modules/bot_settings.py @@ -53,7 +53,6 @@ "DOWNLOAD_DIR": "/usr/src/app/downloads/", "LEECH_SPLIT_SIZE": TgClient.MAX_SPLIT_SIZE, "RSS_DELAY": 600, - "SEARCH_LIMIT": 0, "UPSTREAM_BRANCH": "main", "DEFAULT_UPLOAD": "rc", } @@ -204,9 +203,7 @@ async def edit_variable(_, message, pre_message, key): await update_buttons(pre_message, "var") await delete_message(message) await database.update_config({key: value}) - if key in ["SEARCH_PLUGINS", "SEARCH_API_LINK"]: - await initiate_search_tools() - elif key in ["QUEUE_ALL", "QUEUE_DOWNLOAD", "QUEUE_UPLOAD"]: + if key in ["QUEUE_ALL", "QUEUE_DOWNLOAD", "QUEUE_UPLOAD"]: await start_from_queued() elif key in [ "RCLONE_SERVE_URL", @@ -392,9 +389,7 @@ async def edit_bot_settings(client, query): if data[2] == "DATABASE_URL": await database.disconnect() await database.update_config({data[2]: value}) - if data[2] in ["SEARCH_PLUGINS", "SEARCH_API_LINK"]: - await initiate_search_tools() - elif data[2] in ["QUEUE_ALL", "QUEUE_DOWNLOAD", "QUEUE_UPLOAD"]: + if data[2] in ["QUEUE_ALL", "QUEUE_DOWNLOAD", "QUEUE_UPLOAD"]: await start_from_queued() elif data[2] in [ "RCLONE_SERVE_URL", diff --git a/update.py b/update.py index 1d11cdbab..6e7973053 100644 --- a/update.py +++ b/update.py @@ -71,7 +71,7 @@ def format(self, record: LogRecord) -> str: key: value.strip() if isinstance(value, str) else value for key, value in vars(settings).items() } -except ModuleNotFoundError: +except Exception: log_error( "The 'config.py' file is missing! Falling back to environment variables.", ) @@ -106,12 +106,17 @@ def format(self, record: LogRecord) -> str: except Exception as e: log_error(f"Database ERROR: {e}") -UPSTREAM_REPO = config_file.get( - "UPSTREAM_REPO", - "https://github.com/AeonOrg/Aeon-MLTB", +UPSTREAM_REPO = ( + config_file.get("UPSTREAM_REPO", "") + or os.getenv("UPSTREAM_REPO", "") + or "https://github.com/AeonOrg/Aeon-MLTB" ) -UPSTREAM_BRANCH = config_file.get("UPSTREAM_BRANCH", "") or "main" +UPSTREAM_BRANCH = ( + config_file.get("UPSTREAM_BRANCH", "") + or os.getenv("UPSTREAM_BRANCH", "") + or "main" +) if UPSTREAM_REPO: if path.exists(".git"):