Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
zk
gpu-dcu-monitor
Commits
8f067d87
Commit
8f067d87
authored
May 27, 2026
by
zk
Browse files
Support older Node runtime
parent
b7dc9daa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
server.js
server.js
+13
-6
No files found.
server.js
View file @
8f067d87
const
http
=
require
(
"
node:
http
"
);
const
http
=
require
(
"
http
"
);
const
fs
=
require
(
"
node:
fs
"
);
const
fs
=
require
(
"
fs
"
);
const
path
=
require
(
"
node:
path
"
);
const
path
=
require
(
"
path
"
);
const
{
spawn
}
=
require
(
"
node:
child_process
"
);
const
{
spawn
}
=
require
(
"
child_process
"
);
const
{
randomUUID
}
=
require
(
"
node:
crypto
"
);
const
crypto
=
require
(
"
crypto
"
);
const
PORT
=
Number
(
process
.
env
.
PORT
||
3066
);
const
PORT
=
Number
(
process
.
env
.
PORT
||
3066
);
const
POLL_INTERVAL_MS
=
Number
(
process
.
env
.
POLL_INTERVAL_MS
||
10000
);
const
POLL_INTERVAL_MS
=
Number
(
process
.
env
.
POLL_INTERVAL_MS
||
10000
);
...
@@ -27,6 +27,13 @@ let lastRefresh = null;
...
@@ -27,6 +27,13 @@ let lastRefresh = null;
let
refreshInFlight
=
null
;
let
refreshInFlight
=
null
;
let
refreshInFlightIncludesModels
=
false
;
let
refreshInFlightIncludesModels
=
false
;
function
createId
()
{
if
(
typeof
crypto
.
randomUUID
===
"
function
"
)
return
crypto
.
randomUUID
();
return
[
4
,
2
,
2
,
2
,
6
]
.
map
((
bytes
)
=>
crypto
.
randomBytes
(
bytes
).
toString
(
"
hex
"
))
.
join
(
"
-
"
);
}
function
ensureDataFile
()
{
function
ensureDataFile
()
{
if
(
!
fs
.
existsSync
(
DATA_DIR
))
{
if
(
!
fs
.
existsSync
(
DATA_DIR
))
{
fs
.
mkdirSync
(
DATA_DIR
,
{
recursive
:
true
});
fs
.
mkdirSync
(
DATA_DIR
,
{
recursive
:
true
});
...
@@ -73,7 +80,7 @@ function normalizeServer(input) {
...
@@ -73,7 +80,7 @@ function normalizeServer(input) {
.
slice
(
0
,
6
);
.
slice
(
0
,
6
);
return
{
return
{
id
:
String
(
input
.
id
||
randomUUID
()),
id
:
String
(
input
.
id
||
createId
()),
name
,
name
,
host
,
host
,
port
:
clampInt
(
input
.
port
,
1
,
65535
,
22
),
port
:
clampInt
(
input
.
port
,
1
,
65535
,
22
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment