mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-12 21:32:29 +03:00
Added total journal cutoff killswitches
This commit is contained in:
parent
6b75179199
commit
70087a27e4
@ -49,7 +49,11 @@ be used to query the kill switch set, see the docstrings for more information on
|
|||||||
|
|
||||||
The current recognised (to EDMC and its internal plugins) killswitch strings are as follows:
|
The current recognised (to EDMC and its internal plugins) killswitch strings are as follows:
|
||||||
| Kill Switch | Description |
|
| Kill Switch | Description |
|
||||||
| :--------------------- | :---------------------------------------------------------------------------------------- |
|
| :---------------------- | :---------------------------------------------------------------------------------------- |
|
||||||
| `plugins.eddn.send` | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
| `plugins.eddn.send` | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
||||||
|
| `plugins.eddn.journal` | Disables all journal processing for EDDN |
|
||||||
| `plugins.edsm.worker` | Disables the send portion of the EDSM worker thread (effectively disables EDSM updates) |
|
| `plugins.edsm.worker` | Disables the send portion of the EDSM worker thread (effectively disables EDSM updates) |
|
||||||
|
| `plugins.edsm.journal` | Disables all journal processing for EDSM |
|
||||||
| `plugins.inara.worker` | Disables the send portion of the INARA worker thread (effectively disables INARA updates) |
|
| `plugins.inara.worker` | Disables the send portion of the INARA worker thread (effectively disables INARA updates) |
|
||||||
|
| `plugins.inara.journal` | Disables all journal processing for INARA |
|
||||||
|
| `plugins.eddn.journal` | Disables all journal processing for EDDN |
|
||||||
|
@ -23,17 +23,24 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
from companion import CAPIData
|
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Optional, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any, Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
import EDMCLogging
|
||||||
|
import killswitch
|
||||||
|
import plug
|
||||||
|
from companion import CAPIData
|
||||||
from config import config
|
from config import config
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from tkinter import Tk
|
from tkinter import Tk
|
||||||
|
|
||||||
|
|
||||||
|
logger = EDMCLogging.get_main_logger()
|
||||||
|
|
||||||
|
|
||||||
STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00D7
|
STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00D7
|
||||||
|
|
||||||
this: Any = sys.modules[__name__] # For holding module globals
|
this: Any = sys.modules[__name__] # For holding module globals
|
||||||
@ -64,6 +71,7 @@ def station_url(system_name: str, station_name: str) -> str:
|
|||||||
|
|
||||||
return system_url(system_name)
|
return system_url(system_name)
|
||||||
|
|
||||||
|
|
||||||
def plugin_start3(plugin_dir):
|
def plugin_start3(plugin_dir):
|
||||||
return 'eddb'
|
return 'eddb'
|
||||||
|
|
||||||
@ -83,7 +91,13 @@ def prefs_changed(cmdr, is_beta):
|
|||||||
# through correctly. We don't want a static string.
|
# through correctly. We don't want a static string.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def journal_entry(cmdr, is_beta, system, station, entry, state):
|
def journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||||
|
if (ks := killswitch.get_disabled('plugins.eddb.journal')).disabled:
|
||||||
|
logger.warning(f'Journal processing for EDDB has been disabled: {ks.reason}')
|
||||||
|
plug.show_error('EDDB Journal processing disabled. See Log')
|
||||||
|
return
|
||||||
|
|
||||||
# Always update our system address even if we're not currently the provider for system or station, but dont update
|
# Always update our system address even if we're not currently the provider for system or station, but dont update
|
||||||
# on events that contain "future" data, such as FSDTarget
|
# on events that contain "future" data, such as FSDTarget
|
||||||
if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'):
|
if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'):
|
||||||
|
@ -18,6 +18,7 @@ import requests
|
|||||||
|
|
||||||
import killswitch
|
import killswitch
|
||||||
import myNotebook as nb # noqa: N813
|
import myNotebook as nb # noqa: N813
|
||||||
|
import plug
|
||||||
from companion import CAPIData, category_map
|
from companion import CAPIData, category_map
|
||||||
from config import applongname, appversion, config
|
from config import applongname, appversion, config
|
||||||
from EDMCLogging import get_main_logger
|
from EDMCLogging import get_main_logger
|
||||||
@ -609,6 +610,11 @@ def plugin_stop() -> None:
|
|||||||
def journal_entry( # noqa: C901
|
def journal_entry( # noqa: C901
|
||||||
cmdr: str, is_beta: bool, system: str, station: str, entry: MutableMapping[str, Any], state: Mapping[str, Any]
|
cmdr: str, is_beta: bool, system: str, station: str, entry: MutableMapping[str, Any], state: Mapping[str, Any]
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
|
if (ks := killswitch.get_disabled("plugins.eddn.journal")).disabled:
|
||||||
|
logger.warning(f"EDDN journal handler has been disabled via killswitch: {ks.reason}")
|
||||||
|
plug.show_error("EDDN journal handler disabled. See Log.")
|
||||||
|
return
|
||||||
|
|
||||||
# Recursively filter '*_Localised' keys from dict
|
# Recursively filter '*_Localised' keys from dict
|
||||||
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
|
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
|
||||||
filtered: OrderedDictT[str, Any] = OrderedDict()
|
filtered: OrderedDictT[str, Any] = OrderedDict()
|
||||||
|
@ -339,6 +339,11 @@ def journal_entry(
|
|||||||
cmdr: str, is_beta: bool, system: str, station: str, entry: MutableMapping[str, Any], state: Mapping[str, Any]
|
cmdr: str, is_beta: bool, system: str, station: str, entry: MutableMapping[str, Any], state: Mapping[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Journal Entry hook."""
|
"""Journal Entry hook."""
|
||||||
|
if (ks := killswitch.get_disabled("plugins.edsm.journal")).disabled:
|
||||||
|
logger.warning(f"EDSM Journal handler disabled via killswitch: {ks.reason}")
|
||||||
|
plug.show_error("EDSM Handler disabled. See Log.")
|
||||||
|
return
|
||||||
|
|
||||||
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||||
logger.trace(f'''{entry["event"]}
|
logger.trace(f'''{entry["event"]}
|
||||||
Commander: {cmdr}
|
Commander: {cmdr}
|
||||||
|
@ -322,6 +322,11 @@ def journal_entry(
|
|||||||
cmdr: str, is_beta: bool, system: str, station: str, entry: Dict[str, Any], state: Dict[str, Any]
|
cmdr: str, is_beta: bool, system: str, station: str, entry: Dict[str, Any], state: Dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Journal entry hook."""
|
"""Journal entry hook."""
|
||||||
|
if (ks := killswitch.get_disabled("plugins.inara.journal")).disabled:
|
||||||
|
logger.warning(f"INARA support has been disabled via killswitch: {ks.reason}")
|
||||||
|
plug.show_error("INARA disabled. See Log.")
|
||||||
|
return
|
||||||
|
|
||||||
event_name: str = entry['event']
|
event_name: str = entry['event']
|
||||||
this.cmdr = cmdr
|
this.cmdr = cmdr
|
||||||
this.FID = state['FID']
|
this.FID = state['FID']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user