From 6864a3770ea86aa48026fa4f49db361eb38bf086 Mon Sep 17 00:00:00 2001 From: Frisk Date: Fri, 15 Jul 2022 01:46:16 +0200 Subject: [PATCH 1/2] fix to #248, additional critical bugfixing (cherry picked from commit 27f00cdfbb1c1cb3f6492528a3b4533186cc64e4) --- src/discussions.py | 7 +++---- src/rcgcdw.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/discussions.py b/src/discussions.py index ccf8a8e..be6a156 100644 --- a/src/discussions.py +++ b/src/discussions.py @@ -29,6 +29,7 @@ from src.exceptions import ArticleCommentError, NoFormatter from src.api.util import default_message from src.api.context import Context from src.api.hooks import formatter_hooks, pre_hooks, post_hooks +from src.i18n import formatters_i18n # Create a custom logger @@ -56,6 +57,7 @@ def inject_client(client_obj): """Function to avoid circular import issues""" global client client = client_obj + client.schedule(fetch_discussions, every=settings["fandom_discussions"]["cooldown"]) def fetch_discussions(): @@ -107,7 +109,7 @@ def parse_discussion_post(post, comment_pages): """Initial post recognition & handling""" global client post_type = post["_embedded"]["thread"][0]["containerType"] - context = Context(display_mode, "discussion", webhook_url, client) + context = Context(display_mode, "discussion", webhook_url, client, formatters_i18n, settings) # Filter posts by forum if post_type == "FORUM" and settings["fandom_discussions"].get("show_forums", []): if not post["forumName"] in settings["fandom_discussions"]["show_forums"]: @@ -157,6 +159,3 @@ def safe_request(url) -> Optional[requests.Response]: return None return request - -client.schedule(fetch_discussions, every=settings["fandom_discussions"]["cooldown"]) - diff --git a/src/rcgcdw.py b/src/rcgcdw.py index 51ee93e..3cf898a 100644 --- a/src/rcgcdw.py +++ b/src/rcgcdw.py @@ -279,7 +279,7 @@ def abuselog_processing(entry): action = "abuselog" if action in settings["ignored"]: return - context = Context(settings["appearance"]["mode"], "abuselog", settings["webhookURL"], client) + context = Context(settings["appearance"]["mode"], "abuselog", settings["webhookURL"], client, formatters_i18n, settings) context.event = action run_hooks(pre_hooks, context, entry) try: From fab1abb5da393b37b5f2af09e4105c6d0d9c2bbd Mon Sep 17 00:00:00 2001 From: Frisk <702385-piotrex43@users.noreply.gitlab.com> Date: Thu, 14 Jul 2022 23:49:21 +0000 Subject: [PATCH 2/2] Update version --- setup.py | 2 +- src/configloader.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 76377ce..a40b9ec 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='RcGcDw', - version='1.14.0.1', + version='1.15.0.1', url='https://gitlab.com/piotrex43/RcGcDw/', license='GNU GPLv3', author='Frisk', diff --git a/src/configloader.py b/src/configloader.py index 545db53..c22eea2 100644 --- a/src/configloader.py +++ b/src/configloader.py @@ -28,7 +28,7 @@ def load_settings(): if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1: settings["limitrefetch"] = settings["limit"] if "user-agent" in settings["header"]: - settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.14.1") # set the version in the useragent + settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.15.0.1") # set the version in the useragent except FileNotFoundError: logging.critical("No config file could be found. Please make sure settings.json is in the directory.") sys.exit(1)