1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 16:50:34 +03:00

524 Commits

Author SHA1 Message Date
A_D
17c886af84
fix log 2022-01-27 16:03:41 +02:00
A_D
d6dcebf545
Remove unused import 2022-01-27 14:59:27 +02:00
A_D
e891ee4da0
log more contextual data if possible on a 413 2022-01-26 19:05:00 +02:00
A_D
e6ffe7e520
refactor error logging 2022-01-26 18:58:34 +02:00
A_D
5f7234ce89
address PR comments 2022-01-26 18:58:32 +02:00
A_D
73f45e37cd
always compress eddn data, comment rationale 2022-01-26 18:58:32 +02:00
A_D
b780b1ab8e
Compress outgoing EDDN data if its large
This is a sidestep solution to #1390. It doesn't attempt to directly
resend data, only compressing with gzip over a given size. If that STILL
returns a 413, its dropped, as without introspection of the message we
cannot make it any smaller
2022-01-26 18:58:31 +02:00
A_D
3814f9ebb9
Quick fix to a type warning 2022-01-26 18:58:30 +02:00
Athanasius
a5317e984f
Merge pull request #1412 from EDCD/fix/1378/inara-sync-ranks-onfoot
Inara: send setCommanderRankPilot message when on-foot
2022-01-26 16:43:17 +00:00
Athanasius
0c938bddfc
Inara: API stated to not support compression 2022-01-25 17:43:04 +00:00
Athanasius
28cbd6e0ea
Inara: queue 'Rank'/'setCommanderRankPilot' as soon as seen
This means we *will* send a message when logging in on foot, rather than
waiting for a `Cargo` event that never arrives.
2022-01-25 15:27:35 +00:00
Athanasius
ded86c2ff5
inara: Rename to current_credentials to avoid 'creds' ambiguity
Every time I see `current_creds` my first though is "creds means
credits".
2022-01-25 15:00:33 +00:00
Athanasius
c4f734734e
inara: snake_case lastcredits variable 2022-01-25 14:59:53 +00:00
Athanasius
7ac248be7a
inara: Utilise Statistics Current_Wealth for commanderAssets
Inara itself seems to be doing this if it has access to CAPI-sourced
Journals.  If we don't send commanderAssets as part of
setCommanderCredits then it does ... something else ... and ends up with
your total assets value bouncing between what EDMC is causing and what
it sees from the CAPI-sourced journals.

So, don't send this from LoadGame any more, instead wait for Statistics,
and if it has the relevant data, also send commanderAssets.
2022-01-20 17:45:23 +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
Athanasius
42fea4ec34
EDDN: Set custom User-Agent 2021-11-29 17:47:25 +00:00
Athanasius
33fbbd4da9
eddn/L10n: Use single quotes in translated strings 2021-11-12 15:36:26 +00:00
Athanasius
f5a4469337
EDDN: Sanity check NavRoute contents & handle EDDN 400
* Closes #1342 - A user had a NavRoute message with no Route array.
  It's always from the file, so the file had to be missing it?
* This results in an EDDN '400', and now we'll drop such messages from
  the replaylog so they're not constantly retried.
2021-11-12 15:06:27 +00:00
Athanasius
3ec9c81e19
EDDN: Drop any 'unknown schema' messages so they're not retried 2021-10-19 16:01:54 +01:00
Athanasius
7dcb275e9b
EDDN: Document HORIZONS_SKU, and to NOT use the others 2021-10-18 14:18:11 +01:00
Athanasius
c97b539ac3
EDDN: Revert to using capi_is_horizons() in export_commodities() 2021-10-18 12:25:35 +01:00
Athanasius
694321064d
EDDN: Rename is_horizons() and document that it's for CAPI data only
OK, it has `data` passed in, so this should be obvious, but let's make
it explicit both by name and in the docstring.

