diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5c873f3..071ee24 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,6 +28,7 @@ jobs: - name: Build project run: | bin/generate-appinfo.sh public/appinfo.json + cp public/appinfo.json src/appinfo.json npm run build - name: Upload production-ready build files diff --git a/bin/generate-appinfo.sh b/bin/generate-appinfo.sh index b39892c..6e19b2a 100755 --- a/bin/generate-appinfo.sh +++ b/bin/generate-appinfo.sh @@ -50,7 +50,7 @@ json=$(cat <
+

+ version: n/a
+ build date: n/a +

+

Stuff in Space is a realtime 3D map of objects in Earth orbit, visualized using WebGL.

The website updates daily with orbit data from Space-Track.org @@ -188,6 +193,9 @@

+
+ Build date:   +
diff --git a/public/styles/style.css b/public/styles/style.css index 64a0cda..486ae3b 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -558,4 +558,15 @@ canvas { -webkit-filter: none; background: black; } +} + +.app-info { + font-size: 12px; +} + +.release-date-holder { + position: absolute; + bottom: 13px; + right: 13px; + font-size: 12px; } \ No newline at end of file diff --git a/src/appinfo.json b/src/appinfo.json new file mode 100644 index 0000000..c2fc8e7 --- /dev/null +++ b/src/appinfo.json @@ -0,0 +1,7 @@ +{ + "buildDate": "0000-00-00:00:00:00Z", + "version": "", + "gitHash": "unknown", + "gitBranch": "unknown", + "mode": "none" +} \ No newline at end of file diff --git a/src/hud/index.ts b/src/hud/index.ts index 4731be1..16aaaae 100644 --- a/src/hud/index.ts +++ b/src/hud/index.ts @@ -291,7 +291,7 @@ function getCurrentSearch () { return searchBox.getCurrentSearch(); } -function init (viewerInstance: Viewer) { +function init (viewerInstance: Viewer, appConfig: Record = {}) { viewer = viewerInstance; windowManager.registerWindow('sat-infobox'); @@ -310,6 +310,11 @@ function init (viewerInstance: Viewer) { } else { onSatDataLoaded(); } + + console.log('xoooo', appConfig); + setHtml('.app-version', appConfig.appInfo.version); + setHtml('.build-date', appConfig.appInfo.buildDate); + setHtml('.release-date', appConfig.appInfo.buildDate); } export default { diff --git a/src/index.ts b/src/index.ts index 5d6781d..681bd66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import axios from 'axios'; import { createViewer } from './viewer/index'; import defaultConfig from './config'; import logger, { setLogLevel } from './utils/logger'; +import appinfo from './appinfo.json'; import hud from './hud'; @@ -10,7 +11,7 @@ async function loadConfig () { const response = await axios.get(`${baseUrl}config.json`); let config = defaultConfig; if (response.data) { - config = { ...defaultConfig, ...response.data }; + config = { ...defaultConfig, ...response.data, appInfo: appinfo }; } logger.info(`.... ${config.baseUrl}`); return config; @@ -24,7 +25,7 @@ async function main () { await viewer.init(); viewer.animate(); - hud.init(viewer); + hud.init(viewer, config); } document.addEventListener('DOMContentLoaded', () => {