diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 19d55d63..8e868f65 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -35,4 +35,11 @@ jobs: with: name: development_build_not_a_release path: ./package + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.3 + with: + name: zip_only_package + path: ./zip + diff --git a/.gitignore b/.gitignore index d0d2df97..0ce64a31 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ hgt /package /build /DCS Olympus backups +/zip *.user *.aps diff --git a/frontend/server/app.js b/frontend/server/app.js index 7fbdf87a..1f43110f 100644 --- a/frontend/server/app.js +++ b/frontend/server/app.js @@ -10,7 +10,7 @@ module.exports = function (configLocation) { /* Default routers */ var atcRouter = require('./routes/api/atc'); var airbasesRouter = require('./routes/api/airbases'); - var elevationRouter = require('./routes/api/elevation'); + var elevationRouter = require('./routes/api/elevation')(configLocation); var databasesRouter = require('./routes/api/databases')(path.join(path.dirname(configLocation), "..", "Mods", "Services", "Olympus", "databases")); var indexRouter = require('./routes/index'); var uikitRouter = require('./routes/uikit'); diff --git a/frontend/server/routes/api/elevation.js b/frontend/server/routes/api/elevation.js index 14990bb1..f2450065 100644 --- a/frontend/server/routes/api/elevation.js +++ b/frontend/server/routes/api/elevation.js @@ -1,28 +1,30 @@ -const express = require('express'); -var fs = require('fs'); -const router = express.Router(); -const TileSet = require('srtm-elevation').TileSet; -const SRTMElevationDownloader = require('srtm-elevation').SRTMElevationDownloader; +module.exports = function (configLocation) { + const express = require('express'); + var fs = require('fs'); + const router = express.Router(); + const TileSet = require('srtm-elevation').TileSet; + const SRTMElevationDownloader = require('srtm-elevation').SRTMElevationDownloader; -let rawdata = fs.readFileSync('../../olympus.json'); -let config = JSON.parse(rawdata); -var tileset = null; + let rawdata = fs.readFileSync(configLocation); + let config = JSON.parse(rawdata); + var tileset = null; -if (config["frontend"] === undefined || config["frontend"]["elevationProvider"] === undefined) - tileset = new TileSet('./hgt'); -else - tileset = new TileSet('./hgt', {downloader: new SRTMElevationDownloader('./hgt', config["frontend"]["elevationProvider"])}); + if (config["frontend"] === undefined || config["frontend"]["elevationProvider"] === undefined) + tileset = new TileSet('./hgt'); + else + tileset = new TileSet('./hgt', {downloader: new SRTMElevationDownloader('./hgt', config["frontend"]["elevationProvider"])}); -router.get( "/:lat/:lng", ( req, res ) => { - tileset.getElevation([req.params.lat, req.params.lng], function(err, elevation) { - if (err) { - console.log('getElevation failed: ' + err.message); - res.send("n/a"); - } else { - res.send(String(elevation)); - } + router.get( "/:lat/:lng", ( req, res ) => { + tileset.getElevation([req.params.lat, req.params.lng], function(err, elevation) { + if (err) { + console.log('getElevation failed: ' + err.message); + res.send("n/a"); + } else { + res.send(String(elevation)); + } + }); + }); - -}); -module.exports = router; \ No newline at end of file + return router; +} \ No newline at end of file diff --git a/manager/scripts/mirror-package.bat b/manager/scripts/mirror-package.bat index 7b2055b1..77b6de89 100644 --- a/manager/scripts/mirror-package.bat +++ b/manager/scripts/mirror-package.bat @@ -1 +1 @@ -nodemon --watch ./**/*.* --exec "./scripts/copy-package" \ No newline at end of file +nodemon --watch .\**\*.* --exec ".\scripts\copy-package" \ No newline at end of file diff --git a/scripts/batch/package.bat b/scripts/batch/package.bat index b037fafc..5999d04d 100644 --- a/scripts/batch/package.bat +++ b/scripts/batch/package.bat @@ -41,4 +41,24 @@ REM copy the dependencies echo D|xcopy /Y /S /E .\dependencies .\package\dependencies REM other version tags are changed after compilation only in the package folder and should not be committed -call node .\scripts\node\set_version_text.js \ No newline at end of file +call node .\scripts\node\set_version_text.js + +REM create the package for the zip version +mkdir zip + +REM copy the main configuration file +echo F|xcopy /Y .\package\olympus.json .\zip\config\olympus.json + +REM copy the hooks script +echo F|xcopy /Y .\package\Scripts\OlympusHook.lua .\zip\Scripts\Hooks\OlympusHook.lua + +REM copy the mod folder +echo D|xcopy /Y /S /E .\package\mod .\zip\Mods\Services\Olympus + +REM copy the frontend +echo D|xcopy /Y /S /E .\package\frontend .\zip\Mods\Services\Olympus\frontend + +REM install the node_modules in the frontend +cd .\zip\Mods\Services\Olympus\frontend +call npm install +cd ..\..\..\..\..