Commit Graph
154 Commits
Author SHA1 Message Date
Athanasius ba81d95c1e plugins/edsm: Align comments and docstrings with plugins/eddb 2022-12-04 16:12:58 +00:00
Athanasius abe13176e7 EDSM: Timed latch for notifying about Legacy galaxy data
This avoids the spam from EDSM itself objecting to the passed gameversion.
We don't even send anything but Live data now.
2022-12-01 18:00:47 +00:00
Athanasius a581d889fe edsm: Add a paranoia check for changed gameversion
* In theory we would always see `Fileheader` and clear `pending[]`, but let's
  be extra paranoid and also clear it if there's a gameversion/build difference
  between the prior event and the current one.
2022-11-28 12:18:10 +00:00
Athanasius 5743fd3803 edsm: Push gameversion/build into the queue to ensure correctness
1. Due to the _TIMEOUT on the actual `post()` of a message it would be
  possible for new entries to get queued in the meantime.  These queued
  entries could be 'in session' and end up going through pending and thus
  sent before one of the 'new session' events is detected so as to clear
  pending.  The `this.gameversion/build` could have changed in the meantime,
  so are no longer correct if game client changed.
2. So, pass in the current gameversion/build when a message is pushed into
  the queue, and parse those back out when they're pulled out of the queue.
3. Use those versions in the message, not `this.` versions.
2022-11-28 11:04:51 +00:00
Athanasius ad95041605 edsm: Send gameversion/build in all messages
* Record the 'state' version of these in `this`.
* Use those when constructing the message.
* NB: Need to check if messages can be retained in the queue across client
  changes.  Coming up ....
2022-11-28 10:51:25 +00:00
Chris Henning e8b8cf81d5 Change EDSM credentials() to log API keys under a different trace #1496 2022-06-12 17:51:38 -04:00
Athanasius ac7cfb9b14 core plugins: Add big obvious comment about imports and windows installer 2022-02-01 14:45:30 +00:00
Athanasius 4ab6d62926 user_agent: Set this once in config.py and use it everywhere
* Also flake8/mypy pass on timeout_session.py
2021-11-29 18:04:56 +00:00
Athanasius 2fd72fde8e EDSM: Set custom User-Agent for requests session 2021-11-29 17:51:19 +00:00
A_D dac13216a0 remove uneeded cast and fix bug in passed data 2021-08-19 20:51:23 +02:00
A_D f62f1ee97b made types consistent and generic 2021-08-19 20:37:39 +02:00
A_D a37b1882db fixed import order 2021-08-19 20:37:35 +02:00
A_D 1712390732 removed old comment 2021-08-19 20:37:31 +02:00
A_D 78fa629fbe updated edsm 2021-08-19 20:37:26 +02:00
norohind 1581a3bdd7 plugins/edsm.py: fix exception on logger.trace_on, wrong datatype to subtitle 2021-08-17 13:54:38 +03:00
Athanasius 1480c2d67a plugins/edsm: Change trace_if string to plugin.edsm.cmdr-events 2021-08-13 15:29:57 +01:00
Athanasius bc9f2cda4b plugins/edsm: Use logger.trace_if(...)
This also re-introduces commented-out Locations tracking, using
'journal.locations' as it's related to that.
2021-08-13 15:14:03 +01:00
A_D 05e6838637 removed trace_on imports 2021-08-12 16:49:27 +02:00
A_D fefa3d351d replaced if x in trace_on with trace_if 2021-08-12 16:46:55 +02:00
Athanasius 505692052e edsm: Update should_send() docstring for extra param 2021-08-11 14:05:40 +01:00
Athanasius 7a71fc8e14 plugins/edsm: Protect discarded_events loop against shutdown 2021-08-05 16:40:11 +01:00
Athanasius 64f97accc0 plugins/edsm: Only try to send if pending isn't empty
This prevents literally sending an empty data to EDSM if we trigger
sending due to Shutdown.
2021-08-05 16:22:46 +01:00
Athanasius f2d7f6a5df plugins/edsm: Change discarded_events setup, check latest event in should_send()
* Ensure we have the discarded_events list *before* starting to consume
  events.  There's the *same* risk as before with EDSM just being down
  and us queueing up more and more, just now it will be in the worker
  queue rather than pending.

* We need to test for some events in should_send() that are in the
  discard list, and thus will never be in the `entries` (pending) passwd
  in, so pass in the name of the latest event as well.
