Commit graph

882 commits

Author SHA1 Message Date
hinto-janaiyo
9881b5bf31 update: misc cleanups 2022-12-17 13:35:13 -05:00
hinto-janaiyo
e3df61b53e main: quit if [ALT+F4] on [ask_before_quit], add [save_before_quit]
If user clicked the [X] or [ALT+F4] while on the [ask_before_quit]
screen, it'll actually exit now.

The [save_before_quit] option actually... saves before quitting now.
No cloning since we're exiting and no [ErrorState] setting on errors.
The console logs will show if a save error happens.
2022-12-17 11:00:32 -05:00
hinto-janaiyo
9128ed7181 helper: fix GUI log reset message 2022-12-17 09:52:33 -05:00
hinto-janaiyo
c2935c00c1 p2pool: add [Select random node] and [<- Last] & [Next ->] UI 2022-12-16 23:19:33 -05:00
hinto-janaiyo
e0ca8c1e1b disk: fix serializing quotes in strings 2022-12-16 22:38:46 -05:00
hinto-janaiyo
bc9a6fc34d disk: handle some [.unwrap()]s correctly 2022-12-16 19:16:16 -05:00
hinto-janaiyo
49f469a8b1 cargo check/clippy fixes 2022-12-16 16:46:06 -05:00
hinto-janaiyo
e977a3d621 helper: fix [XMR per ...] stat
It was using the [payouts] variable as a base instead of [xmr].
2022-12-16 13:36:39 -05:00
hinto-janaiyo
489e17045a Update P2Pool Main vs Mini vs Solo mining 2022-12-16 11:56:24 -05:00
hinto-janaiyo
173a13ecd0 keys/p2pool/xmrig: change key shortcuts, check for [ACCEPTABLE_*]
Keyboard shortcuts [Left] & [Right] were clobbering the
[TextEdit] left/right movement, so they are now [Z/X].
The shortcuts also look to make sure a TextEdit isn't
in focus so that [S/R/Z/X] can actually be typed.

P2Pool/XMRig now make sure the path ends with an [ACCEPTABLE_*]
value (e.g: P2pool, P2POOL) before enabling the [Start] UI.
2022-12-16 10:30:57 -05:00
hinto-janaiyo
c1d5e00145 Add to Simple/Advanced README 2022-12-15 23:17:40 -05:00
hinto-janaiyo
6cab28117b main: allow [.] in [name] regex
[GUPAX_VERSION_UNDERSCORE] was used as the XMRig [Rig], which didn't
allow [.] (Gupax_v1.0.0), so allow for dots in the [name] regex.
2022-12-15 18:50:50 -05:00
hinto-janaiyo
3a01d28a18 Add [Video] guide 2022-12-15 17:18:28 -05:00
hinto-janaiyo
6496b27324 Add to Advanced README 2022-12-15 13:39:14 -05:00
hinto-janaiyo
6c59ecc759 Update README 2022-12-15 10:13:46 -05:00
hinto-janaiyo
c1a918c730 Update FAQ & Community node list 2022-12-14 21:55:10 -05:00
hinto-janaiyo
d9f5a059c9 helper: fix log reset message 2022-12-14 18:25:36 -05:00
hinto-janaiyo
f100fec02d xmrig: fix [Rig] check using [self.name] value
In XMRig Advanced the color/checkmark code was being given [self.name]
instead of [self.rig] which caused them to be linked, e.g: you clear
"Name" and [Rig] goes red instead.
2022-12-14 17:46:44 -05:00
hinto-janaiyo
83bdb1c63d helper: optimize PTY output parsing
(Stupid) Problem (caused by me):
--------------------------------
Up to 56million bytes of P2Pool/XMRig output were being held in memory
so they could be parsed. P2Pool output is the only one that needs
parsing as well, so double bad.

(Obvious) Solution:
-------------------
For XMRig:
Just don't write to an extra [String] buffer.

For P2Pool:
Parse the output, then... toss it out? You don't need the output
anymore after you parsed the values out, e.g: `Payouts`, `XMR Mined`.
Once they are parsed, add them to the current values instead of
completely overwriting them and then toss out the log buffer.

