Workstations Service
This commit is contained in:
parent
9a2bd2bffd
commit
21f97aa696
6 changed files with 101 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
|||
# Backend
|
||||
node_modules/
|
||||
|
||||
# MkDocs
|
||||
/.cache/
|
||||
/site/
|
||||
11
backend/workstations/data/linux/ubuntu/25.10.yaml
Normal file
11
backend/workstations/data/linux/ubuntu/25.10.yaml
Normal file
|
|
@ -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
|
||||
40
backend/workstations/package-lock.json
generated
Normal file
40
backend/workstations/package-lock.json
generated
Normal file
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
backend/workstations/package.json
Normal file
7
backend/workstations/package.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"js-yaml": "5.4.1"
|
||||
},
|
||||
"private": true,
|
||||
"type": "module"
|
||||
}
|
||||
39
backend/workstations/workstations.js
Normal file
39
backend/workstations/workstations.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import fs from 'node:fs';
|
||||
import http from 'node:http';
|
||||
|
||||
import * as yaml from 'js-yaml';
|
||||
|
||||
const LOCALE = 'en';
|
||||
|
||||
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(compareWorkstations);
|
||||
|
||||
const workstationsJSON = JSON.stringify(workstations);
|
||||
const server = http.createServer(onRequest);
|
||||
|
||||
process.on('SIGINT', shutdown);
|
||||
process.on('SIGTERM', shutdown);
|
||||
|
||||
server.listen(50000);
|
||||
|
||||
function compareWorkstations(first, second) {
|
||||
const osComparison = first.os.localeCompare(second.os, LOCALE);
|
||||
const versionComparison = first.version.localeCompare(second.version, LOCALE, { numeric: true });
|
||||
|
||||
return osComparison || versionComparison;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
<nav class="nav">
|
||||
<a class="nav-link screen-narrow" href="https://code.instantworkstation.com">Code</a>
|
||||
<a class="nav-link screen-wide" href="https://code.instantworkstation.com">Source Code</a>
|
||||
<a class="nav-link screen-narrow" href="https://docs.instantworkstation.com">Docs</a>
|
||||
<a class="nav-link screen-wide" href="https://code.instantworkstation.com">Source Code</a>
|
||||
<a class="nav-link screen-wide" href="https://docs.instantworkstation.com">Technical Documentation</a>
|
||||
|
||||
<span class="news-ticker">
|
||||
Loading…
Add table
Add a link
Reference in a new issue