mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: sessionData not being saved after mission reload
This commit is contained in:
parent
6af6545f09
commit
b20134f8f1
@ -1159,7 +1159,7 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
#onLeftMouseLongClick(e: any) {
|
||||
if (this.#isDragging || this.#isSelecting) return;
|
||||
if (this.#isDragging || this.#isSelecting || this.#isZooming) return;
|
||||
console.log(`Left long click at ${e.latlng}`);
|
||||
|
||||
if (getApp().getState() === OlympusState.UNIT_CONTROL) {
|
||||
|
||||
@ -17,7 +17,6 @@ import {
|
||||
} from "../constants/constants";
|
||||
import {
|
||||
AirbasesData,
|
||||
AlarmState,
|
||||
BullseyesData,
|
||||
CommandModeOptions,
|
||||
GeneralSettings,
|
||||
@ -816,6 +815,7 @@ export class ServerManager {
|
||||
}
|
||||
|
||||
checkSessionHash(newSessionHash: string) {
|
||||
console.log(`Checking session hash: ${newSessionHash}`);
|
||||
if (this.#sessionHash != null) {
|
||||
if (newSessionHash !== this.#sessionHash) location.reload();
|
||||
} else {
|
||||
|
||||
@ -34,18 +34,16 @@ module.exports = function (configLocation) {
|
||||
let resConfig = {
|
||||
frontend: { ...config.frontend },
|
||||
audio: { ...(config.audio ?? {}) },
|
||||
controllers: { ...(config.controllers ?? {}) },
|
||||
controllers: { ...(config.controllers ?? {}) },
|
||||
profiles: { ...(profiles ?? {}) },
|
||||
local: local,
|
||||
};
|
||||
|
||||
if (local) {
|
||||
resConfig["authentication"] = config["authentication"]
|
||||
resConfig["authentication"] = config["authentication"];
|
||||
}
|
||||
|
||||
res.send(
|
||||
JSON.stringify(resConfig)
|
||||
);
|
||||
res.send(JSON.stringify(resConfig));
|
||||
res.end();
|
||||
} else {
|
||||
res.sendStatus(404);
|
||||
@ -136,11 +134,14 @@ module.exports = function (configLocation) {
|
||||
req.body.sessionData === undefined
|
||||
)
|
||||
res.sendStatus(400);
|
||||
|
||||
console.log(`Saving sessionData for ${req.params.profileName} with hash ${sessionHash}`);
|
||||
let thisSessionHash = req.body.sessionHash;
|
||||
if (thisSessionHash !== sessionHash) {
|
||||
sessionHash = thisSessionHash;
|
||||
sessionData = {};
|
||||
}
|
||||
|
||||
sessionData[req.params.profileName] = req.body.sessionData;
|
||||
res.end();
|
||||
});
|
||||
@ -148,10 +149,12 @@ module.exports = function (configLocation) {
|
||||
router.put("/sessiondata/load/:profileName", function (req, res, next) {
|
||||
if (req.body.sessionHash === undefined) res.sendStatus(400);
|
||||
let thisSessionHash = req.body.sessionHash;
|
||||
console.log(`Returning sessionData for ${req.params.profileName} with hash ${sessionHash}`);
|
||||
if (thisSessionHash !== sessionHash) {
|
||||
sessionHash = thisSessionHash;
|
||||
sessionData = {};
|
||||
res.sendStatus(404);
|
||||
res.send(sessionData);
|
||||
res.end();
|
||||
} else {
|
||||
res.send(sessionData[req.params.profileName] ?? {});
|
||||
res.end();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user