The docstring now also emphasies that *this* check **MUST** be used for
CAPI data, as it's dependent only on the availability of Horizons on the
account, and not on the `LoadGame` flags.
2021-10-18 12:20:06 +01:00
Athanasius
d8689e5b9b
Revert "EDDN: If this.horizons is true, use that in is_horizons() check"
This reverts commit ca80edd34d88298a2c9d933f79f0da8e68d870eb.
2021-10-18 12:10:09 +01:00
Athanasius
90aa2698cd
Revert "EDDN: Just use this.horizons for CAPI data sending"
This reverts commit bd183efbd4dfa8365246952f04352403195102aa.
2021-10-18 12:09:55 +01:00
Athanasius
e148197971
Revert "EDDN: use this.odyssey for Journal outfitting and shipyard"
This reverts commit 4fef4257bd00376f45e94a35db925c0fbb58b267.
2021-10-18 12:08:32 +01:00
Athanasius
98f215e6ad
EDDN: Remove horizons flag from navroute messages
As with `odyssey` this isn't currently in the not-yet-live schema.
2021-10-17 16:46:11 +01:00
Athanasius
29b69745f3
EDDN: document that some EDDN messages aren't retried 2021-10-17 16:32:38 +01:00
Athanasius
4fef4257bd
EDDN: use this.odyssey for Journal outfitting and shipyard
For consistency with the horizons flag.  They *are* placed *from* the
`this` versions into `entry`, but we might as well go the direct route.
They have to be set explicitly here as we process the `entry` to make a
wholly new `message` rather than the `message` just being `entry` with
some changes.
2021-10-17 16:20:46 +01:00
Athanasius
b3419ec548
EDDN: Also set commodity/3->horizons for journal-sourced data 2021-10-17 16:17:58 +01:00
Athanasius
a32546b001
EDDN: Set horizons on commodity/3 messages as per schema 2021-10-17 16:14:35 +01:00
Athanasius
556ace5306
EDDN: Use this.odyssey rather than passing to functions 2021-10-17 15:47:12 +01:00
Athanasius
bd183efbd4
EDDN: Just use this.horizons for CAPI data sending 2021-10-17 15:41:15 +01:00
Athanasius
488fdf4976
Merge pull request #1306 from EDCD/fix/eddn-quieten-unknown-schema-errors
EDDN: Quieten "unknown schema" errors
2021-10-17 15:35:25 +01:00
Athanasius
ca80edd34d
EDDN: If this.horizons is true, use that in is_horizons() check 2021-10-17 15:01:51 +01:00
Athanasius
aecf375138
EDDN: Record horizons flag in journal_entry()
So that we can then first check *this* in `is_horizons()`.
2021-10-17 14:55:43 +01:00
Athanasius
7fa0576c85
EDDN: Keep 'unknown schema' messages in replaylog
This still logs them, at DEBUG, which will get spammy as such messages
accumulate.

Uncommenting the:

`#  return  # Pretend it went OK so this message isn't retried`

at line 291 in EDDN.sendreplay(), in the:

`except requests.exceptions.HTTPError as e:`

block would cause them to not stay in the replaylog.
2021-10-17 14:41:25 +01:00
Athanasius
5ae953bf45
EDDN: Drop messages if EDDN says it doesn't know the schema
Currently Live EDDN doesn't yet have the new schemas such as navroute,
so will complain.  Rather than leaving such messages in our EDDN replay
queue and getting an error every time that is run, detect this error
case and drop the messages.
2021-10-17 14:24:23 +01:00
Athanasius
fc34d023b6
EDDN: tracking_ui_update(): check if this UI bit actually active 2021-10-17 14:10:30 +01:00
Athanasius
42594c9366
EDDN: Abbreviate tracking_ui_update() code 2021-10-15 11:57:09 +01:00
Athanasius
60f3b524e2
EDDN: codexentry: Always set BodyName from Status.json, ID if Journal matches
Partial data is better than no data, or bad data.  So if Status.json
BodyName is available, always use it.  *Then* see if Journal BodyName
matches that, and if so set BodyID.

Close-orbiting bodies might therefore cause BodyName to be set without
BodyID, but then it's up to EDDN listeners to make a decision, rather
than making it for them.
2021-10-14 13:04:52 +01:00
Athanasius
2ef9d9e3c3
EDDN: BodyName/ID tracking tested for simple body
* The Tracking UI is now up and running.
* Some of the tracking corrected:
 - Set BodyID from ApproachBody.
 - Do not clear values on SupercruiseEntry, allow either FSDJump or
   LeaveBody to do this.
 - Clear the values if we detect the Main Menu music track (when you
   exit to the menu, not just when you look at the menu whilst
   in-game).
* Various comments added to help with documenting the tracking for EDDN
  uploaders.
2021-10-12 13:06:38 +01:00
Athanasius
dd8ec061d3
EDDN: Dummy tracking UI to determine layout 2021-10-10 15:40:41 +01:00
Athanasius
15ea858c6b
EDDN: codexentry: Use BodyID if available 2021-10-10 14:55:46 +01:00
Athanasius
d7eacd253c
EDDN: Track BodyID from Journal events
* Also renames all of the body name/ID 'this' variables to snake case.
2021-10-10 14:43:01 +01:00
Athanasius
50f03ae753
EDDN: codexentry: Set BodyName if available from Status.json 2021-10-10 14:37:20 +01:00
Athanasius
8700868724
EDDN: Rename this.planet to this.bodyname for consistency 2021-10-10 14:32:12 +01:00
Athanasius
b82d25ee07
EDDN: Start tracking Status.json BodyName 2021-10-10 14:31:40 +01:00
Athanasius
5546926776
EDDN: Use 'if key (not) in dict:' rather than .get() is (not) None 2021-10-10 14:23:24 +01:00
Athanasius
84ef77197d
EDDN: Use MutableMapping when needing to update a Mapping, not Dict 2021-10-10 14:23:24 +01:00