From e78e390368b7847daa39ca97bd39fb0dd5a728a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Br=C3=BCsecke?= Date: Sat, 29 Aug 2026 18:18:56 +0300 Subject: [PATCH] Workstations Service --- .gitignore | 3 ++ .../workstations/data/linux/ubuntu/25.10.yaml | 11 +++++ backend/workstations/package-lock.json | 40 +++++++++++++++++++ backend/workstations/package.json | 7 ++++ backend/workstations/workstations.js | 33 +++++++++++++++ frontend/shell/{index.html => app-shell.html} | 2 +- 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 backend/workstations/data/linux/ubuntu/25.10.yaml create mode 100644 backend/workstations/package-lock.json create mode 100644 backend/workstations/package.json create mode 100644 backend/workstations/workstations.js rename frontend/shell/{index.html => app-shell.html} (99%) diff --git a/.gitignore b/.gitignore index c3ef214..b2266ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Backend +node_modules/ + # MkDocs /.cache/ /site/ \ No newline at end of file diff --git a/backend/workstations/data/linux/ubuntu/25.10.yaml b/backend/workstations/data/linux/ubuntu/25.10.yaml new file mode 100644 index 0000000..5fc597e --- /dev/null +++ b/backend/workstations/data/linux/ubuntu/25.10.yaml @@ -0,0 +1,11 @@ +added: "2026-08-22" +architectures: + - bitness: 64 + cpu: x86 + endianness: LE +family: Linux +name: Questing Quokka +origin: 🇬🇧 +os: Ubuntu +version: "25.10" +year: 2025 \ No newline at end of file diff --git a/backend/workstations/package-lock.json b/backend/workstations/package-lock.json new file mode 100644 index 0000000..4fe5c1a --- /dev/null +++ b/backend/workstations/package-lock.json @@ -0,0 +1,40 @@ +{ + "name": "workstations", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "js-yaml": "5.4.1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/js-yaml": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.4.1.tgz", + "integrity": "sha512-28R/k+NAjeuf7+CKlTxWZVExJGwVVLwY06DgEnOMz2gEpfNkDcD7QvyiVPT0xy0XXhU8vHsd4Ot42OOPdJG7dQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.mjs" + } + } + } +} diff --git a/backend/workstations/package.json b/backend/workstations/package.json new file mode 100644 index 0000000..c20da3a --- /dev/null +++ b/backend/workstations/package.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "js-yaml": "5.4.1" + }, + "private": true, + "type": "module" +} diff --git a/backend/workstations/workstations.js b/backend/workstations/workstations.js new file mode 100644 index 0000000..dbddc93 --- /dev/null +++ b/backend/workstations/workstations.js @@ -0,0 +1,33 @@ +import fs from 'node:fs'; +import http from 'node:http'; + +import * as yaml from 'js-yaml'; + +const yamlFiles = fs.globSync(`${import.meta.dirname}/data/**/*.yaml`); +const yamlContents = yamlFiles.map(yamlFile => fs.readFileSync(yamlFile, 'utf8')); +const workstations = yamlContents.map(yamlContent => yaml.load(yamlContent)); + +workstations.sort((first, second) => + first.os.localeCompare(second.os) || + first.version.localeCompare(second.version, 'en', { numeric: true }) +) + +const workstationsJSON = JSON.stringify(workstations); +const server = http.createServer(onRequest); + +process.on('SIGINT', shutdown); +process.on('SIGTERM', shutdown); + +server.listen(50000); + +function onRequest(_request, response) { + response.setHeader('Content-Type', 'application/json'); + response.end(workstationsJSON); +} + +function shutdown() { + process.off('SIGINT', shutdown); + process.off('SIGTERM', shutdown); + + server.close(); +} \ No newline at end of file diff --git a/frontend/shell/index.html b/frontend/shell/app-shell.html similarity index 99% rename from frontend/shell/index.html rename to frontend/shell/app-shell.html index 0c41e17..b33963a 100644 --- a/frontend/shell/index.html +++ b/frontend/shell/app-shell.html @@ -23,8 +23,8 @@