From f16e2bc6ff156b431d9dabfa8be108d888e4f1e0 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 08:59:15 -0500 Subject: [PATCH 01/27] Update settings_dialog.py --- electrum/gui/qt/settings_dialog.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 23fd382ea..032a6b2cb 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -303,16 +303,13 @@ def on_history_rates(checked): fiat_widgets.append((QLabel(_('Base currency')), ccy_combo)) fiat_widgets.append((QLabel(_('Source')), ex_combo)) fiat_widgets.append((self.history_rates_cb, None)) - misc_widgets = [] - misc_widgets.append((filelogging_cb, None)) - misc_widgets.append((alias_label, self.alias_e)) - misc_widgets.append((qr_label, qr_combo)) + tabs_info = [ (gui_widgets, _('Appearance')), (units_widgets, _('Units')), (fiat_widgets, _('Fiat')), - (misc_widgets, _('Misc')), + ] for widgets, name in tabs_info: tab = QWidget() From 23193972d25409a6c5d8f8c29027f28f0b18c360 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:01:27 -0500 Subject: [PATCH 02/27] Update main_window.py --- electrum/gui/qt/main_window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 9546ae965..223519495 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -711,7 +711,6 @@ def add_toggle_action(view_menu, tab): tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog).setEnabled(bool(self.network)) if self.network and self.network.local_watchtower: tools_menu.addAction(_("Local &Watchtower"), self.gui_object.show_watchtower_dialog) - tools_menu.addAction(_("&Plugins"), self.plugins_dialog) tools_menu.addSeparator() tools_menu.addAction(_("&Sign/verify message"), self.sign_verify_message) tools_menu.addAction(_("&Encrypt/decrypt message"), self.encrypt_message) From 0d032846f95c8c0c7f62054c98b84c18714e4bb5 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:37:29 -0500 Subject: [PATCH 03/27] Update main_window.py --- electrum/gui/qt/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 223519495..0bb47c780 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -729,7 +729,7 @@ def add_toggle_action(view_menu, tab): #help_menu.addAction(_("&Check for updates"), self.show_update_check) help_menu.addAction(_("&Official website"), lambda: webopen("https://www.fact0rn.io/")) help_menu.addSeparator() - #help_menu.addAction(_("&Documentation"), lambda: webopen("http://docs.electrum.org/")).setShortcut(QKeySequence.HelpContents) + #help_menu.addAction(_("&Documentation"), lambda: webopen("https://github.com/FACT0RN/FactWallet/releases")).setShortcut(QKeySequence.HelpContents) #if not constants.net.TESTNET: # help_menu.addAction(_("&Bitcoin Paper"), self.show_bitcoin_paper) #help_menu.addAction(_("&Report Bug"), self.show_report_bug) From f5640f5d4208aeba57bc45d177a4ced9c5db3bd0 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:39:29 -0500 Subject: [PATCH 04/27] Update settings_dialog.py --- electrum/gui/qt/settings_dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 032a6b2cb..fcbf80e1c 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -173,7 +173,7 @@ def on_video_device(x): colortheme_combo = QComboBox() colortheme_combo.addItem(_('Light'), 'default') - colortheme_combo.addItem(_('Dark'), 'dark') + colortheme_combo.addItem(_('Dark'), 'dark3') index = colortheme_combo.findData(self.config.GUI_QT_COLOR_THEME) colortheme_combo.setCurrentIndex(index) colortheme_label = QLabel(self.config.cv.GUI_QT_COLOR_THEME.get_short_desc() + ':') From 2e2c265f25d0529c2f12cc0834b59cab382c4e6b Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:40:17 -0500 Subject: [PATCH 05/27] Update settings_dialog.py --- electrum/gui/qt/settings_dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index fcbf80e1c..032a6b2cb 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -173,7 +173,7 @@ def on_video_device(x): colortheme_combo = QComboBox() colortheme_combo.addItem(_('Light'), 'default') - colortheme_combo.addItem(_('Dark'), 'dark3') + colortheme_combo.addItem(_('Dark'), 'dark') index = colortheme_combo.findData(self.config.GUI_QT_COLOR_THEME) colortheme_combo.setCurrentIndex(index) colortheme_label = QLabel(self.config.cv.GUI_QT_COLOR_THEME.get_short_desc() + ':') From f4fe18e50fb90eea2ce798cddf54e70e51d6c23c Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:49:51 -0500 Subject: [PATCH 06/27] Update main_window.py --- electrum/gui/qt/main_window.py | 1 + 1 file changed, 1 insertion(+) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 0bb47c780..7295d13a1 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -711,6 +711,7 @@ def add_toggle_action(view_menu, tab): tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog).setEnabled(bool(self.network)) if self.network and self.network.local_watchtower: tools_menu.addAction(_("Local &Watchtower"), self.gui_object.show_watchtower_dialog) + tools_menu.addAction(_("&Plugins"), self.plugins_dialog) tools_menu.addSeparator() tools_menu.addAction(_("&Sign/verify message"), self.sign_verify_message) tools_menu.addAction(_("&Encrypt/decrypt message"), self.encrypt_message) From 4f0aa7cf77cfce3ff5304d96bc482113ffae99a4 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:01:32 -0500 Subject: [PATCH 07/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 104 ++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 33 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 6d113dd3b..20c5a5671 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -25,6 +25,15 @@ import traceback import sys import queue + +import smtplib +import webbrowser +import json +from email.mime.text import MIMEText +from email.mime.multipart import MIMEMultipart +from email.mime.base import MIMEBase +from email import encoders + from typing import NamedTuple, Optional from .version import ELECTRUM_VERSION @@ -69,39 +78,68 @@ def __init__(self, exctype, value, tb): Logger.__init__(self) self.exc_args = (exctype, value, tb) - def send_report(self, asyncio_loop, proxy, *, timeout=None) -> CrashReportResponse: - # FIXME the caller needs to catch generic "Exception", as this method does not have a well-defined API... - if constants.net.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in BaseCrashReporter.report_server: - # Gah! Some kind of altcoin wants to send us crash reports. - raise Exception(_("Missing report URL.")) - report = self.get_traceback_info() - report.update(self.get_additional_info()) - report = json.dumps(report) - coro = self.do_post(proxy, BaseCrashReporter.report_server + "/crash.json", data=report) - response = asyncio.run_coroutine_threadsafe(coro, asyncio_loop).result(timeout) - self.logger.info( - f"Crash report sent. Got response [DO NOT TRUST THIS MESSAGE]: {error_text_str_to_safe_str(response)}") - response = json.loads(response) - assert isinstance(response, dict), type(response) - # sanitize URL - if location := response.get("location"): - assert isinstance(location, str) - base_issues_url = constants.GIT_REPO_ISSUES_URL - if not base_issues_url.endswith("/"): - base_issues_url = base_issues_url + "/" - if not location.startswith(base_issues_url): - location = None - ret = CrashReportResponse( - status=response.get("status"), - url=location, - text=_("Thanks for reporting this issue!"), - ) - return ret - - async def do_post(self, proxy, url, data) -> str: - async with make_aiohttp_session(proxy) as session: - async with session.post(url, data=data, raise_for_status=True) as resp: - return await resp.text() +# def send_report(self, asyncio_loop, proxy, *, timeout=None) -> CrashReportResponse: +# # FIXME the caller needs to catch generic "Exception", as this method does not have a well-defined API... +# if constants.net.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in BaseCrashReporter.report_server: +# # Gah! Some kind of altcoin wants to send us crash reports. +# raise Exception(_("Missing report URL.")) +# report = self.get_traceback_info() +# report.update(self.get_additional_info()) +# report = json.dumps(report) +# coro = self.do_post(proxy, BaseCrashReporter.report_server + "/crash.json", data=report) +# response = asyncio.run_coroutine_threadsafe(coro, asyncio_loop).result(timeout) +# self.logger.info( +# f"Crash report sent. Got response [DO NOT TRUST THIS MESSAGE]: {error_text_str_to_safe_str(response)}") +# response = json.loads(response) +# assert isinstance(response, dict), type(response) +# # sanitize URL +# if location := response.get("location"): +# assert isinstance(location, str) +# base_issues_url = constants.GIT_REPO_ISSUES_URL +# if not base_issues_url.endswith("/"): +# base_issues_url = base_issues_url + "/" +# if not location.startswith(base_issues_url): +# location = None +# ret = CrashReportResponse( +# status=response.get("status"), +# url=location, +# text=_("Thanks for reporting this issue!"), +# ) +# return ret +# +# async def do_post(self, proxy, url, data) -> str: +# async with make_aiohttp_session(proxy) as session: +# async with session.post(url, data=data, raise_for_status=True) as resp: +# return await resp.text() + + + def send_report(self, report_info): + # Create a MIME multipart message + msg = MIMEMultipart() + msg['From'] = 'sender@example.com' + msg['To'] = 'recipient@example.com' + msg['Subject'] = 'Crash Report' + + # Add the report information as text in the email body + body = json.dumps(report_info) + msg.attach(MIMEText(body, 'plain')) + + # Open the default email client + webbrowser.open('mailto:recipient@example.com?subject=Crash Report&body=' + body) + + # Uncomment the following lines if you want to send the email using SMTP + # with smtplib.SMTP('smtp.example.com', 587) as smtp: + # smtp.starttls() + # smtp.login('your_email@example.com', 'your_password') + # smtp.send_message(msg) + + example_instance = ExampleClass() + report_info = { + "traceback": "Traceback information here...", + "additional_info": "Additional information here..." + } + example_instance.send_report(report_info) + def get_traceback_info(self): exc_string = str(self.exc_args[1]) From 7216085ad16f9d7f2b265b79b1e67ab0357a5be4 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:02:17 -0500 Subject: [PATCH 08/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 20c5a5671..2802b198b 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -140,7 +140,7 @@ def send_report(self, report_info): } example_instance.send_report(report_info) - +class ExampleClass: def get_traceback_info(self): exc_string = str(self.exc_args[1]) stack = traceback.extract_tb(self.exc_args[2]) From 7030b6aad02eef4e007ca9dd42822fcf63d30420 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:03:56 -0500 Subject: [PATCH 09/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 2802b198b..af2625dfb 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -112,7 +112,7 @@ def __init__(self, exctype, value, tb): # async with session.post(url, data=data, raise_for_status=True) as resp: # return await resp.text() - +class ExampleClass: def send_report(self, report_info): # Create a MIME multipart message msg = MIMEMultipart() @@ -140,7 +140,7 @@ def send_report(self, report_info): } example_instance.send_report(report_info) -class ExampleClass: + def get_traceback_info(self): exc_string = str(self.exc_args[1]) stack = traceback.extract_tb(self.exc_args[2]) From d160eba4a70d1fa444ce60bf3c5fe73f16a13cab Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:04:52 -0500 Subject: [PATCH 10/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index af2625dfb..dde0ed54d 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -133,12 +133,12 @@ def send_report(self, report_info): # smtp.login('your_email@example.com', 'your_password') # smtp.send_message(msg) - example_instance = ExampleClass() - report_info = { - "traceback": "Traceback information here...", - "additional_info": "Additional information here..." - } - example_instance.send_report(report_info) + #example_instance = ExampleClass() + #report_info = { + #"traceback": "Traceback information here...", + #"additional_info": "Additional information here..." + #} + #example_instance.send_report(report_info) def get_traceback_info(self): From 61c8e0a3e898e2b8d73184a05228689dd2bd7b98 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:06:31 -0500 Subject: [PATCH 11/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index dde0ed54d..af2625dfb 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -133,12 +133,12 @@ def send_report(self, report_info): # smtp.login('your_email@example.com', 'your_password') # smtp.send_message(msg) - #example_instance = ExampleClass() - #report_info = { - #"traceback": "Traceback information here...", - #"additional_info": "Additional information here..." - #} - #example_instance.send_report(report_info) + example_instance = ExampleClass() + report_info = { + "traceback": "Traceback information here...", + "additional_info": "Additional information here..." + } + example_instance.send_report(report_info) def get_traceback_info(self): From 2dbd5489f248a3ce2bcfc2a51a43455d7e60d6f7 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:08:44 -0500 Subject: [PATCH 12/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 68 ++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index af2625dfb..deddc9379 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -112,33 +112,49 @@ def __init__(self, exctype, value, tb): # async with session.post(url, data=data, raise_for_status=True) as resp: # return await resp.text() +class BaseCrashReporter: + @staticmethod + def get_traceback_info(): + # Dummy method to simulate getting traceback info + return {"traceback": "Dummy traceback info"} + + @staticmethod + def get_additional_info(): + # Dummy method to simulate getting additional info + return {"additional_info": "Dummy additional info"} + +class CrashReportResponse: + def __init__(self, status, url, text): + self.status = status + self.url = url + self.text = text + class ExampleClass: - def send_report(self, report_info): - # Create a MIME multipart message - msg = MIMEMultipart() - msg['From'] = 'sender@example.com' - msg['To'] = 'recipient@example.com' - msg['Subject'] = 'Crash Report' - - # Add the report information as text in the email body - body = json.dumps(report_info) - msg.attach(MIMEText(body, 'plain')) - - # Open the default email client - webbrowser.open('mailto:recipient@example.com?subject=Crash Report&body=' + body) - - # Uncomment the following lines if you want to send the email using SMTP - # with smtplib.SMTP('smtp.example.com', 587) as smtp: - # smtp.starttls() - # smtp.login('your_email@example.com', 'your_password') - # smtp.send_message(msg) - - example_instance = ExampleClass() - report_info = { - "traceback": "Traceback information here...", - "additional_info": "Additional information here..." - } - example_instance.send_report(report_info) + @staticmethod + def send_report(report_info): + # Constructing the report + report = BaseCrashReporter.get_traceback_info() + report.update(BaseCrashReporter.get_additional_info()) + report = json.dumps(report) + + # Open default email client with report information + webbrowser.open("mailto:recipient@example.com?subject=Crash Report&body=" + report) + + # Creating a response (for demonstration purposes) + ret = CrashReportResponse( + status="Success", + url=None, + text="Thanks for reporting this issue!" + ) + + return ret + +# Usage: +example_instance = ExampleClass() +report_info = {"dummy_key": "dummy_value"} +response = example_instance.send_report(report_info) +print(response.text) # Output: Thanks for reporting this issue! + def get_traceback_info(self): From 958f7a46eaf58209a0d2adcbce53e46efc0d3fd6 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:09:30 -0500 Subject: [PATCH 13/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index deddc9379..7af147a53 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -149,15 +149,14 @@ def send_report(report_info): return ret -# Usage: -example_instance = ExampleClass() -report_info = {"dummy_key": "dummy_value"} -response = example_instance.send_report(report_info) -print(response.text) # Output: Thanks for reporting this issue! + # Usage: + example_instance = ExampleClass() + report_info = {"dummy_key": "dummy_value"} + response = example_instance.send_report(report_info) + print(response.text) # Output: Thanks for reporting this issue! - - def get_traceback_info(self): +def get_traceback_info(self): exc_string = str(self.exc_args[1]) stack = traceback.extract_tb(self.exc_args[2]) readable_trace = self.__get_traceback_str_to_send() From 596ae70809ff47dbc923d4a45424366a2b5a64bd Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:09:53 -0500 Subject: [PATCH 14/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 7af147a53..6ba16ff6d 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -156,7 +156,7 @@ def send_report(report_info): print(response.text) # Output: Thanks for reporting this issue! -def get_traceback_info(self): + def get_traceback_info(self): exc_string = str(self.exc_args[1]) stack = traceback.extract_tb(self.exc_args[2]) readable_trace = self.__get_traceback_str_to_send() From ef1baa66a84b0175f9848c28dd4a28c081d49e34 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:12:27 -0500 Subject: [PATCH 15/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 6ba16ff6d..8bda7d780 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -148,7 +148,6 @@ def send_report(report_info): ) return ret - # Usage: example_instance = ExampleClass() report_info = {"dummy_key": "dummy_value"} From c2f5e8b0a3b21c961034f3adbbee14ecfde85957 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:13:01 -0500 Subject: [PATCH 16/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 8bda7d780..a7e553bdb 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -148,11 +148,7 @@ def send_report(report_info): ) return ret - # Usage: - example_instance = ExampleClass() - report_info = {"dummy_key": "dummy_value"} - response = example_instance.send_report(report_info) - print(response.text) # Output: Thanks for reporting this issue! + def get_traceback_info(self): From 0e9c15be57a4d6f0cc211ba5705607358a6e59cd Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:14:45 -0500 Subject: [PATCH 17/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index a7e553bdb..e79380166 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -139,7 +139,7 @@ def send_report(report_info): # Open default email client with report information webbrowser.open("mailto:recipient@example.com?subject=Crash Report&body=" + report) - + webbrowser.open("mailto:recipient@example.com?subject=Crash Report&body=" + report, method='open_new') # Creating a response (for demonstration purposes) ret = CrashReportResponse( status="Success", From 3f088cd84727524f654bd767d8de4ae2bc49fd1a Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:25:21 -0500 Subject: [PATCH 18/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 95 ++++++++++----------------------- 1 file changed, 29 insertions(+), 66 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index e79380166..230451389 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -78,77 +78,40 @@ def __init__(self, exctype, value, tb): Logger.__init__(self) self.exc_args = (exctype, value, tb) -# def send_report(self, asyncio_loop, proxy, *, timeout=None) -> CrashReportResponse: -# # FIXME the caller needs to catch generic "Exception", as this method does not have a well-defined API... -# if constants.net.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in BaseCrashReporter.report_server: -# # Gah! Some kind of altcoin wants to send us crash reports. -# raise Exception(_("Missing report URL.")) -# report = self.get_traceback_info() -# report.update(self.get_additional_info()) -# report = json.dumps(report) -# coro = self.do_post(proxy, BaseCrashReporter.report_server + "/crash.json", data=report) -# response = asyncio.run_coroutine_threadsafe(coro, asyncio_loop).result(timeout) -# self.logger.info( -# f"Crash report sent. Got response [DO NOT TRUST THIS MESSAGE]: {error_text_str_to_safe_str(response)}") -# response = json.loads(response) -# assert isinstance(response, dict), type(response) -# # sanitize URL -# if location := response.get("location"): -# assert isinstance(location, str) -# base_issues_url = constants.GIT_REPO_ISSUES_URL -# if not base_issues_url.endswith("/"): -# base_issues_url = base_issues_url + "/" -# if not location.startswith(base_issues_url): -# location = None -# ret = CrashReportResponse( -# status=response.get("status"), -# url=location, -# text=_("Thanks for reporting this issue!"), -# ) -# return ret -# -# async def do_post(self, proxy, url, data) -> str: -# async with make_aiohttp_session(proxy) as session: -# async with session.post(url, data=data, raise_for_status=True) as resp: -# return await resp.text() - -class BaseCrashReporter: - @staticmethod - def get_traceback_info(): - # Dummy method to simulate getting traceback info - return {"traceback": "Dummy traceback info"} - - @staticmethod - def get_additional_info(): - # Dummy method to simulate getting additional info - return {"additional_info": "Dummy additional info"} - -class CrashReportResponse: - def __init__(self, status, url, text): - self.status = status - self.url = url - self.text = text - -class ExampleClass: - @staticmethod - def send_report(report_info): - # Constructing the report - report = BaseCrashReporter.get_traceback_info() - report.update(BaseCrashReporter.get_additional_info()) + def send_report(self, asyncio_loop, proxy, *, timeout=None) -> CrashReportResponse: + # FIXME the caller needs to catch generic "Exception", as this method does not have a well-defined API... + if constants.net.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in BaseCrashReporter.report_server: + # Gah! Some kind of altcoin wants to send us crash reports. + raise Exception(_("Missing report URL.")) + report = self.get_traceback_info() + report.update(self.get_additional_info()) report = json.dumps(report) - - # Open default email client with report information - webbrowser.open("mailto:recipient@example.com?subject=Crash Report&body=" + report) - webbrowser.open("mailto:recipient@example.com?subject=Crash Report&body=" + report, method='open_new') - # Creating a response (for demonstration purposes) + coro = self.do_post(proxy, BaseCrashReporter.report_server + "/crash.json", data=report) + response = asyncio.run_coroutine_threadsafe(coro, asyncio_loop).result(timeout) + self.logger.info( + f"Crash report sent. Got response [DO NOT TRUST THIS MESSAGE]: {error_text_str_to_safe_str(response)}") + response = json.loads(response) + assert isinstance(response, dict), type(response) + # sanitize URL + if location := response.get("location"): + assert isinstance(location, str) + base_issues_url = constants.GIT_REPO_ISSUES_URL + if not base_issues_url.endswith("/"): + base_issues_url = base_issues_url + "/" + if not location.startswith(base_issues_url): + location = None ret = CrashReportResponse( - status="Success", - url=None, - text="Thanks for reporting this issue!" + status=response.get("status"), + url=location, + text=_("Thanks for reporting this issue!"), ) - return ret + async def do_post(self, proxy, url, data) -> str: + async with make_aiohttp_session(proxy) as session: + async with session.post(url, data=data, raise_for_status=True) as resp: + return await resp.text() + def get_traceback_info(self): From 4781ea25cd22befbd4bda7540244778a658eef5d Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:25:59 -0500 Subject: [PATCH 19/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 230451389..68d5c2d2b 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -26,13 +26,6 @@ import sys import queue -import smtplib -import webbrowser -import json -from email.mime.text import MIMEText -from email.mime.multipart import MIMEMultipart -from email.mime.base import MIMEBase -from email import encoders from typing import NamedTuple, Optional From 507e7ca5848946760a00de59eac2f1b65586c978 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:28:24 -0500 Subject: [PATCH 20/27] Update base_crash_reporter.py --- electrum/base_crash_reporter.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py index 68d5c2d2b..6d113dd3b 100644 --- a/electrum/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -25,8 +25,6 @@ import traceback import sys import queue - - from typing import NamedTuple, Optional from .version import ELECTRUM_VERSION @@ -103,9 +101,7 @@ def send_report(self, asyncio_loop, proxy, *, timeout=None) -> CrashReportRespon async def do_post(self, proxy, url, data) -> str: async with make_aiohttp_session(proxy) as session: async with session.post(url, data=data, raise_for_status=True) as resp: - return await resp.text() - - + return await resp.text() def get_traceback_info(self): exc_string = str(self.exc_args[1]) From a7866dfa141facc03176aa034e0474bb0a413140 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:31:23 -0500 Subject: [PATCH 21/27] Update simple_config.py --- electrum/simple_config.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index c9ee75db2..415d00936 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -1105,11 +1105,7 @@ def _default_swapserver_url(self) -> str: short_desc=lambda: _('Zeros after decimal point'), long_desc=lambda: _('Number of zeros displayed after the decimal point. For example, if this is set to 2, "1." will be displayed as "1.00"'), ) - - BTC_AMOUNTS_PREC_POST_SAT = ConfigVar( - 'amt_precision_post_satoshi', default=0, type_=int, - short_desc=lambda: _("Lightning precision (not supported)."), - ) + BTC_AMOUNTS_ADD_THOUSANDS_SEP = ConfigVar( 'amt_add_thousands_sep', default=False, type_=bool, @@ -1117,7 +1113,7 @@ def _default_swapserver_url(self) -> str: ) BLOCK_EXPLORER = ConfigVar( - 'block_explorer', default='Blockstream.info', type_=str, + 'block_explorer', default='fact0rn.io', type_=str, short_desc=lambda: _('Online Block Explorer'), long_desc=lambda: _('Choose which online block explorer to use for functions that open a web browser'), ) From 54d022320d087a30876b416474edd6bbb0288057 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:31:49 -0500 Subject: [PATCH 22/27] Update simple_config.py --- electrum/simple_config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index 415d00936..a1aed12d8 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -232,7 +232,6 @@ def __init__(self, options=None, read_user_config_function=None, except UnknownBaseUnit: self.decimal_point = DECIMAL_POINT_DEFAULT self.num_zeros = self.BTC_AMOUNTS_FORCE_NZEROS_AFTER_DECIMAL_POINT - self.amt_precision_post_satoshi = self.BTC_AMOUNTS_PREC_POST_SAT self.amt_add_thousands_sep = self.BTC_AMOUNTS_ADD_THOUSANDS_SEP def electrum_path(self): From 19ccee6fc33ee7d536431a5edd9438e7feeeb98d Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:32:35 -0500 Subject: [PATCH 23/27] Update simple_config.py --- electrum/simple_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index a1aed12d8..1d7c921ad 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -850,8 +850,8 @@ def format_amount( precision=None, add_thousands_sep: bool = None, ) -> str: - if precision is None: - precision = self.amt_precision_post_satoshi + # if precision is None: + # precision = self.amt_precision_post_satoshi if add_thousands_sep is None: add_thousands_sep = self.amt_add_thousands_sep return format_satoshis( From 72477c11ab3daf450481484d5b8a4d2a9428453a Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:35:08 -0500 Subject: [PATCH 24/27] Update simple_config.py --- electrum/simple_config.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index 1d7c921ad..cef306871 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -232,6 +232,7 @@ def __init__(self, options=None, read_user_config_function=None, except UnknownBaseUnit: self.decimal_point = DECIMAL_POINT_DEFAULT self.num_zeros = self.BTC_AMOUNTS_FORCE_NZEROS_AFTER_DECIMAL_POINT + self.amt_precision_post_satoshi = self.BTC_AMOUNTS_PREC_POST_SAT self.amt_add_thousands_sep = self.BTC_AMOUNTS_ADD_THOUSANDS_SEP def electrum_path(self): @@ -850,8 +851,8 @@ def format_amount( precision=None, add_thousands_sep: bool = None, ) -> str: - # if precision is None: - # precision = self.amt_precision_post_satoshi + if precision is None: + precision = self.amt_precision_post_satoshi if add_thousands_sep is None: add_thousands_sep = self.amt_add_thousands_sep return format_satoshis( @@ -962,7 +963,7 @@ def _default_swapserver_url(self) -> str: WALLET_UNCONF_UTXO_FREEZE_THRESHOLD_SAT = ConfigVar('unconf_utxo_freeze_threshold', default=5_000, type_=int) WALLET_BIP21_LIGHTNING = ConfigVar( 'bip21_lightning', default=False, type_=bool, - short_desc=lambda: _('Add lightning requests to bitcoin URIs'), + short_desc=lambda: _('Add lightning requests to Fact0rn URIs'), long_desc=lambda: _('This may result in large QR codes'), ) WALLET_BOLT11_FALLBACK = ConfigVar( @@ -1104,11 +1105,15 @@ def _default_swapserver_url(self) -> str: short_desc=lambda: _('Zeros after decimal point'), long_desc=lambda: _('Number of zeros displayed after the decimal point. For example, if this is set to 2, "1." will be displayed as "1.00"'), ) - + + BTC_AMOUNTS_PREC_POST_SAT = ConfigVar( + 'amt_precision_post_satoshi', default=0, type_=int, + short_desc=lambda: _("Lightning precision (not supported, do not use)."), + ) BTC_AMOUNTS_ADD_THOUSANDS_SEP = ConfigVar( 'amt_add_thousands_sep', default=False, type_=bool, - short_desc=lambda: _("Add thousand separators to bitcoin amounts"), + short_desc=lambda: _("Add thousand separators to Fact0rn amounts"), ) BLOCK_EXPLORER = ConfigVar( From 96447b0c1a2352172720f99e042995e34609b502 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:45:27 -0500 Subject: [PATCH 25/27] Update simple_config.py --- electrum/simple_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index cef306871..28a0a4549 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -1194,9 +1194,9 @@ def _default_swapserver_url(self) -> str: WATCHTOWER_SERVER_USER = ConfigVar('watchtower_user', default=None, type_=str) WATCHTOWER_SERVER_PASSWORD = ConfigVar('watchtower_password', default=None, type_=str) - PAYSERVER_PORT = ConfigVar('payserver_port', default=8080, type_=int) - PAYSERVER_ROOT = ConfigVar('payserver_root', default='/r', type_=str) - PAYSERVER_ALLOW_CREATE_INVOICE = ConfigVar('payserver_allow_create_invoice', default=False, type_=bool) + #PAYSERVER_PORT = ConfigVar('payserver_port', default=8080, type_=int) + #PAYSERVER_ROOT = ConfigVar('payserver_root', default='/r', type_=str) + #PAYSERVER_ALLOW_CREATE_INVOICE = ConfigVar('payserver_allow_create_invoice', default=False, type_=bool) PLUGIN_TRUSTEDCOIN_NUM_PREPAY = ConfigVar('trustedcoin_prepay', default=20, type_=int) From 301b99a297e75e122b653f8c8592dedcce04bbc0 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:52:34 -0500 Subject: [PATCH 26/27] Update __init__.py --- electrum/plugins/payserver/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/electrum/plugins/payserver/__init__.py b/electrum/plugins/payserver/__init__.py index 6b1411038..9abf0d540 100644 --- a/electrum/plugins/payserver/__init__.py +++ b/electrum/plugins/payserver/__init__.py @@ -1,5 +1,5 @@ -from electrum.i18n import _ - -fullname = _('PayServer') -description = 'run a HTTP server for receiving payments' -available_for = ['qt', 'cmdline'] +#from electrum.i18n import _ +# +#fullname = _('PayServer') +#description = 'run a HTTP server for receiving payments' +#available_for = ['qt', 'cmdline'] From e9afd968b1756bd7b0537353eb37154aae41e771 Mon Sep 17 00:00:00 2001 From: silkyjohnson1 <61355155+silkyjohnson1@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:54:27 -0500 Subject: [PATCH 27/27] Update main_window.py --- electrum/gui/qt/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 7295d13a1..b07764998 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -711,7 +711,7 @@ def add_toggle_action(view_menu, tab): tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog).setEnabled(bool(self.network)) if self.network and self.network.local_watchtower: tools_menu.addAction(_("Local &Watchtower"), self.gui_object.show_watchtower_dialog) - tools_menu.addAction(_("&Plugins"), self.plugins_dialog) + # tools_menu.addAction(_("&Plugins"), self.plugins_dialog) tools_menu.addSeparator() tools_menu.addAction(_("&Sign/verify message"), self.sign_verify_message) tools_menu.addAction(_("&Encrypt/decrypt message"), self.encrypt_message)