diff --git a/.python-version b/.python-version index 2419ad5b0..2c0733315 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.11.9 +3.11 diff --git a/ChangeLog.md b/ChangeLog.md index f591940ff..e65181d15 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,6 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first). --- -* We currently test against, and package with, Python 3.11.9, 32-bit. +* We currently test against, and package with, Python 3.11, 32-bit. * As a result, we do not support Windows 7, 8, or 8.1. * Developers can check the contents of the `.python-version` file in the source (not distributed with the Windows installer) for the diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 80a958e1c..28e836861 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -187,6 +187,12 @@ '--killswitches-file', help='Specify a custom killswitches file', ) + + parser.add_argument( + '--skip-timecheck', + help='Skips the Time Delta check for processed events', + action='store_true' + ) ########################################################################### args: argparse.Namespace = parser.parse_args() @@ -250,6 +256,9 @@ for d in conf_module.trace_on: logger.info(f'marked {d} for TRACE') + if args.skip_timecheck: + config.set_skip_timecheck() + def handle_edmc_callback_or_foregrounding() -> None: # noqa: CCR001 """Handle any edmc:// auth callback, else foreground an existing window.""" logger.trace_if('frontier-auth.windows', 'Begin...') diff --git a/config/__init__.py b/config/__init__.py index adf3e47f7..05eb3f5b1 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -201,6 +201,7 @@ class AbstractConfig(abc.ABC): __auth_force_edmc_protocol = False # Should we force edmc:// protocol ? __eddn_url = None # Non-default EDDN URL __eddn_tracking_ui = False # Show EDDN tracking UI ? + __skip_timecheck = False # Skip checking event timestamps? def __init__(self) -> None: self.home_path = pathlib.Path.home() @@ -270,6 +271,19 @@ def eddn_tracking_ui(self) -> bool: """ return self.__eddn_tracking_ui + def set_skip_timecheck(self): + """Set the Event Timecheck bool.""" + self.__skip_timecheck = True + + @property + def skip_timecheck(self) -> bool: + """ + Determine if the Event Timecheck bool is enabled. + + :return: bool - Should EDMC check event timechecks? + """ + return self.__skip_timecheck + @property def app_dir(self) -> str: """Return a string version of app_dir.""" diff --git a/plug.py b/plug.py index ee53e76b7..acaa006a2 100644 --- a/plug.py +++ b/plug.py @@ -14,6 +14,7 @@ import os import sys import tkinter as tk +from datetime import datetime, timedelta from pathlib import Path from tkinter import ttk from typing import Any, Mapping, MutableMapping @@ -331,6 +332,14 @@ def notify_journal_entry( logger.trace_if('journal.locations', 'Notifying plugins of "Location" event') error = None + + if "timestamp" in entry and not config.skip_timecheck: + # Check that timestamp is recent enough + dt = datetime.strptime(entry["timestamp"], "%Y-%m-%dT%H:%M:%SZ") + if dt > datetime.utcnow() - timedelta(minutes=60): + error = f"Event at {entry['timestamp']} beyond Time Delta of 60 minutes. Skipping." + return error + for plugin in PLUGINS: journal_entry = plugin._get_func('journal_entry') if journal_entry: diff --git a/resources/EDMC_Installer_Config_template.txt b/resources/EDMC_Installer_Config_template.txt index de40630c1..1a31eecae 100644 --- a/resources/EDMC_Installer_Config_template.txt +++ b/resources/EDMC_Installer_Config_template.txt @@ -80,7 +80,7 @@ begin begin PowerShellOutputFile := ExpandConstant('{tmp}\PowershellOutput.txt'); // Construct the PowerShell command and capture output to a file - Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | where Name -eq ''Elite Dangerous Market Connector'' | select-object -expandproperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); + Exec('powershell.exe', '-NoProfile -Command "Get-WmiObject -Class Win32_Product | where Name -eq ''Elite Dangerous Market Connector'' | select-object -expandproperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); begin if LoadStringFromFile(PowerShellOutputFile, S) then S:= Trim(S);