mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-20 19:07:38 +03:00
Added total journal cutoff killswitches
This commit is contained in:
parent
6b75179199
commit
70087a27e4
@ -48,8 +48,12 @@ be used to query the kill switch set, see the docstrings for more information on
|
||||
## Currently supported killswitch strings
|
||||
|
||||
The current recognised (to EDMC and its internal plugins) killswitch strings are as follows:
|
||||
| Kill Switch | Description |
|
||||
| :--------------------- | :---------------------------------------------------------------------------------------- |
|
||||
| `plugins.eddn.send` | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
||||
| `plugins.edsm.worker` | Disables the send portion of the EDSM worker thread (effectively disables EDSM updates) |
|
||||
| `plugins.inara.worker` | Disables the send portion of the INARA worker thread (effectively disables INARA updates) |
|
||||
| Kill Switch | Description |
|
||||
| :---------------------- | :---------------------------------------------------------------------------------------- |
|
||||
| `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.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.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
|
||||
from typing import Any, Optional, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
import requests
|
||||
|
||||
import EDMCLogging
|
||||
import killswitch
|
||||
import plug
|
||||
from companion import CAPIData
|
||||
from config import config
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tkinter import Tk
|
||||
|
||||
|
||||
logger = EDMCLogging.get_main_logger()
|
||||
|
||||
|
||||
STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00D7
|
||||
|
||||
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)
|
||||
|
||||
|
||||
def plugin_start3(plugin_dir):
|
||||
return 'eddb'
|
||||
|
||||
@ -83,7 +91,13 @@ def prefs_changed(cmdr, is_beta):
|
||||
# through correctly. We don't want a static string.
|
||||
pass
|
||||
|
||||
|
||||
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
|
||||
# on events that contain "future" data, such as FSDTarget
|
||||
if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'):
|
||||
|
@ -18,6 +18,7 @@ import requests
|
||||
|
||||
import killswitch
|
||||
import myNotebook as nb # noqa: N813
|
||||
import plug
|
||||
from companion import CAPIData, category_map
|
||||
from config import applongname, appversion, config
|
||||
from EDMCLogging import get_main_logger
|
||||
@ -609,6 +610,11 @@ def plugin_stop() -> None:
|
||||
def journal_entry( # noqa: C901
|
||||
cmdr: str, is_beta: bool, system: str, station: str, entry: MutableMapping[str, Any], state: Mapping[str, Any]
|
||||
) -> 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
|
||||
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
|
||||
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]
|
||||
) -> None:
|
||||
"""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'):
|
||||
logger.trace(f'''{entry["event"]}
|
||||
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]
|
||||
) -> None:
|
||||
"""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']
|
||||
this.cmdr = cmdr
|
||||
this.FID = state['FID']
|
||||
|
Loading…
x
Reference in New Issue
Block a user