3576 Commits

Author SHA1 Message Date
Dan Albert
30aebf2546 Replace api.ts with auto-generated API.
All the slices will come later.
2022-03-06 18:23:52 -08:00
Dan Albert
2310ef0f80 Auto-generate API hooks for the backend. 2022-03-06 18:18:53 -08:00
Dan Albert
de284c2bf6 Add tooling/docs for auto-generating API hooks. 2022-03-06 18:18:35 -08:00
Dan Albert
b7439cbd17 Add metadata to FastAPI endpoints for OpenAPI.
operation_ids give us better function names when generating the
typescript API from the openapi.json. BaseModel.Config.title does the
same for type names. Response models (or 204 status codes) need to be
explicit or the API will be declared as returning any.
2022-03-06 17:12:00 -08:00
Dan Albert
4053356e13 Default to the React map the default.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 02:02:25 -08:00
Dan Albert
904602510d Remove API key auth; CORS is sufficient.
The React UI running in a browser can't connect to the backend without
punching a hole for CORS, which isn't done by default. We don't need the
API key to protect from browsers, and anything else running on the
user's machine that can access the backend (that's hosted on only
localhost) already has enough control to do damage without using
Liberation as an attack vector.

https://github.com/dcs-liberation/dcs_liberation
2022-03-06 01:57:12 -08:00
Dan Albert
8165d3bd8c Add support for running the build react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:53:22 -08:00
Dan Albert
3c9acea31c Fix CORS configuration.
We need to configure this always, but limit the allowed origins for non-
dev modes.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:52:06 -08:00
Dan Albert
17f2f007d2 Copy open source licenses into the distribution.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:34:53 -08:00
Dan Albert
7e213dbfbe Add license checking to npm ci.
These are all the licenses we currently depend on.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:33:33 -08:00
Dan Albert
fcb897a0e8 Uninstall @types/axios.
Axios ships types by default now so we don't need this.
2022-03-06 01:02:09 -08:00
Dan Albert
5230591dc2 Add npm ci to GitHub actions.
Formatting currently being forced to preserve line endings because for
whatever reason that's only causing problems in CI.
2022-03-06 00:59:58 -08:00
Dan Albert
605d8f057f Fix save loading.
https://stackoverflow.com/a/44888113/632035

Pickle can't deal with loading sets (and probably dicts) of objects with
custom __hash__ functions that depend on their state because __hash__
can be called before __setstate__. Make the hash function stupider (but
still correct) by just relying on the object ID.
2022-03-06 00:14:20 -08:00
Dan Albert
738cf1f381 Reset game state on new turn.
This may not be the way to do this long term, but it is how the old map
works so it's at least not a regression. It might be better to generate
events for the between-turn changes in state instead.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 00:02:25 -08:00
Dan Albert
73fcfcec7b Handle map reset when the game is loaded/unloaded.
https://github.com/dcs-liberation/dcs_liberation/issues/2039

Partial fix for
https://github.com/dcs-liberation/dcs_liberation/issues/2045 (now works
in the new map, old one not fixed yet).
2022-03-05 18:02:46 -08:00
Dan Albert
995e28cb32 Support mobile CPs in the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-05 15:41:58 -08:00
Dan Albert
2c6e8c414c Add --dev flag to put the game in developer mode.
Right now the only thing this does is remove sleeps meant to give people
time to read things that developers have already seen hundreds of times.
2022-03-05 11:24:37 -08:00
Dan Albert
b4edd5d841 Draw commit boundaries in the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-05 02:23:14 -08:00
Dan Albert
35df036eb8 Fix flight position update performance.
dispatch is expensive when called in a loop because each call
re-renders. Doing more work per dispatch causes fewer renders.