Now Gupax doesn't use stupid amounts of memory holding what is
essentially dead logs we already parsed. The parsing will be a lot
cheaper too since we aren't parsing the entire thing over and over
again (it was already pretty fast though).
2022-12-14 17:37:29 -05:00
hinto-janaiyo
aab23e5f4d cargo check/clippy fixes 2022-12-13 23:05:13 -05:00
hinto-janaiyo
d70cb25702 prepare v1.0.0 2022-12-13 16:34:10 -05:00
hinto-janaiyo
98be592a96 v0.9.0
Fixes:
    - Up/Down only work if UI is enabled
    - Re-pushed [P2POOL_API_PATH] to popped relative path
      but only after giving the popped path to P2Pool
          1. [/tmp/gupax/p2pool/p2pool] -> [/tmp/gupax/p2pool]
          2. Give that to P2Pool
          3. [/tmp/gupax/p2pool] -> [/tmp/gupax/p2pool/local/stats]
          4. Give that to the watchdog (so it can read it)
2022-12-13 15:06:07 -05:00
hinto-janaiyo
3d56435e3e p2pool/xmrig: handle custom arg [--no-color], API ip/port/path 2022-12-13 12:44:57 -05:00
hinto-janaiyo
f0d335170a helper/main: fix [Arc<Mutex>] deadlocks, add keyboard shortcuts
There was a deadlock happening between the [Helper]'s [gui_api_p2pool]
and the GUI's [gui_api_p2pool], since the locking order was different.
The watchdog loop locking order was fixed as well. This was a pain to
track down, better than a data race... I guess.

Oh and keyboard shortcuts were added in this commit too.

Comment from code:

// The ordering of these locks is _very_ important. They MUST be in sync
// with how the main GUI thread locks stuff or a deadlock will occur
// given enough time. They will eventually both want to lock the [Arc<Mutex>]
// the other thread is already locking. Yes, I figured this out the hard way,
// hence the vast amount of debug!() messages.
//
// Example of different order (BAD!):
//
// GUI Main       -> locks [p2pool] first
// Helper         -> locks [gui_api_p2pool] first
// GUI Status Tab -> trys to lock [gui_api_p2pool] -> CAN'T
// Helper         -> trys to lock [p2pool] -> CAN'T
//
// These two threads are now in a deadlock because both
// are trying to access locks the other one already has.
//
// The locking order here must be in the same chronological
// order as the main GUI thread (top to bottom).
2022-12-13 10:14:26 -05:00
hinto-janaiyo
4021f0aacd v0.9.0 (maybe) 2022-12-12 17:24:05 -05:00
hinto-janaiyo
540356b948 litter codebase with [debug!()]
The entire codebase is now littered with [debug!()] messages.
Thankfully [log] has 0 cost if you aren't using them, so regular
users won't have a runtime penalty unless they specify RUST_LOG=debug.
2022-12-12 14:50:34 -05:00
hinto-janaiyo
9131a2795f status: link helper & GUI's XMRig API 2022-12-11 22:01:37 -05:00
hinto-janaiyo
1c2f7d32ec helper/sudo: small p2pool api fixes, don't allow ESC when [testing] 2022-12-11 20:44:46 -05:00
hinto-janaiyo
67bb64471a Update README.md 2022-12-11 17:22:49 -05:00
hinto-janaiyo
1535b5744e xmrig/status: implement API hyper/tokio call; add [Gupax] stats 2022-12-11 15:51:07 -05:00
hinto-janaiyo
bef21e8663 gupax: add [Auto-P2Pool/XMRig] for running at Gupax startup 2022-12-10 23:10:26 -05:00
hinto-janaiyo
55f9b1437b p2pool: fix [Simple] console scrollbar bug
Something todo with the height multiplier for [P2Pool Simple]'s
console was causing weird behavior when changing to other tabs.
With the console a bit bigger now, the scrollbar no longer shows
and there is less glitchy resizing when switching to other tabs.
2022-12-10 22:10:10 -05:00
hinto-janaiyo
359766a0b9 main/helper: change [Start] button, change [Sudo] input order 2022-12-10 21:55:57 -05:00
hinto-janaiyo
db6f1fac13 macOS: handle killing XMRig with [sudo]
Even with the parent-child relationship and direct process handle,
Gupax can't kill an XMRig spawned with [sudo] on macOS, even though
it can do it fine on Linux. So, on macOS, get the user's [sudo]
pass on the [Stop] button and summon a [sudo kill] on XMRig's PID.

