diff --git a/client/@types/olympus/index.d.ts b/client/@types/olympus/index.d.ts index c37bdcae..6e63fcb1 100644 --- a/client/@types/olympus/index.d.ts +++ b/client/@types/olympus/index.d.ts @@ -105,6 +105,10 @@ declare module "constants/constants" { export const ROEs: string[]; export const reactionsToThreat: string[]; export const emissionsCountermeasures: string[]; + export const ERAS: { + name: string; + chronologicalOrder: number; + }[]; export const ROEDescriptions: string[]; export const reactionsToThreatDescriptions: string[]; export const emissionsCountermeasuresDescriptions: string[]; @@ -836,6 +840,7 @@ declare module "other/utils" { }): UnitBlueprint | null; export function getMarkerCategoryByName(name: string): "aircraft" | "helicopter" | "groundunit-sam" | "navyunit" | "groundunit-other"; export function getUnitDatabaseByCategory(category: string): import("unit/databases/aircraftdatabase").AircraftDatabase | import("unit/databases/helicopterdatabase").HelicopterDatabase | import("unit/databases/groundunitdatabase").GroundUnitDatabase | import("unit/databases/navyunitdatabase").NavyUnitDatabase | null; + export function getCategoryBlueprintIconSVG(category: string, unitName: string): string | false; export function base64ToBytes(base64: string): ArrayBufferLike; export function enumToState(state: number): string; export function enumToROE(ROE: number): string; @@ -1600,6 +1605,7 @@ declare module "map/map" { import { CoalitionAreaContextMenu } from "contextmenus/coalitionareacontextmenu"; import { AirbaseSpawnContextMenu } from "contextmenus/airbasespawnmenu"; export type MapMarkerVisibilityControl = { + "category"?: string; "image": string; "isProtected"?: boolean; "name": string; @@ -1997,6 +2003,25 @@ declare module "unit/importexport/unitdatafileexport" { showForm(units: Unit[]): void; } } +declare module "schemas/schema" { + import Ajv from "ajv"; + import { AnySchemaObject } from "ajv/dist/core"; + abstract class JSONSchemaValidator { + #private; + constructor(schema: AnySchemaObject); + getAjv(): Ajv; + getCompiledValidator(): any; + getErrors(): any; + getSchema(): AnySchemaObject; + validate(data: any): any; + } + export class AirbasesJSONSchemaValidator extends JSONSchemaValidator { + constructor(); + } + export class ImportFileJSONSchemaValidator extends JSONSchemaValidator { + constructor(); + } +} declare module "unit/importexport/unitdatafileimport" { import { Dialog } from "dialog/dialog"; import { UnitDataFile } from "unit/importexport/unitdatafile"; diff --git a/client/public/stylesheets/leaflet/leaflet.css b/client/public/stylesheets/leaflet/leaflet.css index 1981009f..9ade8dc4 100644 --- a/client/public/stylesheets/leaflet/leaflet.css +++ b/client/public/stylesheets/leaflet/leaflet.css @@ -60,6 +60,11 @@ padding: 0; } +.leaflet-container img.leaflet-tile { + /* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */ + mix-blend-mode: plus-lighter; +} + .leaflet-container.leaflet-touch-zoom { -ms-touch-action: pan-x pan-y; touch-action: pan-x pan-y; @@ -646,7 +651,7 @@ svg.leaflet-image-layer.leaflet-interactive path { } /* Printing */ - + @media print { /* Prevent printers from removing background-images of controls. */ .leaflet-control { diff --git a/manager/1.js b/manager/1.js new file mode 100644 index 00000000..ac4cd6d8 --- /dev/null +++ b/manager/1.js @@ -0,0 +1,97 @@ + + /* Get the list of DCS instances */ + var instances = await DCSInstance.getInstances(); + + /* If there is only 1 DCS Instance and Olympus is not installed in it, go straight to the installation page (since there is nothing else to do) */ + this.basic = instances.length === 1 && !instances[0].installed; + + document.getElementById("loader").classList.add("hide"); + + /* Check if there are corrupted or outdate instances */ + if (instances.some((instance) => { + return instance.installed && instance.error; + })) { + /* Ask the user for confirmation */ + showErrorPopup("One or more Olympus instances are corrupted or need updating. Press Close to fix this.", async () => { + showWaitPopup("Please wait while your instances are being fixed.") + fixInstances(instances.filter((instance) => { + return instance.installed && instance.error; + })).then( + () => { location.reload() }, + (err) => { + logger.error(err); + showErrorPopup(`An error occurred while trying to fix your installations. Please reinstall Olympus manually.

You can find more info in ${path.join(__dirname, "..", "manager.log")}`); + } + ) + }) + } + + /* Check which buttons should be enabled */ + const installEnabled = true; + const manageEnabled = instances.some((instance) => { return instance.installed; }); + + /* Menu */ + var menuPage = new MenuPage(this, { + installEnabled: installEnabled, + manageEnabled: manageEnabled + }); + + /* Installations */ + this.installationPage = new installationPage(this, { + instances: instances + }); + + /* Instances */ + this.instancesPage = new InstancesPage(this, { + instances: instances.filter((instance) => { + return instance.installed; + }) + }); + + /* Connections */ + this.connectionsPage = new ConnectionsPage(this); + + /* Passwords */ + this.passwordsPage = new PasswordsPage(this); + + /* Result */ + this.resultPage = new ResultPage(this, { + logLocation: path.join(__dirname, "..", "manager.log") + }); + + /* Create all the HTML pages */ + document.body.appendChild(this.menuPage.getElement()); + document.body.appendChild(this.installationPage.getElement()); + document.body.appendChild(this.instancesPage.getElement()); + document.body.appendChild(this.connectionsPage.getElement()); + document.body.appendChild(this.passwordsPage.getElement()); + document.body.appendChild(this.resultPage.getElement()); + + /* In basic mode we directly show the connections page */ + if (this.basic) { + const options = { + instance: instances[0], + basic: this.basic, + install: true + } + connectionsPage.options = { + ...connectionsPage.options, + ...options + } + passwordsPage.options = { + ...passwordsPage.options, + ...options + } + resultPage.options = { + ...resultPage.options, + ...options + } + + /* Show the connections page directly */ + instancesPage.hide(); + connectionsPage.show(); + } else { + /* Show the main menu */ + menuPage.show(); + } + } \ No newline at end of file diff --git a/manager/ejs/connections.ejs b/manager/ejs/connections.ejs index 80fe1869..a9775338 100644 --- a/manager/ejs/connections.ejs +++ b/manager/ejs/connections.ejs @@ -1,4 +1,33 @@
-
User path
+
<%= install? 'User path': 'Instance selection' %>
+
Type of install
Ports and address
Passwords
<%= install? 'Install': 'Update' %>
-
- - Accept or modify port settings (optional) - - - If you are installing Olympus locally for Single player use, it's recommended you leave these as default and continue. - If you are installing a dedicated server, then follow the instructions available on the DCS Olympus Wiki. - -
-
- Client port - - -
- "> - -
- Port already in use + <% if (selectAutoOrManual) { %> +
+ + Do you want to set port and address settings manually? + + + We can auto setup ports and addresses for you, or you can set the manually.
+ If you don't have an understanding of how Olympus works, we recommend the auto option. +
+
+ +
+
+ Auto apply settings +
+
+ Manually set options
-
-
- Backend port - - -
- "> - -
- Port already in use + + <% } else { %> +
+ + Enter the ports and address to use. + + + Select client and backend ports, making sure they are free to use with the provided check.
+ Unless you want to support direct API calls to the backend, you can keep the address to localhost even for dedicated servers. +
+
+ +
+ Client port + + +
+ "> + +
+ Port already in use +
-
-
- Backend address - - - "> -
+
+ Backend port + + +
+ "> + +
+ Port already in use +
+
+
+
+ Backend address + + + "> +
+ <% } %> - <% if (!simplified) { %>
<%= install? "Cancel installation": "Cancel editing" %>
- <% } %>
\ No newline at end of file diff --git a/manager/ejs/installations.ejs b/manager/ejs/installation.ejs similarity index 72% rename from manager/ejs/installations.ejs rename to manager/ejs/installation.ejs index 550dbc10..17c7709d 100644 --- a/manager/ejs/installations.ejs +++ b/manager/ejs/installation.ejs @@ -88,27 +88,41 @@
-
User path
+
<%= install? 'User path': 'Instance selection' %>
+
Type of install
Ports and address
Passwords
-
Install
+
<%= install? 'Install': 'Update' %>
- Select a DCS path to install Olympus to. + <% if (install) { %> + Select a DCS path to install Olympus to. + <% } else { %> + Select an Olympus instance to edit. + <% } %> - We have automatically detected the following DCS installations under your Saved Games / DCS folder. + <% if (install) { %> + We have automatically detected the following DCS installations under your Saved Games / DCS folder. + <% } else { %> + These are the DCS instances in which Olympus has already been installed. + <% } %> - Please select which DCS installations you want to add Olympus to. + <% if (install) { %> + Please select which DCS installations you want to add Olympus to. + <% } else { %> + Please select which Olympus installations you want to edit. + <% } %> +
<% for (let i = 0; i < instances.length; i++) {%> -
+
<%= instances[i].name %> <%= instances[i].folder %> @@ -118,9 +132,12 @@ <% } %>
-
- Cancel installation + <% if (install) { %> + Cancel installation + <% } else { %> + Cancel editing + <% } %>
\ No newline at end of file diff --git a/manager/ejs/instances.ejs b/manager/ejs/instances.ejs index e059c725..9eae3440 100644 --- a/manager/ejs/instances.ejs +++ b/manager/ejs/instances.ejs @@ -36,6 +36,18 @@ row-gap: 25px; } + #manager-instances .option:not(.installed) { + background-color: var(--background-disabled); + } + + #manager-instances .option:not(.installed) .info { + opacity: 50%; + } + + #manager-instances .option:not(.installed) .server-data { + opacity: 50%; + } + #manager-instances>.instructions { margin-bottom: 10px; } @@ -192,6 +204,7 @@ } #manager-instances .edit, + #manager-instances .install, #manager-instances .uninstall, #manager-instances .stop { color: var(--offwhite); @@ -200,34 +213,36 @@ } #manager-instances .edit:hover, + #manager-instances .install:hover, #manager-instances .uninstall:hover, #manager-instances .stop:hover { color: var(--background); background-color: var(--offwhite); } + + #manager-instances .install { + margin-left: auto; + }
-
- Return to menu -
View and manage installs - The following Oympus installs have been identified.
You can start an Olympus server, modify settings and uninstall below. + The following DCS installations have been identified.
You can start an Olympus server, modify settings and uninstall below.
<% for (let i = 0; i < instances.length; i++) {%> -
+
<%= instances[i].name %> - - <%= instances[i].installed? (instances[i].error? 'Corrupted/outdated Olympus installation': ''): '' %> + + <%= instances[i].installed? (instances[i].error? 'Corrupted/outdated Olympus installation': 'Olympus installed'): 'Olympus not installed' %> <%= instances[i].folder %>
@@ -242,15 +257,15 @@
Client port
-
<%= instances[i].clientPort %>
+
<%= instances[i].installed? instances[i].clientPort: "N/A" %>
Backend port
-
<%= instances[i].backendPort %>
+
<%= instances[i].installed? instances[i].backendPort: "N/A" %>
Backend address
-
<%= instances[i].backendAddress %>
+
<%= instances[i].installed? instances[i].backendAddress: "N/A" %>
@@ -263,6 +278,7 @@
Edit settings
+
Install Olympus
Uninstall Olympus
Open in browser
Stop Olympus
diff --git a/manager/ejs/menu.ejs b/manager/ejs/menu.ejs index 412c0b15..1ee05ae8 100644 --- a/manager/ejs/menu.ejs +++ b/manager/ejs/menu.ejs @@ -1,62 +1,55 @@
-
-
DCS OLYMPUS
-
INSTALL WIZARD AND MANAGER
-
Using this manager, you can install Olympus, update settings, and view and manage instances
-
- -