https://redux.js.org/style-guide/style-guide#avoid-dispatching-many-actions-sequentially
2022-03-05 00:42:22 -08:00
Dan Albert
05fbdae54c Remove redux-logger middleware.
https://github.com/reduxjs/redux-devtools does the same thing better
without spamming the log.
2022-03-05 00:39:26 -08:00
Dan Albert
b6457ae434 Un-split the flight data by coalition.
This made one callsite cleaner at the expense of the others and the
state management.
2022-03-04 19:54:41 -08:00
Dan Albert
59f734dd07 Draw frozen combat in the new UI.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-04 19:41:33 -08:00
Dan Albert
88cd9e19c5 Draw aircraft locations in the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-04 18:34:01 -08:00
Dan Albert
980d8f3092 Fix mistake introduced in previous commit.
Debugging code incorrectly reverted.
2022-03-04 02:23:42 -08:00
Dan Albert
811f46c289 Draggable waypoints with timing info.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-04 02:21:22 -08:00
Dan Albert
6933470ce0 Respond to ATO changes in the new UI. 2022-03-04 00:46:44 -08:00
Dan Albert
cba39df5da Handle to front line events in the new UI. 2022-03-04 00:37:31 -08:00
Dan Albert
34111cfc67 Update all TGOs on capture.
We need to update all TGOs, not just the cleared ones, because the
captured buildings need to update their icon to show the new color.
2022-03-04 00:29:31 -08:00
Dan Albert
fef123c2d4 Add redux-logger.
This automatically logs state changes (in a readable form) to the js
console. We'll probably want to turn this off in production to cut down
on log noise.
2022-03-04 00:24:31 -08:00
Dan Albert
a710ce5e1b Run prettier across the react source. 2022-03-03 23:34:18 -08:00
Dan Albert
13ca5352c7 Add import sorting to prettier. 2022-03-03 23:32:57 -08:00
Dan Albert
92236a5bc3 Update the react map for some new events. 2022-03-03 23:31:07 -08:00
Dan Albert
4539e91fa9 Add missing keys to list components. 2022-03-03 21:51:47 -08:00
Dan Albert
c5c596dc2f Move TGOs out of MapModel. 2022-03-03 17:11:01 -08:00
C. Perreau
d0ad554e14
Merge pull request #2040 from dcs-liberation/ukraine
🇺🇦 Support for Ukraine
2022-03-03 23:48:11 +01:00
C. Perreau
3037b540d4
Update README.md 2022-03-03 23:35:43 +01:00
Khopa
0b1365a04b Properly credit CC artwork author. 2022-03-03 23:34:22 +01:00
Dan Albert
ccb510fe47 Move front lines out of MapModel. 2022-03-03 02:17:13 -08:00
Dan Albert
89b987fc87 Stop fetching timing info for unselected flights.
The flight will be redrawn when it's selected. Don't bother fetching
this info for flights that aren't selected.
2022-03-03 01:24:32 -08:00
Dan Albert
8d806def5b Use FastAPI interface for the front lines.
Can't submit yet because there's no way to uniquely identify front-
lines, so no way to update these as they change.
2022-03-03 00:43:13 -08:00
Dan Albert
e5f4974e9a Stop ad-hoc constructing FrontLines.
The UI needs to be able to identify these to the server and vice versa,
so they'll need IDs that don't change. Rather than constructing an ID
based on the control points names, make them an owned part of the
control point. The constructed ID would be fine, but a UUID will make
them more suitable for the database, and this was always fairly gross
anyway.

Some follow up work if anyone is interested: a bunch of the data that's
computed in the various properties can now probably be computed *once*
and persisted to the FrontLine type.
2022-03-03 00:38:52 -08:00
Dan Albert
4dfc42528d Eliminate unnecessary waypoint API call in map.
I added the with_waypoints option for the react map. Use it in the old
one.
2022-03-03 00:10:45 -08:00
Dan Albert
79b471b41c Remove CSS that was messing with text alignment.
This was added by create-react-app. We're not using it any more.
2022-03-02 23:57:05 -08:00
Dan Albert
f9f18dd38b Fix drawing of non-path waypoints. 2022-03-02 23:53:16 -08:00
Dan Albert
d53fc46ffc All multiple event steam connections.
We don't support multi-client yet, but this is useful when debugging the
react UI in a browser instead of in the Liberation UI.
2022-03-02 23:51:12 -08:00
Dan Albert
781f8fb0e8 Fix a few display discrepancies in the new map. 2022-03-02 23:44:46 -08:00
Dan Albert
b39a44ae37 Draw front lines on the react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 23:33:15 -08:00
Dan Albert
9a2c10a98f Draw supply routes on the react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 23:14:05 -08:00
Dan Albert
0bdb4ac894 Draw air defense threat/detection ranges.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 21:51:16 -08:00
Khopa
510dcd762f 🇺🇦 Support for Ukraine 2022-03-02 17:52:47 +01:00