This also complicates things since now we have to keep [SudoState]
somehow between a [Stop] and a [Start]. So there is macOS specific
code that now handles that.
2022-12-10 21:00:08 -05:00
hinto-janaiyo
f487f2d934 windows/pty: include static [VCRUNTIME140.dll], change PTY size
Bare metal windows was complaining about this DLL, so it is now
included statically using [https://docs.rs/static_vcruntime/].
I tried statically linking everything for Windows but:
	1. It's not necessary, pretty much all DLLs needed
	   (except this one) are included in Windows 7+ by default
	2. It's a pain in the ass to build everything
	   statically, especially since Gupax needs OpenSSL.
	   (building OpenSSL on Windows == hell)

Windows/macOS were having console artifacts, escape codes and
random newlines would show up in P2Pool/XMRig output. After
thinking about it for a while, I realized I left the PTY
size to the default [24 rows/80 columns], hence the PTYs
prematurely inserting newlines and weird escape codes.

It works fine after setting it to [100/1000]. Interestingly,
Linux worked completely fine on 24/80, probably resizes internally.
2022-12-10 15:40:32 -05:00
hinto-janaiyo
6b00349e89 main: check for admin at init, good for windows, bad for unix 2022-12-09 22:06:42 -05:00
hinto-janaiyo
ac0c296ba5 windows: handle admin priviledge for xmrig
Please read the [src/README.md]. I hate windows so much.
2022-12-09 21:31:16 -05:00
hinto-janaiyo
d5b787e3ba xmrig: fix node [Save] not change selected values 2022-12-08 22:37:50 -05:00
hinto-janaiyo
3fdf9c8f86 p2pool/xmrig: add address/path check before allowing [Start] 2022-12-08 20:25:41 -05:00
hinto-janaiyo
0c1c0b9753 helper: start xmrig with sudo, implement [restart_xmrig()]
This commit takes care of correctly starting [sudo] with XMRig as
a command argument. The frontend [restart_*] function is also
implemented. In XMRig's case, the threads will sleep [3/5 seconds]
before [starting/restarting] so that [sudo] has time to open its
STDIN. This prevents premature inputs and outputting the password
to the STDOUT.
2022-12-08 18:34:31 -05:00
hinto-janaiyo
0fc7bd8440 helper: optimize [String] output buffers
Instead of cloning the entirety of the process's output, this
commit adds a sort of hierarchy of string buffers:

We need:
1. The full output for stat parsing (max 1 month/56m bytes)
2. GUI output to be lightweight (max 1-2 hours/1m bytes)
3. GUI output buffered so it's on a refresh tick of 1 second

------------------------------------------------------------------
So this is the new buffer hierarchy, from low to high level:
[Process] <-> [Watchdog] <-> [Helper] <-> [GUI]
------------------------------------------------------------------
Process: Writes to 2 buffers, a FULL (stores everything) and
a BUF which is exactly the same, except this gets [mem:take]n later
Stuff gets written immediately if there is output detected.

Watchdog: [std::mem::take]'s [Process]'s BUF for itself.
Both FULL and BUF output overflows are checked in this loop.
This is done on a slightly faster tick (900ms).

Helper: Appends watchdog's BUF to GUI's already existing [String]
on a 1-second tick.

GUI: Does nothing, only locks & reads.
------------------------------------------------------------------

This means Helper's buffer will be swapped out every second, meaning
it'll almost always be empty. Process's FULL output will be the
heaviest, but is only used for backend parsing. GUI will be in the
middle. This system of buffers makes it so not every thread has to
hold it's own FULL copy of the output, in particular the GUI thread
was starting to lag a little due to loading so much output.
2022-12-08 12:29:38 -05:00
hinto-janaiyo
733850c72b helper: copy p2pool functions to xmrig (todo!) 2022-12-07 20:50:14 -05:00
hinto-janaiyo
7cfeec96c5 sudo: zeroize pass on every [ask_sudo()] call 2022-12-07 20:34:44 -05:00
hinto-janaiyo
d3701dcc68 sudo: add [try_wait()] 5 second loop check for sudo 2022-12-07 20:22:41 -05:00
hinto-janaiyo
2a04766abd main: add [zeroize] and implement sudo input/test screen for xmrig 2022-12-07 18:02:08 -05:00
hinto-janaiyo
7be0b4ee6a app: check for overflowing user resolution values 2022-12-06 22:01:36 -05:00
hinto-janaiyo
980c8de53f helper: p2pool - write directly to GUI thread on exit 2022-12-06 21:33:24 -05:00
hinto-janaiyo
373cb7d369 p2pool/app: add STDIN + clear at 56million bytes, 4:3 default ratio 2022-12-06 21:19:24 -05:00
hinto-janaiyo
c31b063d31 helper: add data sync loop, add [ImgP2pool] for p2pool init data 2022-12-06 17:48:48 -05:00
hinto-janaiyo
d5f311b2ba helper: p2pool - add static [UserP2poolData] 2022-12-06 15:55:50 -05:00