-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathmenu.js
101 lines (96 loc) · 1.78 KB
/
menu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
const path = require('path');
module.exports = async kernel =>
{
const menu = [];
if (!await kernel.exists(path.resolve(__dirname, '.env')))
{
menu.push(
{
icon: 'fa-solid fa-plug',
text: 'Install',
href: 'install.js',
params:
{
run: true,
fullscreen: true
}
});
return menu;
}
if (!await kernel.running(__dirname, 'run.js') && !await kernel.running(__dirname, 'install.js') && !await kernel.running(__dirname, 'update.js') && !await kernel.running(__dirname, 'reset.js'))
{
[
[ 'fa-solid fa-power-off', 'Run Default', 'Default' ],
[ 'fa-solid fa-robot', 'Run Default+Jobs', 'Default+Jobs' ],
[ 'fa-solid fa-gauge', 'Run Benchmark', 'Benchmark' ],
[ 'fa-solid fa-camera', 'Run Webcam', 'Webcam' ]
]
.forEach(([ icon, text, mode ]) =>
{
menu.push(
{
icon,
text,
href: 'run.js',
params:
{
run: true,
fullscreen: true,
mode
}
});
});
}
if (await kernel.running(__dirname, 'run.js'))
{
const memory = await kernel.memory.local[path.resolve(__dirname, 'run.js')];
if (memory && memory.url && memory.mode)
{
menu.push(
{
icon: 'fa-solid fa-rocket',
text: 'UI (' + memory.mode + ')',
href: memory.url,
params:
{
run: true,
fullscreen: true
}
});
}
menu.push(
{
icon: 'fa-solid fa-desktop',
text: 'CLI',
href: 'run.js',
params:
{
run: true,
fullscreen: true
}
});
}
else
{
[
[ 'fa-solid fa-plug', 'Install', 'install.js' ],
[ 'fa-solid fa-rotate', 'Update', 'update.js' ],
[ 'fa-regular fa-circle-xmark', 'Reset', 'reset.js' ]
]
.forEach(([ icon, text, href ]) =>
{
menu.push(
{
icon,
text,
href,
params:
{
run: true,
fullscreen: true
}
});
});
}
return menu;
};