Matthew Penner
d874af85db
tweaks to websocket event handling
2021-11-15 10:13:31 -07:00
Dane Everitt
32d6594476
fix incorrect error handling logic when a JWT is created wrongly; closes pterodactyl/panel#3295
...
Prior to this logic not only was the error response incorrect for events, but we registered event listeners before the authentication event; so if auth failed we flooded the socket with tons of output that was never going to be sent anyways.
This change now waits to register listeners until the socket is fully authenticated and we're guaranteed to have a token present.
2021-10-25 21:23:45 -07:00
Dane Everitt
023d7ec1ec
Close websocket connections and allow the client to re-connect on send errors; ref pterodactyl/panel#3596
2021-10-24 16:14:00 -07:00
Dane Everitt
09e1ba6f34
Use the request context for cancelation, not a background context
...
This also fixes an improperly written server deletion listener to look at the correct context cancelation.
Theoretically this should help address the issues in pterodactyl/panel#3596 but I'm not really sure how that happens, and theres no steps for reproduction.
2021-09-12 11:14:00 -07:00
Dane Everitt
ee91224eb6
add context timeouts to avoid hanging wings boot process if docker has a hiccup; closes pterodactyl/panel#3358
2021-09-11 14:13:19 -07:00
Matthew Penner
3c54c1f840
break everything
...
- upgrade dependencies
- run gofmt and goimports to organize code
- fix typos
- other small tweaks
2021-08-02 15:07:00 -06:00
Dane Everitt
adc0732af3
Better error handling and logging for restorations
2021-01-30 18:43:35 -08:00
Dane Everitt
b3922864f2
Simplify origin checking
2020-12-25 14:40:28 -08:00
Matthew Penner
5c78cb9ab3
Add transfer logging output ( #77 )
...
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2020-12-25 13:32:41 -08:00
Dane Everitt
59a111de39
Invite our lord and savior emperror back to the table
2020-12-15 21:56:53 -08:00
Dane Everitt
bcf0c72e47
Correctly report errors to admin users over the websocket; closes pterodactyl/panel#2709
2020-12-06 15:10:08 -08:00
Matthew Penner
de51fd1c51
Error handling improvements ( #71 )
...
* Remove `emperror.dev/errors`, remove all `errors#Wrap` and `errors#WithStack` calls
* Improve logging in `server/backup.go`
2020-11-28 16:57:10 -07:00
Matthew Penner
73b221d022
Switch old Server#GetState() calls over to Server#Environment#State()
2020-11-20 14:35:29 -07:00
Dane Everitt
be9d1a3986
Replace error handling package with emperror; add better reporting for errors escaping server root
2020-11-08 13:52:20 -08:00
Dane Everitt
a74be8f4eb
configurable socket log count; closes pterodactyl/panel#2659
2020-11-06 20:56:21 -08:00
Dane Everitt
65664b63e7
Add support for denying JWT JTI's that are generated before a specific time
2020-11-03 20:33:33 -08:00
Dane Everitt
37e59e6928
Close connected sockets when a server is deleted; closes pterodactyl/panel#2428
2020-10-03 20:46:29 -07:00
Dane Everitt
0f7bb1a371
Refactor filesystem to not be dependent on a server struct
2020-09-27 12:24:08 -07:00
Dane Everitt
a0fa5a94b6
Support websocket event to send server stats; ref pterodactyl/panel#2414
2020-09-27 09:46:00 -07:00
Dane Everitt
3655b172f3
Send JWT errors as specific event type
2020-09-27 09:09:34 -07:00
Dane Everitt
4748d7cb29
Don't spam errors to the output if attempting to send a command to an unattached starting instance; closes pterodactyl/panel#2385
2020-09-26 17:35:11 -07:00
Dane Everitt
62d0c7fa24
Mask errors from websocket being closed; closes pterodactyl/panel#2387
2020-09-26 16:10:32 -07:00
Dane Everitt
ae5005baa3
Don't log disk space errors
2020-09-25 20:02:38 -07:00
Matthew Penner
ff597672db
Fix #2380
2020-09-20 12:51:12 -06:00
Dane Everitt
6b25ac3665
Fix websocket error spam; only send known JWT issues along to the socket itself, not to wings console; closes pterodactyl/panel#2354
2020-09-17 20:30:51 -07:00
Dane Everitt
f2a6d6b3c5
Websocket cleanup
2020-09-12 22:12:23 -07:00
Dane Everitt
4ac19bd29d
Refactor confusing & fragile event bus logic to use callbacks and not channels; ref pterodactyl/panel#2298
2020-09-12 09:26:17 -07:00
Dane Everitt
fa6f56caa8
Remove pointless debug log
2020-09-11 23:18:51 -07:00
Dane Everitt
5a62f83ec8
Don't run pre-boot actions if the server is already running
2020-09-11 23:11:57 -07:00
Dane Everitt
b2eebcaf6d
Fix deadlocks in event listener system; closes pterodactyl/panel#2298
...
Fixes deadlocks that occurred when events were registered while other events were being unsubscribed and data was being flooded to these listeners. A complete mess, I hate this code, it is going to break again, but jesus I'm so tired.
2020-09-11 23:01:54 -07:00
Matthew Penner
45bcb9cd68
Lets not attempt to pull 16384 log lines
2020-09-11 22:52:07 -06:00
Matthew Penner
e10844d32c
Fix problems with CORS and websocket allowed origins
2020-09-10 21:08:00 -06:00
Matthew Penner
7ba32aca84
Fix some typos and run gofmt on all .go files
2020-09-05 13:08:40 -06:00
Dane Everitt
d99225c0fb
Add additional logging around resource polling
2020-09-03 21:19:06 -07:00
CyberKitsune
d742acf308
Minimize blocking in Filesystem.getCachedDiskUsage ( #53 )
2020-08-31 20:27:41 -07:00
Dane Everitt
4d3a860604
Use environment namespace for power state, don't duplicate them across server
2020-08-19 18:58:48 -07:00
Dane Everitt
cc52954a2a
Refactor environment handling logic to separate a server from the environment handler itself
...
This change makes the environment handling logic execute independent of the server itself and should make it much easier for people to contribute changes and additional environment handlers down the road without polluting the server object even more.
There is still a lot of work to do on this front to make things easier to work with, and there are some questionable design decisions at play I'm sure.
Welcome to additional modifications and cleanup to make this code easier to reason about and work with.
2020-08-10 21:38:42 -07:00
Dane Everitt
177aa8e436
Refactor power handling logic to be more robust and able to handle spam clicking and duplicate power actions
2020-08-01 15:20:39 -07:00
Dane Everitt
da26b4c5c7
Merge pull request #41 from pterodactyl/fix/race-1
...
Fix a possible race condition when Unsubscribing from the EventBus
2020-07-31 20:11:21 -07:00
Matthew Penner
b811d2474e
Add the ability to define additional allowed origins
2020-07-31 16:19:09 -06:00
Matthew Penner
5036077152
Hopefully fix a possible race condition when Unsubscribing from the EventBus while an event is being Published
2020-07-29 23:18:11 -06:00
Dane Everitt
7f9ec4402a
Add emitters for install started/stopped
2020-07-29 21:39:27 -07:00
Dane Everitt
f0d6f67c6b
Fix memory leak with websocket not removing unused listeners
2020-07-29 21:39:17 -07:00
Dane Everitt
0cbaad5c72
Completely re-work the server configuration to be separated out better
2020-07-19 16:27:55 -07:00
Dane Everitt
a00288aa64
Require a lock on the restart process to avoid double restarts causing unexpected behavior
2020-07-18 16:46:41 -07:00
Dane Everitt
8315ff8ae1
Misc mutex locking things to avoid data races
2020-07-18 16:03:25 -07:00
Dane Everitt
21303dc517
Address race conditions when booting a server process
2020-07-18 10:10:34 -07:00
Dane Everitt
65b1b96b06
Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
2020-06-13 10:26:37 -07:00
Dane Everitt
198a22f446
Replace even more zap occurences
2020-06-13 10:26:35 -07:00
Matthew Penner
5c2686fc6d
Fix multiple server status messages
2020-06-10 15:00:59 -06:00