2021-08-05 16:13:41 +01:00
Athanasius a794d6088f plugins/edsm: cmdr & entry declared & set early, so types now OK 2021-08-05 15:23:15 +01:00
Athanasius ddc9286903 plugins/edsm: Queue *all* events to worker
We need to trigger off ShutDown and Commander/LoadGame to empty pending,
so need to *see* them in the worker.
2021-08-05 15:20:03 +01:00
Athanasius 53da204ffd plugins/edsm: Empty pending on Shutdown & 2021-08-05 15:19:43 +01:00
Athanasius 26115a14f0 plugins/edsm: should_send() == True for any Shutdown event
We MUST attempt flushing pending events in case of commander change.
2021-08-05 15:01:33 +01:00
Athanasius ba7c2de593 plugins/edsm: 'class This' the file & flake8/mypy cleanup 2021-08-05 14:40:41 +01:00
Athanasius 56d7ee64be plugins/edsm: Add trace-on support & cleanup some mypy changes
* trace-on 'edsm-cmdr-events' for how Commanders, their API keys and
  using them are handled.  See #1134
* trace-on 'edsm-locations' for what was commented-out logging to do
  with ensuring code reacted correctly to any change of system.
* mypy/types-* seem to have had changes causing extra carping, so
  addressing that.
2021-08-05 14:06:42 +01:00
A_D 2e5e55af9a Applied requested changes 2021-06-20 17:44:29 +02:00
A_D fe0e752c9b Added support for arbitrary plugins for POST debug
This works by replacing --eddn-local with --debug-sender, and making the
webserver more generic. support has been added to EDSM, EDDN, and INARA.
2021-06-18 23:36:42 +02:00
Athanasius 28ceb72a27 plugins/edsm: LANG comments added 2021-06-13 13:37:21 +01:00
Athanasius 4fa0521438 other core plugins: LANG comment pass 2021-06-07 15:43:32 +01:00
Athanasius d5bb0cce5d EDSM: credentials() should just return None if no apikey 2021-06-04 10:21:56 +01:00
Athanasius 7bae9afe02 EDSM: Don't blindly assume we *already* have EDSM cmdr name and apikey 2021-06-04 10:16:52 +01:00
A_D fe90f1f0b3 Cleaned up imports, removed incase imports
closes EDCD/EDMarketConnector#569
2021-05-28 14:46:51 +02:00
Athanasius e5909e9024 EDSM: Use loaded BackPack data, not the empty event. 2021-05-20 18:26:51 +01:00
Athanasius 389a781de3 translations: Also edsm killswitch phrase 2021-05-17 10:21:39 +01:00
Athanasius 7f45953012 plugins/station: *Do* set station from BodyType/Body always
The 'if not this.station' was early paranoia when first getting things
working with Odyssey.  It prevents a relog from Horizons (i.e. different
location) from correctly picking up an Odyssey login station when
on-foot in concourse.

Also, EDSM was defaulting wrongly for this.station_marketid.  Not that
the plugin even *uses* that at this time.
2021-05-12 10:56:43 +01:00
Athanasius 844e6115e3 Also handle Embark (properly) in EDSM and Inara plugins. 2021-05-01 13:50:45 +01:00
Athanasius bc6557dd9c Quieten various TRACE log output.
* A lot of this is commented out.  It might be useful in the future, but
  is just too noisy for now.
* Changed the protocol webserver to info, as it is.
* Left the EDSM 'not 1XX, 2XX or 5XX' in as it's a warning, so 'pass's
  on the conditional bodies that would be empty now trace's are
  commented.
2021-04-12 08:31:47 +01:00
Athanasius 5edf8d5b59 Change monitor.state['on_foot'] to 'OnFoot' for consistency 2021-04-12 08:30:51 +01:00
Athanasius bd4489974d EDSM plugin now maintaining Station Name when on_foot 2021-04-12 08:30:51 +01:00
Athanasius d585dd9233 Also str() appversion in EDSM and Inara plugins 2021-04-01 14:46:43 +01:00
Athanasius 2f9789afdd Update all code to use config.appversion() as a function
This *also* caught some instances where appversion_nobuild should
already have been used, so those were both changed and updated to a
function call.
2021-04-01 14:45:52 +01:00
Athanasius 6aa4ccaf90 plugins/edsm: Don't try to r.close(), that's not even valid 2021-04-01 14:45:50 +01:00
Athanasius 3d3674da5f plugins/edsm: Call requests.Session.close() after we've shutdown worker thread
This properly closes any sockets and avoids a -W default warning on
shutdown.
2021-04-01 14:45:50 +01:00
Athanasius 745c2ce8d2 edsm: Ensure Request handles are closed. 2021-04-01 14:45:50 +01:00
Athanasius db48b6eaad plugins/edsm: Avoid Tk event_generate() calls during shutdown
# Conflicts:
#	plugins/edsm.py
2021-04-01 14:45:48 +01:00
A_D b5a8c03980 Added missing whitespace 2021-04-01 14:45:48 +01:00