Compare commits

..

491 Commits

Author SHA1 Message Date
Matthew Penner 5909731aa1
api(remote): fix wrong type in egg config service 2022-04-01 09:59:07 -06:00
Matthew Penner 10f5ce42c3
ui: fix this is undefined error 2022-04-01 09:58:29 -06:00
Matthew Penner 22580a6e81
yarn: upgrade from 3.0.2 to 3.2.0 2022-04-01 09:58:08 -06:00
Dane Everitt f51b730f51
Better user search filtering 2022-03-12 17:06:14 -05:00
Dane Everitt 6cc029cad6
Add clockwork in dev environments 2022-03-12 16:21:26 -05:00
Dane Everitt 2ee8ac557a
Add "*" filter for user searching 2022-03-12 16:08:00 -05:00
Dane Everitt 1f42d78382
Add a debounced state helper 2022-03-12 15:50:53 -05:00
Dane Everitt 95183edffd
Improve text extraction logic for searching 2022-03-12 14:36:00 -05:00
Dane Everitt e15e1572aa
Add base support for using jest 2022-03-12 13:24:59 -05:00
Dane Everitt c2136ae1d9
Break out some of the component logic 2022-03-12 12:05:09 -05:00
Dane Everitt 28608831a4
Start trying to piece together a more advanced search bar 2022-02-27 16:45:23 -05:00
Dane Everitt 93febff5e8
Include footer on the table 2022-02-27 16:15:11 -05:00
Dane Everitt 37ce7b08b7
Fix users and roles apis 2022-02-27 15:26:26 -05:00
Dane Everitt 034b4ad3b0
Hook up the select-all checkboxes 2022-02-27 13:32:22 -05:00
Dane Everitt 1096e70052
More base model cleanup 2022-02-27 12:54:25 -05:00
Dane Everitt 3d266ba41e
Update missed deps 2022-02-27 12:46:05 -05:00
Dane Everitt 097d308ccd
Update files to new format 2022-02-27 12:44:22 -05:00
Dane Everitt feffdacf57
Update schedules API 2022-02-27 12:35:27 -05:00
Dane Everitt bfd92c314d
Migrate users/network/database/backups to new format 2022-02-27 12:25:31 -05:00
Dane Everitt e908c391ee
Consolidate many of the server api files into one 2022-02-27 11:47:22 -05:00
Dane Everitt 5b5e3f26f4
Make the imports easier to use 2022-02-27 11:40:51 -05:00
Dane Everitt a00fee5516
Start working towards a consistent model/transformer layout 2022-02-27 11:26:13 -05:00
Dane Everitt 9f934b5ab8
Break table rows into own component 2022-02-27 11:04:57 -05:00
Dane Everitt 8e731e838f
Reorganize types 2022-02-27 11:04:50 -05:00
Dane Everitt 341fa45cbd
Merge branch 'dane/fiddle-with-new-tables' into v2 2022-02-27 10:51:56 -05:00
Dane Everitt 764811c927
Fix incompatible signatures after update 2022-02-27 10:50:31 -05:00
Dane Everitt cd5c2bc5fd
Fix incompatible signatures after update 2022-02-27 10:50:25 -05:00
Dane Everitt e02f4b8433
Raw styling needed for mass actions bar 2022-02-26 22:06:47 -05:00
Dane Everitt 308a7f3a90
Add input field 2022-02-26 21:51:40 -05:00
Dane Everitt ae522f1585
More color adjustments 2022-02-26 21:26:53 -05:00
Dane Everitt ff460805c0
Update colors 2022-02-26 20:59:29 -05:00
Dane Everitt 0bab962337
Add underlying design component for a dialog 2022-02-26 17:05:30 -05:00
Dane Everitt f4119df0aa
Add basic dropdown styling using headless ui 2022-02-26 15:13:13 -05:00
Dane Everitt eb56be8021
Merge branch 'v2' into dane/fiddle-with-new-tables 2022-02-26 12:03:49 -05:00
Dane Everitt 134ba508e2
Fix i18n 2022-02-26 12:01:05 -05:00
Dane Everitt 0dddcfca36
Continue to throw exceptions when file is not found 2022-02-26 11:54:12 -05:00
Dane Everitt c16fa92904
Cleanup php-cs-fixer 2022-02-26 11:51:18 -05:00
Dane Everitt 0e1c3a76f4
Test cleanup 2022-02-26 11:49:59 -05:00
Dane Everitt 941cb9eda4
A little composer magic to really make this a good project 2022-02-26 11:46:31 -05:00
Dane Everitt e236f74d1d
First pass at getting us on Laravel 9 2022-02-26 11:15:20 -05:00
Dane Everitt cc43a6ec64
Drop remaining references to alerts package 2022-02-26 10:40:45 -05:00
Dane Everitt a3cdfa83f2
Bump support for 8.1 minimum 2022-02-26 10:32:09 -05:00
Dane Everitt bc59ffbf37
Initial concept at a user table listing using Tailwind JIT & Headless UI 2022-02-20 19:10:58 -05:00
Dane Everitt 4920ca41a8
Fix colors 2022-02-20 18:35:44 -05:00
Dane Everitt 06cc228f26
Move to TailwindCSS 3 and JIT support to slowly replace twin.macro/styled-components 2022-02-20 18:22:56 -05:00
Dane Everitt cb4d4b5ce6
Make personal access tokens soft-deletable; update front-end 2022-02-20 13:07:12 -05:00
Dane Everitt 4cbdaa6699
Require php 8 2022-02-20 12:15:35 -05:00
Dane Everitt 14c9a0a031
Merge branch 'develop' into v2 2022-02-20 11:49:53 -05:00
Dane Everitt fb1f75353d
Run cs-fixer on files 2022-02-13 19:06:53 -05:00
Dane Everitt afd0a8f768
Update phpstan 2022-02-13 19:04:11 -05:00
Dane Everitt b9016aa25e
Update dependencies to latest versions where relevant; drop dusk and debugbar 2022-02-13 18:50:22 -05:00
Dane Everitt e683c0a518
Fix failing tests related to these changes 2022-02-13 18:32:02 -05:00
Dane Everitt 341ff6e178
Cleanup test framework; drop all the unused browser tests 2022-02-13 17:59:53 -05:00
Dane Everitt a4359064ca
Cleaner login flows; hide options that aren't relevant to the user 2022-02-13 17:44:59 -05:00
Dane Everitt fac4902ccc
Don't trigger an internal error if hitting 2fa endpoint and it isn't enabled 2022-02-13 17:33:12 -05:00
Dane Everitt d6cd0c6230
Login checkpoint cleanup, hide prompt when leaving screen 2022-02-13 17:27:38 -05:00
Dane Everitt d9d9b1748f
Cleanup key UI when logging in 2022-02-13 16:54:12 -05:00
Dane Everitt 9032699deb
Use SWR for security key index 2022-02-13 15:44:19 -05:00
Dane Everitt b43e8835bb
Don't store a new key on every login 2022-02-13 15:06:08 -05:00
Dane Everitt 2d2352017d
Fix login authentication using security key 2022-02-13 14:57:45 -05:00
Dane Everitt 09497c234a
Support authenticating the provided key when loggin in 2022-02-13 14:44:50 -05:00
Dane Everitt 54c7207836
Fix authentication request creation 2022-02-13 14:23:20 -05:00
Dane Everitt 969d40d6c1
Logic cleanup after a bit of dust collection 2022-02-13 14:15:18 -05:00
Dane Everitt 8971e78ab5
Merge branch 'v2' into dane/webauthn 2022-02-13 13:46:15 -05:00
Dane Everitt cd84663ffe
Fix missing import from merge 2022-02-13 13:17:33 -05:00
Dane Everitt fe4d283311
Fix feature pathing 2022-02-13 13:00:52 -05:00
Dane Everitt ca6f501c70
Merge branch 'develop' into v2 2022-02-13 12:55:02 -05:00
Matthew Penner b0d6be802c
Merge branch 'develop' into v2 2022-01-17 20:30:46 -07:00
Matthew Penner d1c9af8f04
Merge branch 'develop' into v2 2022-01-08 15:20:23 -07:00
Matthew Penner 6e4e0bc0a4
ui(admin): update server image when switching eggs 2021-11-17 14:28:19 -07:00
Matthew Penner 81ff03c2a3
ui(admin): add 'externalId' field for users 2021-11-17 14:26:23 -07:00
Matthew Penner 9c92d51e28
ui: organize and tweak to flash messages 2021-11-17 13:52:17 -07:00
Matthew Penner d8da79b7fb
yarn: upgrade dependencies 2021-11-12 13:16:15 -07:00
Matthew Penner ce0bc477c2
ui(admin): fix egg variables 2021-11-04 14:33:24 -06:00
Matthew Penner f7c824743f
ui(editor): prevent initialContent being duplicated 2021-11-04 13:44:10 -06:00
Matthew Penner 5359ef8407
api(app): allow removing a server's startup command 2021-11-04 11:47:08 -06:00
Matthew Penner 34d20b2bf0
api: remove old debug logs 2021-11-04 11:37:33 -06:00
Matthew Penner fad4005168
Merge branch 'develop' into v2 2021-11-04 11:34:11 -06:00
Matthew Penner 44f4cbc4c3
Merge branch 'develop' into v2 2021-11-03 15:35:22 -06:00
Matthew Penner 728adfe388
server(startup): make startup nullable; resolves #3721 2021-11-03 15:32:53 -06:00
Dane Everitt cdd8eabcc0
Add phpstan for static analysis (#3718) 2021-10-30 13:41:38 -07:00
Matthew Penner 871d0bdd1c
ui(admin): add egg exporting 2021-10-30 14:23:29 -06:00
Matthew Penner 469c0b40a3
ui(admin): add views for settings 2021-10-30 13:12:02 -06:00
Matthew Penner 70cf5c17aa
ui(admin): basic server creation 2021-10-29 00:04:28 -06:00
Matthew Penner cc2ed97b0f
ui: fix SearchableSelect not selecting when hitting enter 2021-10-28 23:48:07 -06:00
Matthew Penner c48d573cc9
Merge branch 'develop' into v2 2021-10-28 22:59:12 -06:00
Matthew Penner 5e99bb8dd6
ui(admin): fix server startup variables 2021-10-24 16:05:00 -06:00
Matthew Penner cf1cc97340
ui(admin): rough layout on new server page 2021-10-23 15:19:49 -06:00
Matthew Penner bee7c4515c
eggs: update default script values 2021-10-23 14:31:23 -06:00
Matthew Penner f6ac9707fa
Merge branch 'develop' into v2 2021-10-23 14:22:18 -06:00
Matthew Penner 7f7506e5a9
ui(admin): fix bad redirect on egg delete 2021-10-23 14:19:50 -06:00
Matthew Penner 0e870ab256
fix integration tests 2021-10-23 14:17:05 -06:00
Matthew Penner 2948e344d2
fix integration tests 2021-10-23 13:34:41 -06:00
Matthew Penner b966069946
Merge branch 'develop' into v2 2021-10-23 13:26:25 -06:00
Matthew Penner cddf2ce41c
ui(admin): new egg page 2021-10-23 13:13:25 -06:00
Matthew Penner 336923ec18
ui(admin): fix container width on server startup 2021-10-23 12:31:30 -06:00
Matthew Penner 3b5fa34d85
ui(admin): add delete confirmation for egg variables 2021-10-23 12:29:17 -06:00
Dane Everitt a3572006cb
Merge branch 'dane/type-cleanup' into v2 2021-10-10 13:21:44 -07:00
Dane Everitt 8486c914ae
More fixup for egg handling 2021-10-10 13:21:21 -07:00
Dane Everitt 85c8f4884f
Cleanup more of the server screen typings 2021-10-10 13:13:10 -07:00
Dane Everitt f6998018b4
Cleanup more of the server UI logic 2021-10-10 12:03:28 -07:00
Dane Everitt e3aca937b5
Add more type cleanup and have a completed server type 2021-10-10 11:32:07 -07:00
Dane Everitt 00d0f49ede
Cleanup typing for server and expose more useful endpoint and transformer logic 2021-10-09 12:02:32 -07:00
Matthew Penner 3afd8b9f03
just work, thanks 2021-10-06 15:10:46 -06:00
Matthew Penner fb14603e17
love me some magic numbers 2021-10-06 15:06:53 -06:00
Matthew Penner 9ab8f946ec
this should fix tests!
Pro-tip: disable function calls that don't work instead of trying
to figure out why they don't work :)
2021-10-06 15:02:30 -06:00
Matthew Penner d945ce76f2
hopefully fix integration tests 2021-10-06 14:45:44 -06:00
Dane Everitt 7ec78d9400
Move feature limits box into own component 2021-10-03 18:38:45 -07:00
Matthew Penner 6814811a19
ui(admin): tweaks to spacing 2021-10-03 18:26:44 -06:00
Dane Everitt 817a2bf8ae
Use grid and server SWR for settings box 2021-10-03 16:24:34 -07:00
Matthew Penner 15aed3192b
ui(admin): consistency with button naming 2021-10-03 17:11:27 -06:00
Matthew Penner b5b65e3d81
ui(admin): fix max width container 2021-10-03 17:11:26 -06:00
Dane Everitt fcfca0730e
Use SWR to fetch and track the selected server on server detail pages 2021-10-03 16:10:06 -07:00
Dane Everitt 1405c881a8
Fix sidebar styling and remove hacky fixed positioning 2021-10-03 15:37:01 -07:00
Matthew Penner b070efce98
ui(admin): add allocation delete button 2021-10-03 16:28:58 -06:00
Matthew Penner 6df90a12d8
ui(admin): add delete egg variable button 2021-10-03 16:07:13 -06:00
Matthew Penner b2aa05dc07
ui(admin): add new egg variable option 2021-10-03 16:07:13 -06:00
Matthew Penner 1eed25dcc7
ui(admin): finish egg variable editing 2021-10-03 16:07:13 -06:00
Dane Everitt 749dc70e71
Unfuck lock file 2021-10-03 13:50:16 -07:00
Matthew Penner 7239f0e336
ui(admin): add egg variable elements 2021-10-01 11:25:06 -06:00
Matthew Penner e2de673488
Merge branch 'develop' into v2 2021-09-30 16:08:11 -06:00
Matthew Penner 2dfc264bf8
ui: tweaks to Editor 2021-09-19 12:33:55 -06:00
Dane Everitt 5a4d1a668f
UI tweaking and transformer for the stored keys 2021-09-19 11:24:38 -07:00
Dane Everitt 81a6a8653f
Fix up creation of keys to fail when registering the same key again 2021-09-19 11:24:33 -07:00
Dane Everitt 1053b5d605
Get basic storage of webauthn tokens working 2021-09-19 11:24:33 -07:00
Dane Everitt eaf12aec60
Clean out existing webauthn logic, implement base logic for base package 2021-09-19 11:24:31 -07:00
Matthew Penner 0103a0c31e
ui(admin): minor ui tweaks to server startup 2021-09-18 12:27:32 -06:00
Matthew Penner 21d717080a
ui(admin): minor ui tweaks to server settings 2021-09-18 12:26:36 -06:00
Matthew Penner 32e8406c37
ui(admin): fix node behind proxy and automatic allocation settings 2021-09-18 12:24:13 -06:00
Matthew Penner ef47f21943
ui(admin): fix inconsistent select styling 2021-09-18 12:20:19 -06:00
Matthew Penner b2d3aed520
ui(admin): fix egg delete redirect 2021-09-18 12:05:19 -06:00
Matthew Penner b125830859
ui(admin): add startup and file configuration editing for eggs 2021-09-18 11:45:32 -06:00
Matthew Penner 7d1cb2971f
api(application): allow updating node description
fixes #3624
2021-09-18 11:00:31 -06:00
Matthew Penner 6abf4a302c
ui(admin): add basic egg editing 2021-09-17 19:56:44 -06:00
Matthew Penner 66443dd5d3
ui(admin): implement egg about 2021-09-17 15:40:17 -06:00
Matthew Penner 8d0dd42475
ui(admin): add egg install editing 2021-09-17 14:47:56 -06:00
Matthew Penner e8ddadc608
ui(admin): implement basic egg importing 2021-09-17 13:48:20 -06:00
Matthew Penner 107cf72269
ui(admin): consistency tweaks, add egg pages 2021-09-17 13:06:31 -06:00
Matthew Penner db4fb3ac53
ui(admin): don't block render until egg is loaded 2021-09-16 20:19:10 -06:00
Matthew Penner 34da772db7
ui(admin): show alias in allocation dropdown; fixes #3434 2021-09-16 16:54:02 -06:00
Matthew Penner 9b7cea5d04
ui(admin): server startup fixes
- when a new egg is selected, set the variable values to the egg's default, not just the placeholder
- when a new egg is selected, change the server's startup command to the default; fixes #3397
- remove move un-needed code
2021-09-16 16:46:41 -06:00
Matthew Penner 98da1f13a1
remove un-needed code 2021-09-16 15:07:14 -06:00
Matthew Penner df895f4a9f
ui(admin): server edit cleanup, fix startup form 2021-09-16 15:03:51 -06:00
Matthew Penner 95f3eb54db
ui(admin): get server startup ui working 2021-09-15 21:22:15 -06:00
Matthew Penner a6ab61adba
ui(admin): allow editing allocations for servers 2021-09-15 15:37:17 -06:00
Matthew Penner 656ac62ad2
ui: fix fields with invalid type 2021-09-15 11:41:02 -06:00
Matthew Penner 6df2368264
ui(admin): server editing improvements 2021-09-15 11:18:58 -06:00
Matthew Penner 23a160b9e1
Merge branch 'develop' into v2 2021-09-15 10:30:40 -06:00
Matthew Penner df11129291
ui(admin): fix UserForm not allowing null role 2021-09-13 19:15:21 -06:00
Matthew Penner 24d1799322
api(application): fix 'root_admin' not being set 2021-09-13 17:24:16 -06:00
Matthew Penner 5843c34240
fix type error with WebauthnKeyTransformer 2021-09-13 02:34:01 -06:00
Matthew Penner 4da38891c7
admin: fix nest create not working 2021-09-13 01:53:10 -06:00
Matthew Penner 004a13a5f7
fix null admin role breaking user transformer 2021-09-13 00:58:39 -06:00
Matthew Penner a92f3648b2
ui(admin): start work on egg install settings 2021-09-13 00:07:09 -06:00
Matthew Penner a615b7fa70
ui(admin): start work on server startup settings 2021-09-12 23:50:12 -06:00
Matthew Penner 6362731d55
ui(admin): implement basic server editing 2021-09-12 22:15:45 -06:00
Matthew Penner d0a78ec067
ui(admin): add new node page 2021-09-12 21:22:33 -06:00
Matthew Penner 3c01dbbcc5
ui(admin): add allocation table, implement allocation creator 2021-09-12 19:40:10 -06:00
Matthew Penner 6b746440fc
config(app): remove un-used alias 2021-09-12 17:48:28 -06:00
Matthew Penner c7ab6b9e6c
ui(admin): fix validation rules on UserForm 2021-09-12 17:24:31 -06:00
Matthew Penner 38ff35873e
ui: make PowerControls buttons uppercase 2021-09-12 17:16:26 -06:00
Matthew Penner 1ead83383d
ui(admin): add 'root_admin' field to UserForm 2021-09-12 17:13:00 -06:00
Matthew Penner fc2f8744da
ui(admin): add user editing 2021-09-12 17:00:22 -06:00
Matthew Penner c716be263b
Merge branch 'matthewpi/fix-server-build-modification' into v2 2021-09-12 16:31:42 -06:00
Matthew Penner 0c943248bc
cleanup 2021-09-12 16:22:34 -06:00
Matthew Penner 927677e490
yarn: switch to berry 2021-09-12 16:13:57 -06:00
Matthew Penner 222300ff17
code cleanup, fix errors 2021-09-12 15:56:47 -06:00
Matthew Penner 8acce201d6
Merge branch 'develop' into v2 2021-09-12 15:47:27 -06:00
Matthew Penner 1880b83944
server: fix build modification not being persisted 2021-09-12 15:27:02 -06:00
Matthew Penner 42bfaf9a19
ui: fix security keys render error 2021-09-11 16:22:58 -06:00
Matthew Penner e384c0d5c3
Merge branch 'develop' into v2 2021-09-11 16:13:11 -06:00
LoaiDev 9f00c353b1
Fix named exports for state (#3578) 2021-09-11 12:20:53 -07:00
Matthew Penner ded71c9af1
ui(admin): tweaks to sidebar 2021-09-11 12:34:40 -06:00
Matthew Penner e4fc0f5ac3
yarn and composer updates 2021-09-10 15:30:22 -06:00
Matthew Penner d167ef1f89
Merge branch 'develop' into v2 2021-09-01 16:28:56 -06:00
Matthew Penner 4bf9143789
Merge branch 'develop' into v2 2021-08-24 11:40:40 -06:00
Matthew Penner 8f43ca66df
actually fix bad merge 2021-08-21 13:35:55 -06:00
Matthew Penner 69df0adbd9
Merge branch 'issue/3553' into v2 2021-08-21 12:57:42 -06:00
Matthew Penner 14eb482791
fix bad merge 2021-08-21 12:56:56 -06:00
Matthew Penner b26556e201
Merge branch 'develop' into v2 2021-08-21 12:50:51 -06:00
Matthew Penner 3b72049d05
migrations: add foreign keys for mount relations 2021-08-21 12:15:39 -06:00
Dane Everitt 15b03b96fc
Be consistent with form order 2021-08-07 16:24:36 -07:00
Dane Everitt 874e7afce3
Merge branch 'dane/sanctum' into v2 2021-08-07 16:19:19 -07:00
Dane Everitt 9fe1527f10
Get tests back in working order 2021-08-07 16:19:01 -07:00
Dane Everitt baf8a9fb2c
Skip failing application API endpoints 2021-08-07 16:17:16 -07:00
Dane Everitt 436e686037
Apply php-cs-fixer changes 2021-08-07 16:10:24 -07:00
Dane Everitt cec96062e3
Get client API tests back into passing order 2021-08-07 16:08:29 -07:00
Dane Everitt 7169b481b1
Fix broken php-cs-fixer config 2021-08-07 16:00:14 -07:00
Dane Everitt b19ce4df7c
Fix transformer handling of closures 2021-08-07 16:00:04 -07:00
Dane Everitt 5a1cceb9d2
Fix bindings for schedule tasks 2021-08-07 15:45:36 -07:00
Dane Everitt 3a83a2d5ac
Remove last references to removed api_key model 2021-08-07 15:31:52 -07:00
Dane Everitt 815ce0e451
Fix test coverage for creating account API keys 2021-08-07 15:20:43 -07:00
Dane Everitt 3d14974d64
Correctly set the resource name on empty transformers 2021-08-07 15:06:00 -07:00
Dane Everitt 1bc1b87422
Fix call to getIncludesForTransformer 2021-08-07 14:54:22 -07:00
Dane Everitt 9e0ec8fca8
Update access token generation to return more useful class 2021-08-07 14:52:58 -07:00
Dane Everitt fdd90b3be7
Remove unnecessary function 2021-08-07 14:32:40 -07:00
Dane Everitt bbf2f33c5e
Replace with corrected static calls 2021-08-07 13:25:35 -07:00
Dane Everitt 5c81f820d8
Remove old application API base transformer 2021-08-07 13:25:06 -07:00
Dane Everitt cf500a1a54
Use a standardized transformer base; replace all client transformers to call that base 2021-08-07 13:06:45 -07:00
Dane Everitt 2203a4d87e
Normalize logic across client and application API 2021-08-07 11:55:49 -07:00
Dane Everitt bc1db626e7
Fix up subuser controller to use better binding checks 2021-08-07 11:15:44 -07:00
Dane Everitt 74426a97f4
Simplify logic for checking for missing unbound models 2021-08-07 11:15:30 -07:00
Dane Everitt 5b33a6a434
Update .gitignore 2021-08-07 09:21:19 -07:00
Dane Everitt 74a77a0e86
Merge branch 'develop' into v2 2021-08-07 09:21:05 -07:00
Dane Everitt 4d1a7e6637
Improve client API route model binding and prevent accidental route access without valid model binds 2021-08-04 22:20:43 -07:00
Matthew Penner 56556e9660
ui(admin): implement new mount page 2021-08-04 22:41:52 -06:00
Dane Everitt e1089e0b73
Update calls to abstract class 2021-08-04 21:36:57 -07:00
Dane Everitt e8474271b3
Actually include sanctum post-force push 2021-08-04 21:17:56 -07:00
Matthew Penner 00b44bf3bb
ui(admin): tweaks to server management 2021-08-04 22:16:52 -06:00
Dane Everitt 47b895a98a
Update existing application API to use simplified user permission checking 2021-08-04 21:15:19 -07:00
Dane Everitt 622d292f39
Update the client API to be consistent with how validation is handled 2021-08-04 21:15:19 -07:00
Dane Everitt b47d262ee0
Initial pass at deleting as much removed logic as possible; still need to migrate old keys and permissions over 2021-08-04 21:15:18 -07:00
Dane Everitt dfff8ad667
Cleanup frontend to only pass the required description field 2021-08-04 21:15:18 -07:00
Dane Everitt 374910d73a
Fix support for authorization using sanctum tokens 2021-08-04 21:15:18 -07:00
Dane Everitt 1a3451fb0d
Update underlying model representation for PATs 2021-08-04 21:15:18 -07:00
Dane Everitt d60e8a193b
Very basic working implementation of sanctum for API validation 2021-08-04 21:15:16 -07:00
Matthew Penner 4b32828423
Merge branch 'develop' into v2 2021-08-04 21:40:38 -06:00
Matthew Penner 0ab124f026
Merge branch 'fix/backup-ui' into v2 2021-08-04 17:29:57 -06:00
Matthew Penner 94198f3bfd
Merge branch 'develop' into v2 2021-08-04 17:27:14 -06:00
Matthew Penner f44833ca9c
ui(server): fix used backup count 2021-08-04 17:22:57 -06:00
Matthew Penner 178a886d3b Merge branch 'develop' into v2 2021-08-03 21:13:13 -06:00
Matthew Penner c6dccc568d ui(server): add file upload status 2021-08-03 20:41:28 -06:00
Matthew Penner 3d3df30903 Merge branch 'fix/upgrade-command' into v2 2021-08-03 20:40:45 -06:00
Matthew Penner 38ddcfb0d9 Merge branch 'fix/backups' into v2 2021-08-03 20:40:40 -06:00
Matthew Penner b9ab6e2c33 editor: fix Mod-s hotkey and save button 2021-08-03 20:21:52 -06:00
Matthew Penner 07617bcd27 backups: properly query backups 2021-08-03 16:37:22 -06:00
Matthew Penner c46131e7ad backups: default is_successful to false 2021-08-03 15:46:08 -06:00
Matthew Penner a39802cb4e Merge branch 'develop' into v2 2021-08-03 14:41:12 -06:00
Matthew Penner d9740fff65 cmd(upgrade): fix force and seed flags being ignored 2021-08-03 14:35:48 -06:00
Matthew Penner 174cca9e49 tests(integration): fix user controller test, actually 2021-08-02 22:26:05 -06:00
Matthew Penner d9d79d8c95 tests(integration): fix user controller test, allegedly 2021-08-02 22:23:47 -06:00
Matthew Penner d2864410ed user: yeet remaining name_* fields, again... 2021-08-02 22:17:11 -06:00
Matthew Penner 4d77d486ec user: yeet remaining name_* fields 2021-08-02 22:10:53 -06:00
Matthew Penner 833b47abc5 actions(tests): run on v2 branch 2021-08-02 15:25:44 -06:00
Matthew Penner 346271a9a3 ui(admin): add role delete button 2021-08-02 12:29:29 -06:00
Matthew Penner 89a0244cf2 ui: fix usePersistedState erroring when key doesn't exist 2021-08-02 12:23:38 -06:00
Matthew Penner 1d9927d7f8 ui(admin): persist sidebar collapsed state 2021-08-02 12:19:18 -06:00
Matthew Penner 98cb7370f0 ui(admin): fix null value being passed to input 2021-08-02 11:53:04 -06:00
Matthew Penner 2b8565fd1a yarn: upgrade dependencies 2021-08-02 11:47:13 -06:00
Matthew Penner 455be4bb52 composer: upgrade dependencies 2021-08-02 11:47:05 -06:00
Matthew Penner 98ed8e431b ui(admin): cleanup 2021-08-02 11:32:09 -06:00
Matthew Penner 27ed07e81f ui(admin): fix user sidebar alignment when collapsed 2021-08-02 10:26:29 -06:00
Matthew Penner fffe3a7f8b ui(admin): fix node settings button 2021-08-02 10:23:58 -06:00
Matthew Penner 0313bdb1cb ui(admin): add role edit form 2021-08-02 10:08:52 -06:00
Matthew Penner 030bc2d8ef ui(admin): fix server table links 2021-08-02 10:01:55 -06:00
Matthew Penner 11fc88c849 ui(admin): implement user and node servers tab 2021-08-02 09:54:13 -06:00
Matthew Penner bf9dfa87da yeet name_first and name_last from users table 2021-07-28 21:31:00 -06:00
Matthew Penner f1be653486 ui(admin): remove api key components 2021-07-28 11:56:25 -06:00
Matthew Penner b8b481b57b ui: fix borked styling 2021-07-25 17:14:55 -06:00
Matthew Penner 7f290c6e52 ui(admin): change other logout button 2021-07-25 16:10:12 -06:00
Matthew Penner e56aef31bc api(application): allow updating a user's role 2021-07-25 15:59:58 -06:00
Matthew Penner ca4046e818 ui(admin): fix new roles not mutating swr 2021-07-25 15:54:16 -06:00
Matthew Penner 25feeaa9f5 ui(admin): add role select for user management 2021-07-25 15:51:39 -06:00
Matthew Penner 58f0bbbb9b ui(files): fix error with bad URL 2021-07-25 13:43:58 -06:00
Matthew Penner 3c2a6e1136 ui(files): add pull file modal 2021-07-25 13:24:52 -06:00
Matthew Penner 01242a805d actions(tests): remove mariadb:10.5 2021-07-24 15:20:30 -06:00
Matthew Penner 6acb989965 actions(tests): use the database... 2021-07-24 15:08:13 -06:00
Matthew Penner b25a0c4cbc actions(tests): use 'php artisan test', actually... 2021-07-24 15:05:37 -06:00
Matthew Penner 544d1f5746 actions(tests): use 'php artisan' for running tests 2021-07-24 15:04:06 -06:00
Matthew Penner 31847a8566 composer: upgrade dependencies 2021-07-24 15:01:14 -06:00
Matthew Penner 14940d666b yarn: upgrade dependencies 2021-07-24 14:41:45 -06:00
Matthew Penner 88bcb69a8a ui: small tweaks 2021-07-24 14:06:51 -06:00
Matthew Penner 631b4ae2a8 ui: fix ServerRow icon being squished 2021-07-24 12:45:03 -06:00
Matthew Penner 0828d00857 ui(admin): change logout button 2021-07-24 12:36:10 -06:00
Matthew Penner 426d955643 Merge branch 'develop' into feature/react-admin 2021-07-24 12:28:01 -06:00
Matthew Penner 27c93365e9 ui(admin): add user create and user update 2021-07-24 12:23:33 -06:00
Matthew Penner 1d290919b7 ui: fix devtools issue with missing DOCTYPE 2021-07-24 12:23:21 -06:00
Matthew Penner 7b3c71f6a7 ui(server): fix console z-index 2021-07-24 11:43:00 -06:00
Matthew Penner 26438fa034 ui(server/files): add validation for duplicate directory names 2021-07-24 11:32:31 -06:00
Matthew Penner be011906e6 ui(admin): lower table loader height
fixes tables growing while the page is loading, this is very noticable
when latency to the API is low, which means the loader is only visible
for 1/30th to 1/20th of a second.
2021-07-22 11:21:31 -06:00
Matthew Penner 361596e051 ui: I HATE STYLED-COMPONENTS WITH TYPESCRIPT 2021-07-22 11:15:27 -06:00
Matthew Penner 23de3d68f3 ui: remove old console logs 2021-07-21 12:21:10 -06:00
Matthew Penner 3b1a0e22a7 ui: update codemirror editor 2021-07-21 12:18:53 -06:00
Matthew Penner d2d62b7463 ui(admin): tweaks to SelectField styling 2021-07-20 15:29:22 -06:00
Matthew Penner 84b207eddb ui(admin): fix eslint errors, add CreateAllocationForm 2021-07-20 14:38:11 -06:00
Matthew Penner d32b3a0473 Merge branch 'develop' into feature/react-admin 2021-07-20 13:01:28 -06:00
Matthew Penner 6879ca4054 ui(admin): cleanup table hooks, more... 2021-07-19 14:37:09 -06:00
Matthew Penner 7524bbe8ee ui(admin): cleanup table hooks 2021-07-19 14:34:10 -06:00
Matthew Penner 30f09a4098 ui: fix build due to wrong import path 2021-07-18 13:36:54 -06:00
Matthew Penner 08c780c388 tests: cleanup unneeded code 2021-07-18 11:29:39 -06:00
Matthew Penner 64110d84af tests(unit): add RequireTwoFactorAuthenticationTest 2021-07-18 11:28:14 -06:00
Matthew Penner 790f109e66 api(remote): update sftp auth controller 2021-07-17 17:22:47 -06:00
Matthew Penner f9114e2de0 feat(ssh-keys): add ssh key endpoints and ui components 2021-07-17 15:45:46 -06:00
Matthew Penner 9d64c6751b app: update models 2021-07-17 15:18:05 -06:00
Matthew Penner 28bc86e23b ui(account): implement delete security key button 2021-07-17 14:45:23 -06:00
Matthew Penner 59f2ea37d8 ui(auth): add support for using a security key 2021-07-17 14:45:23 -06:00
Matthew Penner 3c21770c25 ui(account): add security key management 2021-07-17 14:45:23 -06:00
Matthew Penner 31c2ef5279 webauthn: update login flow to support other 2fa methods 2021-07-17 14:45:23 -06:00
Matthew Penner 42a3e740ba yarn: add @types/webappsec-credential-management 2021-07-17 14:45:23 -06:00
Matthew Penner 28146f5bb6 webauthn: add controllers and transformers 2021-07-17 14:45:23 -06:00
Matthew Penner cdd07fa275 composer: require asbiin/laravel-webauthn 2021-07-17 14:45:23 -06:00
Matthew Penner f137192113 Merge branch 'develop' into feature/react-admin 2021-07-17 14:45:12 -06:00
Matthew Penner c09cfd4c76 ui(server): fix admin popout link 2021-07-17 14:33:03 -06:00
Matthew Penner bc4e28578d Merge branch 'develop' into feature/react-admin 2021-07-17 11:12:02 -06:00
Matthew Penner 7ad32293f3 ui(admin): table improvements 2021-07-15 16:10:55 -06:00
Matthew Penner 11bafe42b4 composer: upgrade, again. 2021-07-15 16:10:34 -06:00
Matthew Penner 779b0eca67 ui(admin): fix tables being covered by no items message 2021-07-14 16:59:37 -06:00
Matthew Penner c0e9f1adee ui(admin): make all tables searchable and sortable 2021-07-14 16:43:59 -06:00
Matthew Penner 8f8d66584d yarn: update codemirror/next version 2021-07-13 16:06:00 -06:00
Matthew Penner 2d412e66ac ui: fix global styles 2021-07-13 15:58:44 -06:00
Matthew Penner ef5380e59d Merge branch 'matthewpi/yarn-upgrade' into feature/react-admin 2021-07-13 15:25:43 -06:00
Matthew Penner e86f9a5ed9 Merge branch 'matthewpi/database-tls' into feature/react-admin 2021-07-13 15:23:07 -06:00
Matthew Penner ea4bcf0b9c Merge branch 'develop' into feature/react-admin 2021-07-13 15:21:16 -06:00
Matthew Penner 2963b77b41 revert 'test fixes' 2021-07-13 15:16:53 -06:00
Matthew Penner 7776436d18 config: add ssl/tls options for mysql and redis 2021-07-11 15:00:30 -06:00
Matthew Penner 8d5dbbb57b attempt to fix lock error on mariadb:10.6 tests 2021-07-11 14:56:27 -06:00
Matthew Penner 63a466c79a yarn: fix hot-loader version 2021-07-11 14:01:42 -06:00
Matthew Penner 3bf34024c7 yarn: remove yarn-deduplicate, delete .yarnclean 2021-07-11 14:01:42 -06:00
Matthew Penner f4442d0b1c yarn: fix webpack-dev-server 2021-07-11 14:01:42 -06:00
Matthew Penner 96788f9269 fix .php_cs.dist error 2021-07-11 14:01:42 -06:00
Matthew Penner 01464b6da5 actions(tests): use mariadb 10.5 instead of 10.6
10.6.2 (latest docker build as of 2021-07-09) is a RC, not a stable release.
10.6.3 is out and is a stable release, however, no docker image is built for it yet.
10.6 should be added or replace 10.5 once a stable docker image is available.
2021-07-11 14:01:42 -06:00
Matthew Penner 7dacf90718 actions(tests): only run once for pull requests 2021-07-11 14:01:42 -06:00
Matthew Penner c49e8b1a07 actions(tests): fix bad syntax 2021-07-11 14:01:42 -06:00
Matthew Penner 98c54cba3a yarn: update dependencies, prepare for Plug'n'Play 2021-07-11 14:01:42 -06:00
Matthew Penner 3a3caee715 yarn: upgrade to yarn 2 2021-07-11 14:01:42 -06:00
Matthew Penner 556885f682 ui(admin): uncomment delete buttons 2021-06-06 14:08:39 -06:00
Matthew Penner 01c03b6b77 Merge branch 'develop' into feature/react-admin 2021-06-06 14:06:14 -06:00
Matthew Penner a45fc525a9 deps(yarn): add 'react-select' 2021-05-22 13:41:17 -06:00
Matthew Penner 8aa9641ec2 ui(admin): too many changes, not enough commits 2021-05-20 16:00:46 -06:00
Matthew Penner bca2338863 ui(admin): add search and sort to ServersContainer 2021-05-18 20:53:42 -06:00
Matthew Penner ae88a01bea fix eslint and admin not loading 2021-05-18 17:20:49 -06:00
Matthew Penner a3b59f24af Merge branch 'develop' into feature/react-admin 2021-05-18 17:07:25 -06:00
Matthew Penner 8a24c1a142 ui(admin): node changes 2021-03-23 17:47:24 -06:00
Matthew Penner 7b38f05019 ui(nests): fix broken pagination 2021-03-23 17:10:30 -06:00
Matthew Penner 984a774811 api(app): add NodeInformationController 2021-03-23 16:08:17 -06:00
Matthew Penner c521d37ddd api(app): more consistent handling of per_page query param 2021-03-23 15:57:29 -06:00
Matthew Penner 49de31bf4c Merge branch 'develop' into feature/react-admin 2021-03-21 15:49:41 -06:00
Matthew Penner 2e046ae258 Merge branch 'develop' into feature/react-admin 2021-03-12 14:13:22 -07:00
Matthew Penner 7e8cb52d88 ui(admin): work on Node editing 2021-03-12 14:12:45 -07:00
Matthew Penner 59e5017fd8 api: fix problem with transformers 2021-03-09 08:14:48 -07:00
Matthew Penner 08546e6076 ui(admin): implement NewDatabaseContainer.tsx 2021-03-06 16:57:13 -07:00
Matthew Penner e9546c70bd ui(admin): add CopyOnClick button to NodeConfigurationContainer 2021-03-06 16:08:42 -07:00
Matthew Penner 5d1568cf84 api(client): fix TwoFactorController 2021-03-06 15:53:45 -07:00
Matthew Penner 5fe86f164e api(client): fix AccountController 2021-03-06 15:49:44 -07:00
Matthew Penner 264c3865b2 api(application): fix api key permissions 2021-03-06 15:41:34 -07:00
Matthew Penner 7d80b5fee7 Merge branch 'develop' into feature/react-admin 2021-03-06 15:37:03 -07:00
Matthew Penner f78aaea6a3 api: cleanup controllers 2021-03-05 10:03:12 -07:00
Matthew Penner 00c42225e8 tests(integration): fix UserControllerTest 2021-03-05 09:18:50 -07:00
Matthew Penner 350ef1aba5 tests(integration): fix database services 2021-03-05 09:15:23 -07:00
Matthew Penner ffdf27e606 tests(integration): fix NestControllerTest, and UserControllerTest 2021-03-05 09:08:07 -07:00
Matthew Penner f6e71e7e76 tests(integration): fix EggControllerTest 2021-03-05 09:04:32 -07:00
Matthew Penner ee5a661e46 tests(integration): fixes EggControllerTest, NestControllerTest, and UserControllerTest 2021-03-05 09:01:29 -07:00
Matthew Penner 542fd61049 db(migrations): fix order of 'change_port_columns_on_nodes_table' migration 2021-03-05 08:52:25 -07:00
Matthew Penner 8c8de6ac62 php-cs fixes 2021-03-05 08:46:14 -07:00
Matthew Penner d57060dad9 Merge branch 'develop' into feature/react-admin 2021-03-05 08:45:39 -07:00
Matthew Penner ffbf7daea6 ui(websocket): bruh... 2021-02-25 15:14:12 -07:00
Matthew Penner ff4a64bfff admin(ui): remove console.logs 2021-02-24 18:29:10 -07:00
Matthew Penner 46759ba967 admin(ui): add node configuration page 2021-02-24 18:28:24 -07:00
Matthew Penner b8788d1af1 Merge branch 'develop' into feature/react-admin 2021-02-24 17:30:18 -07:00
Matthew Penner c053ca7c44 admin(ui): add arrow key support to SearchableSelect 2021-02-17 15:17:37 -07:00
Matthew Penner dc003a6ada admin(ui): SearchableSelect - differentiate between loading and no items 2021-02-16 13:23:24 -07:00
Matthew Penner 224943cc85 admin(ui): autofocus field on New Nest modal open 2021-02-16 13:05:09 -07:00
Matthew Penner 10fc7e88e0 admin(ui): autofocus field on New Role modal open 2021-02-16 13:04:10 -07:00
Matthew Penner 9b08b6b595 admin(ui): fix SearchableSelect, other tweaks 2021-02-16 13:03:14 -07:00
Matthew Penner d43e70c97a admin(ui): autofocus field on New Location modal open 2021-02-16 13:01:55 -07:00
Matthew Penner 93be6db530 admin(ui): fix remaining problems with SearchableSelect.tsx 2021-02-15 22:41:19 -07:00
Matthew Penner 3971c4499d admin(ui): fix up SearchableSelect.tsx 2021-02-15 18:48:10 -07:00
Matthew Penner f790404845 admin(ui): fix updateNode api request 2021-02-11 10:32:13 -07:00
Matthew Penner 3c2094890a admin(ui): use new node port columns 2021-02-11 10:21:49 -07:00
Matthew Penner 5f56ff0fed nodes: rename port columns, add public_ port columns 2021-02-11 10:21:32 -07:00
Matthew Penner b7ee2195d7 Merge branch 'develop' into feature/react-admin 2021-02-11 09:35:21 -07:00
Matthew Penner 60b630354e ui(admin): fix shit 2021-02-07 16:41:32 -07:00
Matthew Penner a87fef37ec Merge branch 'develop' into feature/react-admin 2021-02-07 16:16:22 -07:00
Matthew Penner 8e07bb4bc2 ui(admin): start work on DatabaseSelect.tsx 2021-02-05 09:44:31 -07:00
Matthew Penner 22807f1ff4 ui(admin): tweaks to LocationSelect.tsx 2021-02-05 09:44:16 -07:00
Matthew Penner f3e7aab27c api(application): remove old database node endpoints 2021-02-05 09:43:48 -07:00
Matthew Penner 72be2808f3 deps(node): typescript 3.9.6 => 4.1.3 2021-02-05 09:42:57 -07:00
Matthew Penner 9184cbdf11 ui(admin): tweaks to LocationSelect.tsx 2021-02-02 14:11:54 -07:00
Matthew Penner 7bbe9e8e89 ui(admin): start work on LocationSelect.tsx 2021-01-31 16:48:49 -07:00
Matthew Penner 1c8143ad9d add missing field to Node.php comment 2021-01-30 13:55:13 -07:00
Matthew Penner be1b05e0ec ui(admin): start work on node settings 2021-01-30 13:53:47 -07:00
Matthew Penner 2a0c99163b ui(admin): add SubNavigation 2021-01-30 13:22:16 -07:00
Matthew Penner 2b5cc99abd feat(database-hosts): allow linking of multiple nodes 2021-01-30 12:50:19 -07:00
Matthew Penner 72983e8385 ui: fix duplicate global styles 2021-01-29 09:07:15 -07:00
Matthew Penner 4e1c07d36e Merge branch 'develop' into feature/react-admin 2021-01-29 09:06:55 -07:00
Matthew Penner b856ab17bd Merge branch 'develop' into feature/react-admin 2021-01-27 23:18:06 -07:00
Matthew Penner 31c26a2de4 ui: fix shit 2021-01-27 23:16:58 -07:00
Matthew Penner 18bdde8b81 api(application): fix requests, again 2021-01-24 15:30:58 -07:00
Matthew Penner da3c7fa455 Merge branch 'develop' into feature/react-admin 2021-01-24 15:14:48 -07:00
Matthew Penner eb29f6fc04 Merge branch 'develop' into feature/react-admin 2021-01-23 18:17:38 -07:00
Matthew Penner 5737b5dc5d api(application): fix requests 2021-01-23 18:17:35 -07:00
Matthew Penner 409c081275 Fix factories having wrong namespace 2021-01-23 15:07:58 -07:00
Matthew Penner 8a79589317 Fix factories and seeders having wrong directory name 2021-01-23 15:05:35 -07:00
Matthew Penner f9bb791a7d Merge branch 'develop' into feature/react-admin 2021-01-23 15:05:19 -07:00
Matthew Penner 8feb87de7c Merge branch 'develop' into feature/react-admin 2021-01-23 14:39:23 -07:00
Matthew Penner e01d859b53 db: add User has one AdminRole relation 2021-01-19 18:51:29 -07:00
Matthew Penner 1e61fd161c admin(roles): add has one on User -> AdminRole 2021-01-16 13:24:27 -07:00
Matthew Penner 9d005b5fd2 admin(roles): add 'permissions' column 2021-01-16 13:07:04 -07:00
Matthew Penner 9532ecf867 admin(ui-api): add 'include' parameter to all requests 2021-01-15 09:41:15 -07:00
Matthew Penner e123367f40 db_hosts: add ability to link more than one node 2021-01-15 09:21:07 -07:00
Matthew Penner 79d80e8c22 admin(ui): add radio buttons to MountEditContainer 2021-01-14 18:13:21 -07:00
Matthew Penner 95d3f4c9e0 config: remove legacy file, fix debugbar enabled 2021-01-14 11:25:26 -07:00
Matthew Penner b1c7b91313 cleanup: remove legacy code 2021-01-14 11:13:16 -07:00
Matthew Penner a71392d632 api(application): add endpoints for (de)attaching eggs and nodes on mounts 2021-01-14 11:04:19 -07:00
Matthew Penner 4dab137b51 auth: fix call to renamed method 2021-01-14 10:36:05 -07:00
Matthew Penner e2c8a2fdea routes: cleanup files 2021-01-13 10:03:27 -07:00
Matthew Penner ba41fb5095 api(application): add includes for MountTransformer 2021-01-13 09:53:09 -07:00
Matthew Penner d648ee5c93 admin(ui): add all fields to createServer.ts 2021-01-13 09:43:57 -07:00
Matthew Penner c40e4bd2c0 Merge branch 'develop' into feature/react-admin 2021-01-12 11:47:49 -07:00
Matthew Penner 166221be9b ci: disable integration tests 2021-01-10 12:02:01 -07:00
Matthew Penner 6bb4f6cd01 tests(integration): remove old admin controller test 2021-01-10 11:53:08 -07:00
Matthew Penner 17f8715e41 ci: update to composer v2 2021-01-10 11:52:51 -07:00
Matthew Penner 3b0eb0d8ae ci: bye bye PHP 7.3 2021-01-10 11:49:03 -07:00
Matthew Penner abd33c2384 admin(ui): make database and mount edit pages more responsive 2021-01-10 11:40:30 -07:00
Matthew Penner 52b2463281 admin(ui): fix descriptions overflowing vertically 2021-01-10 11:34:14 -07:00
Matthew Penner 1800800308 admin(ui): add base for mobile-responsive navigation 2021-01-09 13:07:32 -07:00
Matthew Penner ef9bdf5cd5 admin(ui): add ability to delete mounts 2021-01-09 10:42:13 -07:00
Matthew Penner 0c7e787d44 admin(ui): add ability to delete nests 2021-01-09 10:36:40 -07:00
Matthew Penner 9ec6068f45 admin(ui): add ability to delete locations 2021-01-09 10:33:00 -07:00
Matthew Penner a91cb578d7 admin(ui): add ability to delete database hosts 2021-01-09 10:26:30 -07:00
Matthew Penner d323662ad5 admin(ui): implement DatabaseEditContainer.tsx 2021-01-09 09:58:55 -07:00
Matthew Penner 0759ecb1e1 api(application): fix database requests returning 404 2021-01-09 09:38:50 -07:00
Matthew Penner c7d905fece admin(ui): implement LocationEditContainer.tsx 2021-01-09 09:27:58 -07:00
Matthew Penner ee3b8e6432 admin(ui): fix box title on MountEditContainer.tsx 2021-01-08 15:39:20 -07:00
Matthew Penner e70351cbad admin(ui): implement MountEditContainer.tsx, minor tweaks 2021-01-08 15:34:55 -07:00
Matthew Penner 11b7197c49 admin(ui): add mising update requests 2021-01-08 15:18:08 -07:00
Matthew Penner 52ce5e9a57 admin(ui): tweaks to OverviewContainer.tsx 2021-01-08 15:15:02 -07:00
Matthew Penner 93a333e1bb admin(ui): add context and get requests for all edit containers 2021-01-08 15:12:43 -07:00
Matthew Penner e1b33c9346 admin(ui): implement RoleEditContainer.tsx 2021-01-08 15:09:02 -07:00
Matthew Penner 48882e6f2c admin(ui): add EggEditContainer.tsx 2021-01-08 15:07:03 -07:00
Matthew Penner 0d2fbfddc0 admin(ui): make the Nest edit page more responsive 2021-01-08 14:55:34 -07:00
Matthew Penner bbd14c41c8 admin: delete old routes and controllers 2021-01-08 14:55:05 -07:00
Matthew Penner a43ef62435 admin(ui): show eggs in NestEditContainer 2021-01-08 10:48:11 -07:00
Matthew Penner cf006c9d36 admin(ui): show more infomration on NestEditContainer 2021-01-08 10:24:41 -07:00
Matthew Penner 20234b308c admin(ui): add ability to edit nests 2021-01-08 10:02:49 -07:00
Matthew Penner 0e366f69ee api(application): fix 'PATCH' nest endpoint 2021-01-08 09:44:05 -07:00
Matthew Penner 58cfa98b9c api(application): relocate egg endpoints 2021-01-08 09:26:57 -07:00
Matthew Penner 5946210e18 ui: fix ProgressBar being covered by admin sidebar 2021-01-08 08:41:39 -07:00
Matthew Penner 2352ef0369 admin(ui): display dynamic user information on sidebar 2021-01-07 10:21:09 -07:00
Matthew Penner 9eed88b430 admin(ui): actually get avatar for users 2021-01-07 09:55:04 -07:00
Matthew Penner 56c098a316 admin(ui): add document titles 2021-01-07 09:44:24 -07:00
Matthew Penner 946f907b68 admin(ui): show version information 2021-01-07 09:34:20 -07:00
Matthew Penner 12c68961db api(application): add 'version' endpoint 2021-01-07 09:32:04 -07:00
Matthew Penner 545cc3bbd2 Merge branch 'develop' into feature/react-admin 2021-01-06 22:47:06 -07:00
Matthew Penner b45592466e admin(ui): add missing API requests 2021-01-06 16:38:39 -07:00
Matthew Penner 63daa7b14f admin(ui): add blank edit views 2021-01-06 15:50:21 -07:00
Matthew Penner d81aef68b5 admin(ui): add blank 'create' views 2021-01-06 15:39:23 -07:00
Matthew Penner e7021dfc39 ServersContainer: cleanup api code 2021-01-06 09:52:22 -07:00
Matthew Penner b4ec1fb45d NodesContainer: add more fields to table 2021-01-06 09:52:07 -07:00
Matthew Penner a038b0733d RolesContainer: make ID field CopyOnClick 2021-01-06 09:24:24 -07:00
Matthew Penner 96eb232fc0 NestsContainer: make ID field CopyOnClick 2021-01-06 09:24:00 -07:00
Matthew Penner 915666d827 MountsContainer: add source, target, readOnly, and userMountable columns 2021-01-06 09:23:35 -07:00
Matthew Penner 727cf8d753 LocationsContainer: make ID field CopyOnClick 2021-01-06 09:19:08 -07:00
Matthew Penner 231b8b40d6 DatabasesContainer: add more fields to table 2021-01-06 09:17:54 -07:00
Matthew Penner ae6b8cba19 service(NodeJWTService): fix usage of deprecated parameters 2021-01-06 08:54:50 -07:00
Matthew Penner 935f99ab91 dependencies(composer): friendsofphp/php-cs-fixer 2.16.1 => 2.17.3 2021-01-06 08:53:41 -07:00
Matthew Penner 92840d3630 Re-add views/layouts/scripts.blade.php, bump composer.lock 2021-01-05 15:14:17 -07:00
Matthew Penner b95f28fbd9 Remove all old admin views/assets 2021-01-05 14:58:48 -07:00
Matthew Penner 59de9576c9 Add tables for almost every admin change, update composer dependencies 2021-01-05 14:53:52 -07:00
Matthew Penner 8f1a5bf0ab Re-enable debugbar, add table to ServersContainer.tsx 2021-01-05 09:17:44 -07:00
Matthew Penner ed73f6a020 Improvements to UsersContainer.tsx 2021-01-04 12:44:44 -07:00
Matthew Penner 95c55e7d28 Add table to admin/UsersContainer.tsx 2021-01-04 11:50:43 -07:00
Matthew Penner 0ddf806100 Merge branch 'develop' into feature/react-admin 2021-01-03 18:25:36 -07:00
Matthew Penner 5636c25838 Merge branch 'develop' into feature/react-admin 2021-01-03 18:18:06 -07:00
Matthew Penner 0511f75747 Add more application api routes for Nests 2021-01-03 16:45:07 -07:00
Matthew Penner b1d30c1bde Fix RolesContainer, refactor NestsContainer 2021-01-03 16:25:32 -07:00
Matthew Penner ce40194147 Make pagination tabs dynamically update 2021-01-03 12:38:48 -07:00
Matthew Penner 052a6d4ce5 Get basic concept of pagination working on NestsContainer.tsx 2021-01-03 11:34:07 -07:00
Matthew Penner b17bb7c24b Transition RolesContainer.tsx to use table component 2021-01-01 17:03:10 -07:00
Matthew Penner 03474ccfcf Add AdminTable.tsx component 2021-01-01 16:55:06 -07:00
Matthew Penner 04799fa44b Fix checkboxes in NestsContainer.tsx 2021-01-01 16:34:47 -07:00
Matthew Penner f72402b5fa God please forgive me for the sin I have just committed 2021-01-01 16:26:48 -07:00
Matthew Penner 88ac1ce1fd Cleanup code, add basic functionality for Nests 2021-01-01 15:55:30 -07:00
Matthew Penner 6c85be72fa Add nest endpoints and pages 2020-12-31 17:27:16 -07:00
Matthew Penner 359769244f Remove un-needed code from Admin/BaseController.php 2020-12-30 20:19:42 -07:00
Matthew Penner 193086548f Fix create role route 2020-12-30 20:18:56 -07:00
Matthew Penner 9d92053865 Merge branch 'develop' into feature/react-admin 2020-12-30 20:17:59 -07:00
Matthew Penner 9c7b49e2b9 Add proper permissions for role application routes, allow admins to access application api 2020-12-28 12:47:08 -07:00
Matthew Penner b6abeb0994 Tweak styling of logout button 2020-12-28 12:17:11 -07:00
Matthew Penner f67e340d33 Merge branch 'develop' into feature/react-admin 2020-12-28 12:05:19 -07:00
Matthew Penner 318c9f741b Add RoleEditContainer.tsx, fix laravel admin routes 2020-12-28 10:42:34 -07:00
Matthew Penner 0381fe1bd9 Fix 'New Role' model description 2020-12-28 10:09:55 -07:00
Matthew Penner dc0fdee030 Add admin state store, add new role functionality 2020-12-28 10:08:08 -07:00
Matthew Penner 7369167e28 Fix problems after rebase, move RoleController to Api\Application 2020-12-27 22:02:30 -07:00
Matthew Penner 333c9312d4 Force admin get routes to be passed to the react front-end 2020-12-27 22:02:30 -07:00
Matthew Penner 108bf6e3f7 Remove PacksContainer.tsx 2020-12-27 22:02:30 -07:00
Matthew Penner 1cdf9bc18f Lazy load the AdminRouter 2020-12-27 22:02:30 -07:00
Matthew Penner 1f850fac61 Somewhat get a max-width container working 2020-12-27 22:02:30 -07:00
Matthew Penner 19176fb1b6 Get react admin sidebar working while Dane is shopping for domains 2020-12-27 22:02:30 -07:00
Matthew Penner d2f3d8178b Fix Admin/BaseController.php showing the SSR admin area 2020-12-27 22:02:30 -07:00
Matthew Penner 1dff1f1810 Start porting over the admin area to react 2020-12-27 22:02:30 -07:00
Matthew Penner e7aeeace26 tmp 2020-12-27 22:02:30 -07:00
Matthew Penner df6f5c3a09 Update Mounts description, change styling of 'no items found' text on ApiKeysContainer.tsx 2020-12-27 22:02:30 -07:00
Matthew Penner dd0cd5bcb9 Force admin get routes to be passed to the react front-end 2020-12-27 22:02:30 -07:00
Matthew Penner 3cdd348352 Remove PacksContainer.tsx 2020-12-27 22:02:30 -07:00
Matthew Penner e5c30cb6f3 Lazy load the AdminRouter 2020-12-27 22:02:30 -07:00
Matthew Penner 434d204c49 Add 'select-none' everywhere in the admin area 2020-12-27 22:02:30 -07:00
Matthew Penner a1115ff096 Somewhat get a max-width container working 2020-12-27 22:02:30 -07:00
Matthew Penner 6c53738070 Get react admin sidebar working while Dane is shopping for domains 2020-12-27 22:02:30 -07:00
Matthew Penner c22ab762de Fix Admin/BaseController.php showing the SSR admin area 2020-12-27 22:02:29 -07:00
Matthew Penner 9ee3275b11 Start porting over the admin area to react 2020-12-27 22:02:29 -07:00
1388 changed files with 53274 additions and 55406 deletions

View File

@ -1,17 +1,15 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.{md,nix,yml,yaml}]
indent_size = 2
tab_width = 2

14
.env.ci
View File

@ -2,15 +2,14 @@ APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomString3232RandomString
APP_THEME=pterodactyl
APP_TIMEZONE=UTC
APP_TIMEZONE=America/Los_Angeles
APP_URL=http://localhost/
APP_ENVIRONMENT_ONLY=true
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=
DB_CONNECTION=testing
TESTING_DB_HOST=127.0.0.1
TESTING_DB_DATABASE=panel_test
TESTING_DB_USERNAME=root
TESTING_DB_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
@ -18,3 +17,4 @@ MAIL_DRIVER=array
QUEUE_DRIVER=sync
HASHIDS_SALT=test123
APP_ENVIRONMENT_ONLY=true

26
.env.dusk Normal file
View File

@ -0,0 +1,26 @@
APP_ENV=local
APP_DEBUG=false
APP_KEY=NDWgIKKi9ovNK1PXZpzfNVSBdfCXGb5i
APP_JWT_KEY=test1234
APP_TIMEZONE=America/Los_Angeles
APP_URL=http://pterodactyl.local
CACHE_DRIVER=file
SESSION_DRIVER=file
HASHIDS_SALT=IqRr0g82tCTeuyxGs8RV
HASHIDS_LENGTH=8
MAIL_DRIVER=log
MAIL_FROM=support@pterodactyl.io
QUEUE_DRIVER=array
APP_SERVICE_AUTHOR=testing@pterodactyl.io
MAIL_FROM_NAME="Pterodactyl Panel"
RECAPTCHA_ENABLED=false
DB_CONNECTION=testing
TESTING_DB_HOST=192.168.1.202
TESTING_DB_DATABASE=panel_test
TESTING_DB_USERNAME=panel_test
TESTING_DB_PASSWORD=Test1234

View File

@ -2,43 +2,37 @@ APP_ENV=production
APP_DEBUG=false
APP_KEY=
APP_THEME=pterodactyl
APP_TIMEZONE=UTC
APP_URL=http://panel.example.com
APP_LOCALE=en
APP_TIMEZONE=America/New_York
APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
APP_LOCALE=en
APP_URL=http://panel.example.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=panel
DB_USERNAME=pterodactyl
DB_PASSWORD=
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
CACHE_DRIVER=file
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
HASHIDS_SALT=
HASHIDS_LENGTH=8
MAIL_MAILER=smtp
MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@example.com
MAIL_FROM_NAME="Pterodactyl Panel"
MAIL_FROM=no-reply@example.com
MAILGUN_ENDPOINT=api.mailgun.net
# You should set this to your domain to prevent it defaulting to 'localhost', causing
# mail servers such as Gmail to reject your mail.
#
# @see: https://github.com/pterodactyl/panel/pull/3110
# MAIL_EHLO_DOMAIN=panel.example.com
# SERVER_NAME=panel.example.com
QUEUE_HIGH=high
QUEUE_STANDARD=standard
QUEUE_LOW=low

View File

@ -1,51 +0,0 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
tsconfigRootDir: './',
},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
linkComponents: [
{ name: 'Link', linkAttribute: 'to' },
{ name: 'NavLink', linkAttribute: 'to' },
],
},
env: {
browser: true,
es6: true,
},
plugins: ['react', 'react-hooks', 'prettier', '@typescript-eslint'],
extends: [
// 'standard',
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest-dom/recommended',
],
rules: {
eqeqeq: 'error',
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
// TypeScript can infer this significantly better than eslint ever can.
'react/prop-types': 0,
'react/display-name': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 0,
// This setup is required to avoid a spam of errors when running eslint about React being
// used before it is defined.
//
// @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md#how-to-use
'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
},
};

102
.eslintrc.yml Normal file
View File

@ -0,0 +1,102 @@
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 6
ecmaFeatures:
jsx: true
project: "./tsconfig.json"
tsconfigRootDir: "./"
settings:
react:
pragma: "React"
version: "detect"
linkComponents:
- name: Link
linkAttribute: to
- name: NavLink
linkAttribute: to
env:
browser: true
es6: true
plugins:
- "react"
- "react-hooks"
- "@typescript-eslint"
extends:
- "standard"
- "plugin:react/recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:jest-dom/recommended"
rules:
quotes:
- warn
- single
indent:
- warn
- 4
- SwitchCase: 1
semi:
- warn
- always
comma-dangle:
- warn
- always-multiline
spaced-comment: 0
array-bracket-spacing:
- warn
- always
"@typescript-eslint/no-unused-vars":
- warn
- argsIgnorePattern: '^_'
varsIgnorePattern: '^_'
# Remove errors for not having newlines between operands of ternary expressions https://eslint.org/docs/rules/multiline-ternary
multiline-ternary: 0
"react-hooks/rules-of-hooks":
- error
"react-hooks/exhaustive-deps": 0
"@typescript-eslint/explicit-function-return-type": 0
"@typescript-eslint/explicit-member-accessibility": 0
"@typescript-eslint/ban-ts-ignore": 0
"@typescript-eslint/no-explicit-any": 0
"@typescript-eslint/no-non-null-assertion": 0
"@typescript-eslint/ban-ts-comment": 0
# This would be nice to have, but don't want to deal with the warning spam at the moment.
"@typescript-eslint/explicit-module-boundary-types": 0
no-restricted-imports:
- error
- paths:
- name: styled-components
message: Please import from styled-components/macro.
patterns:
- "!styled-components/macro"
# Not sure, this rule just doesn't work right and is protected by our use of Typescript anyways
# so I'm just not going to worry about it.
"react/prop-types": 0
"react/display-name": 0
"react/jsx-indent-props":
- warn
- 4
"react/jsx-boolean-value":
- warn
- never
"react/jsx-closing-bracket-location":
- 1
- "line-aligned"
"react/jsx-closing-tag-location": 1
# This setup is required to avoid a spam of errors when running eslint about React being
# used before it is defined.
#
# see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md#how-to-use
no-use-before-define: 0
"@typescript-eslint/no-use-before-define":
- warn
overrides:
- files:
- "**/*.tsx"
rules:
operator-linebreak:
- error
- before
- overrides:
"&&": "after"
"?": "ignore"
":": "ignore"

3
.github/FUNDING.yml vendored
View File

@ -1 +1,2 @@
github: [matthewpi]
github: [ DaneEveritt ]
custom: [ "https://paypal.me/PterodactylSoftware" ]

View File

@ -68,8 +68,8 @@ body:
Run the following command to collect logs on your system.
Wings: `sudo wings diagnostics`
Panel: `tail -n 150 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc pteropaste.com 99`
placeholder: "https://pteropaste.com/a1h6z"
Panel: `tail -n 100 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc bin.ptdl.co 99`
placeholder: "https://bin.ptdl.co/a1h6z"
render: bash
validations:
required: false

View File

@ -1,4 +1,4 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: Installation Help
url: https://discord.gg/pterodactyl

View File

@ -27,7 +27,7 @@ docker-compose exec panel php artisan p:user:make
## Environment Variables
There are multiple environment variables to configure the panel when not providing your own `.env` file, see the following table for details on each available option.
Note: If your `APP_URL` starts with `https://` you need to provide an `LE_EMAIL` as well so Certificates can be generated.
Note: If your `APP_URL` starts with `https://` you need to provide an `LETSENCRYPT_EMAIL` as well so Certificates can be generated.
| Variable | Description | Required |
| ------------------- | ------------------------------------------------------------------------------ | -------- |

View File

@ -3,7 +3,7 @@ cd /app
mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \
&& chmod 777 /var/log/panel/logs/ \
&& ln -s /app/storage/logs/ /var/log/panel/
&& ln -s /var/log/panel/logs/ /app/storage/logs/
## check for .env file and generate app keys if missing
if [ -f /app/var/.env ]; then

View File

@ -1,35 +0,0 @@
name: Build
on:
push:
branches:
- "develop"
- "1.0-develop"
pull_request:
branches:
- "develop"
- "1.0-develop"
jobs:
ui:
name: UI
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
node-version: [16]
steps:
- name: Code Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build:production

View File

@ -1,72 +0,0 @@
name: Tests
on:
push:
branches:
- "develop"
- "1.0-develop"
pull_request:
branches:
- "develop"
- "1.0-develop"
jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
database: ["mariadb:10.2", "mysql:8"]
services:
database:
image: ${{ matrix.database }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testing
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Code Checkout
uses: actions/checkout@v3
- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
- name: Unit tests
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
if: ${{ always() }}
env:
DB_HOST: UNIT_NO_DB
- name: Integration tests
run: vendor/bin/phpunit tests/Integration
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
DB_USERNAME: root

View File

@ -1,69 +0,0 @@
name: Docker
on:
push:
branches:
- develop
- 1.0-develop
- release/v1.11.5
pull_request:
branches:
- develop
- 1.0-develop
release:
types:
- published
jobs:
push:
name: Push
runs-on: ubuntu-20.04
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Docker metadata
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/nookure/nooktheme
flavor: |
latest=false
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease == false }}
type=ref,event=tag
type=ref,event=branch
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: "github.event_name != 'pull_request'"
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Update version
if: "github.event_name == 'release' && github.event.action == 'published'"
env:
REF: ${{ github.event.release.tag_name }}
run: |
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

49
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Publish Docker Image
on:
push:
branches:
- 'develop'
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Image to GitHub Packages
runs-on: ubuntu-20.04
# Always run against a tag, even if the commit into the tag has [docker skip]
# within the commit message.
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps:
- uses: actions/checkout@v2
- uses: crazy-max/ghaction-docker-meta@v1
id: docker_meta
with:
images: ghcr.io/pterodactyl/panel
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Bump Version
if: "!contains(github.ref, 'develop')"
env:
REF: ${{ github.ref }}
run: |
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
- name: Release Production Build
uses: docker/build-push-action@v2
if: "!contains(github.ref, 'develop')"
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Release Development Build
uses: docker/build-push-action@v2
if: "contains(github.ref, 'develop')"
with:
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

View File

@ -1,36 +0,0 @@
name: Lint
on:
push:
branches:
- "develop"
- "1.0-develop"
pull_request:
branches:
- "develop"
- "1.0-develop"
jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Code Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
- name: PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff

View File

@ -1,30 +1,19 @@
name: Release
name: Create Release
on:
push:
tags:
- "v*"
- 'v*'
jobs:
release:
name: Release
runs-on: ubuntu-20.04
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build:production
node-version: '14'
cache: 'yarn'
- name: Create release branch and bump version
env:
REF: ${{ github.ref }}
@ -36,37 +25,40 @@ jobs:
git push -u origin $BRANCH
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php
git commit -m "ci(release): bump version"
git commit -m "bump version for release"
git push
- name: Build assets
run: |
yarn install
yarn run build:production
- name: Create release archive
run: |
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml
tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.yml .yarnclean
- name: Extract changelog
id: extract_changelog
env:
REF: ${{ github.ref }}
run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
- name: Create checksum and add to changelog
run: |
SUM=`sha256sum panel.tar.gz`
echo -e "\n#### SHA256 Checksum\n\n\`\`\`\n$SUM\n\`\`\`\n" >> ./RELEASE_CHANGELOG
echo $SUM > checksum.txt
- name: Create release
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
- name: Upload release archive
draft: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
- name: Upload binary
id: upload-release-archive
uses: actions/upload-release-asset@v1
env:
@ -76,8 +68,7 @@ jobs:
asset_path: panel.tar.gz
asset_name: panel.tar.gz
asset_content_type: application/gzip
- name: Upload release checksum
- name: Upload checksum
id: upload-release-checksum
uses: actions/upload-release-asset@v1
env:

64
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: Run Tests
on:
push:
branches:
- 'develop'
- 'v2'
pull_request:
jobs:
tests:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
php: [ 8.1 ]
database: [ 'mariadb:10.6', 'mysql:8' ]
services:
database:
image: ${{ matrix.database }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: panel_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
name: "php-${{ matrix.php }} (${{ matrix.database }})"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- name: Configure .env
run: cp .env.ci .env
- name: composer install
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run cs-fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=txt --config .php-cs-fixer.dist.php
- name: Static Analysis
if: ${{ matrix.php }} == '8.0'
run: |
php artisan ide-helper:models -N
./vendor/bin/phpstan analyse --memory-limit=2G
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
- name: Execute Tests
run: php artisan test
env:
DB_PORT: ${{ job.services.database.ports[3306] }}

108
.gitignore vendored
View File

@ -1,37 +1,85 @@
/vendor
*.DS_Store*
!.env.ci
!.env.example
.env*
.vagrant/*
.vscode/*
storage/framework/*
/.idea
/nbproject
/.direnv
#------------------#
# IDEs and Editors #
#------------------#
node_modules
*.log
# Jetbrains
/.idea
*.iml
*.ipr
*.iws
# Visual Studio Code
/.vscode
# Sublime Text
*.sublime-*
#-------------------#
# Tools #
#-------------------#
# Vagrant
/.vagrant
#-------------------#
# Languages #
#-------------------#
# Node.js
/.npm
/node_modules
npm-debug.log
.cache
.eslintcache
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
.yarn-integrity
yarn-debug.log
yarn-error.log
# PHP
/vendor
.php-cs-fixer.cache
.phpunit.result.cache
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
.yarn
public/assets/manifest.json
# For local development with docker
# Remove if we ever put the Dockerfile in the repo
.dockerignore
docker-compose.yml
#-------------------#
# Operating Systems #
#-------------------#
# for image related files
misc
.php-cs-fixer.cache
coverage.xml
resources/lang/locales.js
.phpunit.result.cache
# External Drives
.Spotlight-V100
.Trashes
/public/build
/public/hot
result
docker-compose.yaml
release
# Linux
*~
# Mac OS
/.DS_Store
*.DS_Store
# VIM
.*.sw[a-p]
#-------------------#
# Project Files #
#-------------------#
# Environment Files
!.env.ci
!.env.dusk
!.env.example
.env*
*.log
_ide_helper_models.php
_ide_helper.php
.phpstorm.meta.php

View File

@ -10,6 +10,9 @@ $finder = (new Finder())
'node_modules',
'storage',
'bootstrap/cache',
'.phpstorm.meta.php',
'_ide_helper.php',
'_ide_helper_models.php',
])
->notName(['_ide_helper*']);

View File

@ -1,9 +0,0 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"endOfLine": "lf"
}

785
.yarn/releases/yarn-3.2.0.cjs vendored Executable file

File diff suppressed because one or more lines are too long

6
.yarnrc.yml Normal file
View File

@ -0,0 +1,6 @@
nodeLinker: node-modules
pnpIgnorePatterns:
- ./public/**/*
yarnPath: .yarn/releases/yarn-3.2.0.cjs

View File

@ -3,308 +3,6 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## v1.11.7
### Added
* Java 21 to Minecraft eggs
### Changed
* Updated Minecraft EULA link
### Fixed
* Fixed backups not ever being marked as completed (#5088)
* Fixed `.7z` files not being detected as a compressed file (#5016)
## v1.11.6
### Changed
* Better node ownership checks for internal backup endpoints
* Improved validation rules on `docker_image` fields to prevent invalid inputs
### Fixed
* Multiple XSS vulnerabilities in the admin area ([GHSA-384w-wffr-x63q](https://github.com/pterodactyl/panel/security/advisories/GHSA-384w-wffr-x63q))
## v1.11.5
### Fixed
* Rust egg using the wrong Docker image, breaking Rust modding frameworks.
## v1.11.4
### Added
* Added support for the `server.queryport` option on the Rust egg.
* Added support for the Carbon modding framework to the Rust egg.
### Changed
* Upgraded to Laravel 10.
* Sensitive data is no longer shown in the CopyOnClick toast notification.
### Fixed
* Allow SVGs to be edited in the server's file manager.
* Properly validate the request body when creating a backup.
* Fixed issue with schedules running at the wrong time when the panel utilized a timezone with non-hour offsets (such as `Australia/Darwin`).
* Fixes the log directory when running the Panel in a container.
* Fixes the permission name used to check if a user has permission to read files/folders.
* Fixes the ability to unset a server's description through the client API.
* Fixed the MassActionBar on the server's file manager blocking elements below it, preventing them from being interacted with.
## v1.11.3
### Changed
* When updating a server's description through the client API, if no value is specified, the description will now remain unchanged.
* When installing the Panel for the first time, the queue driver will now all default to `redis` instead of `sync`.
### Fixed
* `php artisan p:environment:mail` not correctly setting the right variable for `MAIL_FROM_ADDRESS`.
* Fixed the conflict state rendering on the UI for a server showing `reinstall_failed` as `restoring_backup`.
* Fixed the unknown column `uuid` error when jobs fail, causing them not to get stored correctly.
* Fixed the server task endpoints in the client API not allowing `sequence_id` and `continue_on_failure` to be set.
## v1.11.2
### Changed
* Telemetry no longer sends a map of Egg and Nest UUIDs to the number of servers using them.
* Increased the timeout for the decompress files endpoint in the client API from 15 seconds to 15 minutes.
### Fixed
* Fixed Panel Docker image having a `v` prefix in the version displayed in the admin area.
* Fixed emails using the wrong queue name, causing them to not be sent.
* Fixed the settings keys used for configuring SMTP settings, causing settings to not save properly.
* Fixed the `MAIL_EHLO_DOMAIN` environment variable not being properly backwards compatible with the old `SERVER_NAME` variable.
## v1.11.1
### Fixed
* Fixed Panel Docker image showing `canary` as it's version.
## v1.11.0
### Changed (since 1.10.4)
* Changed minimum PHP version requirement from `7.4` to `8.0`.
* Upgraded from Laravel 8 to Laravel 9.
* This release requires Wings v1.11.x in order for Server Transfers to work.
* `MB` byte suffixes are now displayed as `MiB` to more accurately reflect the actual value.
* Server re-installation failures are tracked independently of the initial installation process.
### Fixed (since 1.10.4)
* Node maintenance mode now properly blocks access to servers.
* Fixed the length validation on the Minecraft Forge egg.
* Fixed the password in the JDBC string not being properly URL encoded.
* Fixed an issue where Wings would throw a validation error while attempting to upload activity logs.
* Properly handle a missing `Content-Length` header in the response from the daemon.
* Ensure activity log properties are always returned as an object instead of an empty array.
### Added (since 1.10.4)
* Added the `server:settings.description` activity log event for when a server description is changed.
* Added the ability to cancel file uploads in the file manager for a server.
* Added a telemetry service to collect anonymous metrics from the panel, this feature is *enabled* by default and can be toggled using the `PTERODACTYL_TELEMETRY_ENABLED` environment variable.
## v1.11.0-rc.2
### Changed
* `MB` byte suffixes are now displayed as `MiB` to more accurately reflect the actual value.
* Server re-installation failures are tracked independently of the initial installation process.
### Fixed
* Properly handle a missing `Content-Length` header in the response from the daemon.
* Ensure activity log properties are always returned as an object instead of an empty array.
### Added
* Added the `server:settings.description` activity log event for when a server description is changed.
* Added the ability to cancel file uploads in the file manager for a server.
* Added a telemetry service to collect anonymous metrics from the panel, this feature is disabled by default and can be toggled using the `PTERODACTYL_TELEMETRY_ENABLED` environment variable.
## v1.11.0-rc.1
### Changed
* Changed minimum PHP version requirement from `7.4` to `8.0`.
* Upgraded from Laravel 8 to Laravel 9.
* This release requires Wings v1.11.x in order for Server Transfers to work.
### Fixed
* Node maintenance mode now properly blocks access to servers.
* Fixed the length validation on the Minecraft Forge egg.
* Fixed the password in the JDBC string not being properly URL encoded.
* Fixed an issue where Wings would throw a validation error while attempting to upload activity logs.
## v1.10.4
### Fixed
* Fixed an issue where subusers could be given permissions that are not actually registered or used.
* Fixed an issue where node FQDNs could not just be IP addresses.
### Changed
* Change maximum number of API keys per user from `10` to `25`.
* Change byte unit prefix from `B` to `iB` to better reflect our usage of base 2 (multiples of 1024).
## v1.10.3
### Fixed
* S3 Backup driver now supports Cloudflare R2.
* Node FQDNs can now be used with AAAA records with no A records present.
* Server transfers can no longer be initiated if the server is being installed, transferred, or restoring a backup.
* Fixed an issue relating to the use of arrays in the `config_files` field with eggs.
* Fixed `oom_disabled` not being mapped in the Application API when creating a new server.
### Added
* File manager now supports selecting multiple files for upload (when using the upload button).
* Added a configuration option for specifying the S3 storage class for backups.
### Changed
* Servers will now show the current uptime when the server is starting rather than only showing when the server is marked as online.
## v1.10.2
### Fixed
* Fixes a rendering issue with egg descriptions in the admin area
* Fixes the page title on the SSH Keys page
### Changed
* Additional validation rules will now show a toggle switch rather than an input when editing server variables
* The eggs endpoint will now always return an empty JSON object for the `config_files` field, even if the field is completely empty
### Added
* Adds a `Force Outgoing IP` option for eggs that can be used to ensure servers making outgoing connections use their allocation IP rather than the node's primary ip
* Adds options to configure sending of email (re)install notifications
* Add an option to configure the part size for backups uploaded to S3
## v1.10.1
### Fixed
* Fixes a surprise `clock()` function that was used for debugging and should not have made it into the release. This was causing activity events to not properly sync between the Panel and Wings.
## v1.10.0
### Fixed
* Fixes improper cache key naming on the frontend causing server activity logs to be duplicated across server page views.
* Fixes overflow issues on dialogs when the internal content is too long.
* Fixes spinner overlay on console improperly taking up the entire page making it impossible to use navigation controls.
* Fixes 2FA QR code background being too dark for some phones to properly scan.
* File manager now properly displays an error message if a user attempts to upload a folder rather than files.
* Fixes the "Create Directory" dialog persisting the previously entered value when it is re-opened.
### Changed
* IP addresses in activity logs are now always displayed to administrators, regardless of if they own the server or not.
* Scroll down indicator on the console has been changed to a down arrow to be clearer.
* Docker builds have been updated to use `PHP 8.1`.
* Recaptcha validation domain is now configurable using the `RECAPTCHA_DOMAIN` environment variable.
* Drag and drop overlay on the file manager has been tweaked to be slightly more consistent with the frontend style and be a little easier to read.
### Added
* Adds support for the `user_uuid` claim on all generated JWTs which allows Wings to properly identify the user performing each action.
* Adds support for recieving external activity log events from Wings instances (power state, commands, SFTP, and uploads).
* Adds support for tracking failed password-based SFTP logins.
* Server name and description are now passed along to Wings making them available in egg variables for parsing and including.
* Adds support for displaying all active file uploads in the file manager.
## v1.9.2
### Fixed
* Fixes rouding in sidebar of CPU usage graph that was causing an excessive number of zeros to be rendered.
* Fixes the Java Version selector modal having the wrong default value selected initially.
* Fixes console rendering in Safari that was causing the console to resize excessively and graphs to overlay content.
* Fixes missing "Starting"/"Stopping" status display in the server uptime block.
* Fixes incorrect formatting of activity log when viewing certain file actions.
### Changed
* Updated the UI for the two-step authorization setup on accounts to use new Dialog UI and provide better clarity to new users.
### Added
* Added missing `<DOCTYPE html>` tag to template output to avoid entering quirks mode in browsers.
* Added password requirement when enabling TOTP on an account.
## v1.9.1
### Fixed
* Fixes missing "Click to Copy" for server address on the console data blocks.
* Fixes data points on the graphs not being properly rounded to two decimal places.
* Returns byte formatting logic to use `1024` as the base value, rather than `1000`.
* Fixes permission error occurring when a server is marked as installing and an admin navigates to the console screen.
* Fixes improper display of install/transfer warning on the server console page.
* Fixes permission matching for the server settings page to correctly allow access when a user has _any_ of the needed permissions.
### Changed
* Moves the server data blocks to the right-hand side of the console, rather than the left.
* Rather than defaulting graph values at `0` when resetting or refreshing the page, their values are now hidden entirely.
* **[security]** Hides IP addresses from all activity log entries that are not directly associated with the currently signed in user.
### Added
* Adds the current resource limits for a server next to each data block on the console screen.
## v1.9.0
### Added
* Added support for using Tailwind classes inside components using `className={}` rather than having to use `twin.macro` with the `css={}` prop.
* Added HeadlessUI and Heroicons packages.
* Added new `Tooltip.tsx` component to support displaying tooltips within the Panel.
* Adds a new activity log view for both user accounts and individual servers. This builds upon data collected in previous releases.
* Added a new column `api_key_id` to the `activity_logs` table to indicate if the user performed the action while using an API key.
* Adds initial support for language translations on the front-end. The underlying implementation details are working, however work has not yet begun on actually translating all of the strings yet. Expect this to continue in future releases.
* Improved accessibility for navigation icons by adding a tooltip on hover to indicate what each one does.
* Adds logging for API keys that are blocked from performing an API action due to IP address limiting.
* Adds support for `?filter[description]=foo` when querying servers on both the client and application API.
### Changed
* Updated how release assets are generated to perform more logical bundle splitting. This should help reduce the amount of data users have to download at once in order to render the UI.
* Upgraded From TailwindCSS 2 to 3 — for most people this should have minimal if any impact.
* Chart.js updated from v2 to v3.
* Reduced the number of custom colors in use — by default we now use Tailwind's default color pallet, with the exception of a custom gray scheme.
* **[deprecated]** The use of `neutral` and `primary` have been deprecated in class names, prefer `gray` and `blue` respectively.
* Begins the process of dropping the use of Gravatars for user avatars and replaces them with dynamically generated SVG images.
* Improved front-end route definitions to make it easier for external modifications to inject their routes and components into the codebase without having to modify as many core files.
* Redesigned the server console screen to better display data users might be looking for, and increase the height of the console itself.
* Merged the two network data graphs into a single dual-line graph to better display incoming and outgoing data volumes.
* Updated all byte formatting logic to use `1000` as the divisor rather than `1024` to be more consistent with what users most likely expect.
* Changed the underlying `eslint` rules applied to the front-end codebase to simplify them dramatically. We now utilize `prettier` in combination with some basic default rulesets to make it easier to understand the expected formatting.
### Fixed
* Fixes a bug causing a 404 error when attempting to delete a database from a server in the admin control panel.
* Fixes console input auto-capitalizing and auto-correcting when entering text on some mobile devices.
* Fixes SES service configuration using a hard-coded `us-east-1` region.
* Fixes a bug causing a 404 error when attempting to delete an SSH key from your account when the SHA256 hash includes a slash.
* Fixes mobile keyboards automatically attempting to capitalize and spellcheck typing on the server console.
* Fixes improper support for IP address CIDR ranges when creating API keys for the client area.
* Fixes a bug preventing additional included details from being returned from the application API when utilizing a client API key as an administrator.
## v1.8.1
### Fixed
* Fixes a bug causing mounts to return a 404 error when adding them to a server.
* Fixes a bug causing the Egg Image dropdown to not display properly when creating a new server.
* Fixes a bug causing an error when attemping to create a new server via the API.
## v1.8.0
**Important:** this version updates the `version` field on generated Eggs to be `PTDL_v2` due to formatting changes. This
should be completely seamless for most installations as the Panel is able to convert between the two. Custom solutions
using these eggs should be updated to account for the new format.
This release also changes API key behavior — "client" keys belonging to admin users can now be used to access
the `/api/application` endpoints in their entirety. Existing "application" keys generated in the admin area should
be considered deprecated, but will continue to work. Application keys _will not_ work with the client API.
### Fixed
* Schedules are no longer run when a server is suspended or marked as installing.
* The remote field when creating a database is no longer limited to an IP address and `%` wildcard — all expected MySQL remote host values are allowed.
* Allocations cannot be deleted from a server by a user if the server is configured with an `allocation_limit` set to `0`.
* The Java Version modal no longer shows a dropdown and update option to users that do not have permission to make those changes.
* The Java Version modal now correctly returns only the images available to the server's selected Egg.
* Fixes leading and trailing spaces being removed from variable values on file manager endpoints, causing errors when trying to perform actions against certain files and folders.
### Changed
* Forces HTTPS on URLs when the `APP_URL` value is set and includes `https://` within the URL. This addresses proxy misconfiguration issues that would cause URLs to be generated incorrectly.
* Lowers the default timeout values for requests to Wings instances from 10 seconds to 5 seconds.
* Additional permissions (`CREATE TEMPORARY TABLES`, `CREATE VIEW`, `SHOW VIEW`, `EVENT`, and `TRIGGER`) are granted to users when creating new databases for servers.
* development: removed Laravel Debugbar in favor of Clockwork for debugging.
* The 2FA input field when logging in is now correctly identified as `one-time-password` to help browser autofill capabilities.
* Changed API authentication mechanisms to make use of Laravel Sanctum to significantly clean up our internal handling of sessions.
* API keys generated by the system now set a prefix to identify them as Pterodactyl API keys, and if they are client or application keys. This prefix looks like `ptlc_` for client keys, and `ptla_` for application keys. Existing API keys are unaffected by this change.
### Added
* Added support for PHP 8.1 in addition to PHP 8.0 and 7.4.
* Adds more support for catching potential PID exhaustion errors in different games.
* It is now possible to create a new node on the Panel using an artisan command.
* A new cron cheatsheet has been added which appears when creating a schedule.
* Adds support for filtering the `/api/application/nodes/:id/allocations` endpoint using `?filter[server_id]=0` to only return allocations that are not currently assigned to a server on that node.
* Adds support for naming docker image values in an Egg to improve front-end display capabilities.
* Adds command to return the configuration for a specific node in both YAML and JSON format (`php artisan p:node:configuration`).
* Adds command to return a list of all nodes available on the Panel in both table and JSON format (`php artisan p:node:list`).
* Adds server network (inbound/outbound) usage graphs to the console screen.
* Adds support for configuring CORS on the API by setting the `APP_CORS_ALLOWED_ORIGINS=example.com,dashboard.example.com` environment variable. By default all instances are configured with this set to `*` which allows any origin.
* Adds proper activity logging for the following areas of the Panel: authentication, user account modifications, server modification. This is an initial test implementation before further roll-out in the software. Events are logged into the database but are not currently exposed in the UI — they will be displayed in a future update.
### Removed
* Removes Google Analytics from the front end code.
* Removes multiple middleware that were previously used for configuring API access and controlling model fetching. This has all been replaced with Laravel Sanctum and standard Laravel API tooling. This should make codebase discovery significantly more simple.
* **DEPRECATED**: The use of `Pterodactyl\Models\AuditLog` is deprecated and all references to this model have been removed from the codebase. In the next major release this model and table will be fully dropped.
## v1.7.0
### Fixed
* Fixes typo in message shown to user when deleting a database.

View File

@ -1,31 +1,27 @@
# Contributing
Pterodactyl does not accept Pull Requests (PRs) _for new functionality_ from users that are not currently part of the
core project team. It has become overwhelming to try and give the proper time and attention that such complicated PRs
tend to require — and deserve. As a result, it is in the project's best interest to limit the scope of work on
new functionality to work done within the core project team.
PRs that address existing _bugs_ with a corresponding issue opened in our issue tracker will continue to be accepted
and reviewed. Their scope is often significantly more targeted, and simply improving upon existing and well defined
and reviewed. Their scope is often signficantly more targeted, and simply improving upon existing and well defined
logic.
### Responsible Disclosure
This is a fairly in-depth project and makes use of a lot of parts. We strive to keep everything as secure as possible
and welcome you to take a look at the code provided in this project yourself. We do ask that you be considerate of
others who are using the software and not publicly disclose security issues without contacting us first by email.
We'll make a deal with you: if you contact us by email, and we fail to respond to you within a week you are welcome to
We'll make a deal with you: if you contact us by email and we fail to respond to you within a week you are welcome to
publicly disclose whatever issue you have found. We understand how frustrating it is when you find something big and
no one will respond to you. This holds us to a standard of providing prompt attention to any issues that arise and
keeping this community safe.
If you've found what you believe is a security issue please email `matthew@pterodactyl.io`. Please check
[SECURITY.md](/SECURITY.md) for additional details.
If you've found what you believe is a security issue please email `dane åt pterodactyl døt io`.
### Contact Us
You can find us in a couple places online. First and foremost, we're active right here on GitHub. If you encounter a
You can find us in a couple places online. First and foremost, we're active right here on Github. If you encounter a
bug or other problems, open an issue on here for us to take a look at it. We also accept feature requests here as well.
You can also find us on [Discord](https://discord.gg/pterodactyl).

View File

@ -10,7 +10,7 @@ RUN yarn install --frozen-lockfile \
# Stage 1:
# Build the actual container with all of the needed PHP dependencies that will run the application.
FROM --platform=$TARGETOS/$TARGETARCH php:8.1-fpm-alpine
FROM --platform=$TARGETOS/$TARGETARCH php:7.4-fpm-alpine
WORKDIR /app
COPY . ./
COPY --from=0 /app/public/assets ./public/assets
@ -23,7 +23,6 @@ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar un
&& chmod 777 -R bootstrap storage \
&& composer install --no-dev --optimize-autoloader \
&& rm -rf .env bootstrap/cache/*.php \
&& mkdir -p /app/storage/logs/ \
&& chown -R nginx:nginx .
RUN rm /usr/local/etc/php-fpm.conf \

View File

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

186
README.md
View File

@ -1,135 +1,79 @@
# Nook Theme
NookTheme is a free and open source [Pterodactyl theme](https://pterodactyl.io) designed to be simple, clean, and modern.
[![Logo Image](https://cdn.pterodactyl.io/logos/new/pterodactyl_logo.png)](https://pterodactyl.io)
![Image](https://i.imgur.com/AFjHGBr.png)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pterodactyl/panel/tests?label=Tests&style=for-the-badge)
![Discord](https://img.shields.io/discord/122900397965705216?label=Discord&logo=Discord&logoColor=white&style=for-the-badge)
![GitHub Releases](https://img.shields.io/github/downloads/pterodactyl/panel/latest/total?style=for-the-badge)
![GitHub contributors](https://img.shields.io/github/contributors/pterodactyl/panel?style=for-the-badge)
<details>
<summary>View Screnshots</summary>
# Pterodactyl Panel
Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security
in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive
UI to end users.
![Image](https://i.imgur.com/CNxF3iT.png)
![Image](https://i.imgur.com/IflRtEX.png)
![Image](https://i.imgur.com/vNLK5jP.png)
![Image](https://i.imgur.com/dnxV2CS.png)
</details>
Stop settling for less. Make game servers a first class citizen on your platform.
## Installation
This will update your panel to the latest version of NookTheme panel is based. <br>
You can see the version in the current branch name.
### Enter Maintenance Mode
Whenever you are performing an update you should be sure to place your Panel into maintenance mode. This will prevent
users from encountering unexpected errors and ensure everything can be updated before users encounter
potentially new features.
```bash
cd /var/www/pterodactyl
php artisan down
```
### Download the theme
The first step in the update process is to download the new panel files from GitHub. The command below will download
the release archive for the most recent version of Pterodactyl, save it in the current directory and will automatically
unpack the archive into your current folder.
```bash
curl -L https://github.com/Nookure/NookTheme/releases/latest/download/panel.tar.gz | tar -xzv
```
Once all of the files are downloaded we need to set the correct permissions on the cache and storage directories to avoid
any webserver related errors.
```bash
chmod -R 755 storage/* bootstrap/cache
```
### Update Dependencies
After you've downloaded all of the new files you will need to upgrade the core components of the panel. To do this,
simply run the commands below and follow any prompts.
```bash
composer install --no-dev --optimize-autoloader
```
### Clear Compiled Template Cache
You'll also want to clear the compiled template cache to ensure that new and modified templates show up correctly for
users.
```bash
php artisan view:clear
php artisan config:clear
```
### Database Updates
You'll also need to update your database schema for the newest version of Pterodactyl. Running the command below
will update the schema and ensure the default eggs we ship are up to date (and add any new ones we might have). Just
remember, _never edit core eggs we ship_! They will be overwritten by this update process.
```bash
php artisan migrate --seed --force
```
### Set Permissions
The last step is to set the proper owner of the files to be the user that runs your webserver. In most cases this
is `www-data` but can vary from system to system &mdash; sometimes being `nginx`, `caddy`, `apache`, or even `nobody`.
```bash
# If using NGINX or Apache (not on CentOS):
chown -R www-data:www-data /var/www/pterodactyl/*
# If using NGINX on CentOS:
chown -R nginx:nginx /var/www/pterodactyl/*
# If using Apache on CentOS
chown -R apache:apache /var/www/pterodactyl/*
```
### Restarting Queue Workers
After _every_ update you should restart the queue worker to ensure that the new code is loaded in and used.
```bash
php artisan queue:restart
```
### Exit Maintenance Mode
Now that everything has been updated you need to exit maintenance mode so that the Panel can resume accepting
connections.
```bash
php artisan up
```
![Image](https://cdn.pterodactyl.io/site-assets/pterodactyl_v1_demo.gif)
## Documentation
* [Panel Documentation](https://pterodactyl.io/panel/1.0/getting_started.html)
* [Wings Documentation](https://pterodactyl.io/wings/1.0/installing.html)
* [Community Guides](https://pterodactyl.io/community/about.html)
* Or, get additional help [via Discord](https://discord.nookure.com/)
* Or, get additional help [via Discord](https://discord.gg/pterodactyl)
## Star History
## Sponsors
I would like to extend my sincere thanks to the following sponsors for helping fund Pterodactyl's developement.
[Interested in becoming a sponsor?](https://github.com/sponsors/DaneEveritt)
<a href="https://star-history.com/#Nookure/NookTheme&Timeline">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
</picture>
</a>
| Company | About |
| ------- | ----- |
| [**WISP**](https://wisp.gg) | Extra features. |
| [**MixmlHosting**](https://mixmlhosting.com) | MixmlHosting provides high quality Virtual Private Servers along with game servers, all at a affordable price. |
| [**BisectHosting**](https://www.bisecthosting.com/) | BisectHosting provides Minecraft, Valheim and other server hosting services with the highest reliability and lightning fast support since 2012. |
| [**Bloom.host**](https://bloom.host) | Bloom.host offers dedicated core VPS and Minecraft hosting with Ryzen 9 processors. With owned-hardware, we offer truly unbeatable prices on high-performance hosting. |
| [**MineStrator**](https://minestrator.com/) | Looking for a French highend hosting company for you minecraft server? More than 14,000 members on our discord, trust us. |
| [**DedicatedMC**](https://dedicatedmc.io/) | DedicatedMC provides Raw Power hosting at affordable pricing, making sure to never compromise on your performance and giving you the best performance money can buy. |
| [**Skynode**](https://www.skynode.pro/) | Skynode provides blazing fast game servers along with a top-notch user experience. Whatever our clients are looking for, we're able to provide it! |
| [**XCORE**](https://xcore-server.de/) | XCORE offers High-End Servers for hosting and gaming since 2012. Fast, excellent and well-known for eSports Gaming. |
| [**RoyaleHosting**](https://royalehosting.net/) | Build your dreams and deploy them with RoyaleHostings reliable servers and network. Easy to use, provisioned in a couple of minutes. |
| [**Spill Hosting**](https://spillhosting.no/) | Spill Hosting is a Norwegian hosting service, which aims for inexpensive services on quality servers. Premium i9-9900K processors will run your game like a dream. |
| [**DeinServerHost**](https://deinserverhost.de/) | DeinServerHost offers Dedicated, vps and Gameservers for many popular Games like Minecraft and Rust in Germany since 2013. |
| [**HostBend**](https://hostbend.com/) | HostBend offers a variety of solutions for developers, students, and others who have a tight budget but don't want to compromise quality and support. |
| [**Capitol Hosting Solutions**](https://chs.gg/) | CHS is *the* budget friendly hosting company for Australian and American gamers, offering a variety of plans from Web Hosting to Game Servers; Custom Solutions too! |
| [**ByteAnia**](https://byteania.com/?utm_source=pterodactyl) | ByteAnia offers the best performing and most affordable **Ryzen 5000 Series hosting** on the market for *unbeatable prices*! |
| [**Aussie Server Hosts**](https://aussieserverhosts.com/) | No frills Australian Owned and operated High Performance Server hosting for some of the most demanding games serving Australia and New Zealand. |
| [**VibeGAMES**](https://vibegames.net/) | VibeGAMES is a game server provider that specializes in DDOS protection for the games we offer. We have multiple locations in the US, Brazil, France, Germany, Singapore, Australia and South Africa.|
| [**RocketNode**](https://rocketnode.net) | RocketNode is a VPS and Game Server provider that offers the best performing VPS and Game hosting Solutions at affordable prices! |
| [**HostEZ**](https://hostez.io) | Providing North America Valheim, Minecraft and other popular games with low latency, high uptime and maximum availability. EZ! |
### Supported Games
Pterodactyl supports a wide variety of games by utilizing Docker containers to isolate each instance. This gives
you the power to run game servers without bloating machines with a host of additional dependencies.
Some of our core supported games include:
* Minecraft — including Paper, Sponge, Bungeecord, Waterfall, and more
* Rust
* Terraria
* Teamspeak
* Mumble
* Team Fortress 2
* Counter Strike: Global Offensive
* Garry's Mod
* ARK: Survival Evolved
In addition to our standard nest of supported games, our community is constantly pushing the limits of this software
and there are plenty more games available provided by the community. Some of these games include:
* Factorio
* San Andreas: MP
* Pocketmine MP
* Squad
* Xonotic
* Starmade
* Discord ATLBot, and most other Node.js/Python discord bots
* [and many more...](https://github.com/parkervcp/eggs)
## License
Pterodactyl® Copyright © 2015 - 2022 Dane Everitt and contributors.
Pterodactyl® Copyright © 2015 - 2023 Dane Everitt and contributors.
> Nookure is not affiliated with Pterodactyl® Panel or its contributors.
Pterodactyl code released under the [MIT License](./LICENSE.md).
NookTheme code edits released under the [GNU GPLv3 License](./NookLicense.md).
Code released under the [MIT License](./LICENSE.md).

View File

@ -1,18 +1,17 @@
# Security Policy
## Supported Versions
The following versions of Pterodactyl are receiving active support and maintenance. Any security vulnerabilities discovered must be reproducible in supported versions.
| Panel | Daemon | Supported |
|--------|--------------|--------------------|
| 1.11.x | wings@1.11.x | :white_check_mark: |
| ----- | ------------ | ------------------ |
| 1.7.x | wings@1.5.x | :white_check_mark: |
| 0.7.x | daemon@0.6.x | :x: |
## Reporting a Vulnerability
Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can email `matthew@pterodactyl.io`.
Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can send an email to `dane@pterodactyl.io`.
We make every effort to respond as soon as possible, although it may take a day or two for us to sync internally and determine the severity of the report and its impact. Please, _do not_ use a public facing channel or GitHub issues to report sensitive security issues.

View File

@ -1,22 +1,32 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\Environment;
use DateTimeZone;
use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Validation\Factory as ValidatorFactory;
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class AppSettingsCommand extends Command
{
use EnvironmentWriterTrait;
public const CACHE_DRIVERS = [
public const ALLOWED_CACHE_DRIVERS = [
'redis' => 'Redis (recommended)',
'memcached' => 'Memcached',
'file' => 'Filesystem',
];
public const SESSION_DRIVERS = [
public const ALLOWED_SESSION_DRIVERS = [
'redis' => 'Redis (recommended)',
'memcached' => 'Memcached',
'database' => 'MySQL Database',
@ -24,14 +34,35 @@ class AppSettingsCommand extends Command
'cookie' => 'Cookie',
];
public const QUEUE_DRIVERS = [
public const ALLOWED_QUEUE_DRIVERS = [
'redis' => 'Redis (recommended)',
'database' => 'MySQL Database',
'sync' => 'Sync',
];
/**
* @var \Illuminate\Contracts\Console\Kernel
*/
protected $command;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var \Illuminate\Validation\Factory
*/
protected $validator;
/**
* @var string
*/
protected $description = 'Configure basic environment settings for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:setup
{--new-salt : Whether or not to generate a new salt for Hashids.}
{--author= : The email that services created on this instance should be linked to.}
@ -43,17 +74,23 @@ class AppSettingsCommand extends Command
{--redis-host= : Redis host to use for connections.}
{--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.}
{--settings-ui= : Enable or disable the settings UI.}
{--telemetry= : Enable or disable anonymous telemetry.}';
{--settings-ui= : Enable or disable the settings UI.}';
protected array $variables = [];
/**
* @var array
*/
protected $variables = [];
/**
* AppSettingsCommand constructor.
*/
public function __construct(private Kernel $console)
public function __construct(ConfigRepository $config, Kernel $command, ValidatorFactory $validator)
{
parent::__construct();
$this->config = $config;
$this->command = $command;
$this->validator = $validator;
}
/**
@ -61,81 +98,80 @@ class AppSettingsCommand extends Command
*
* @throws \Pterodactyl\Exceptions\PterodactylException
*/
public function handle(): int
public function handle()
{
if (empty(config('hashids.salt')) || $this->option('new-salt')) {
if (empty($this->config->get('hashids.salt')) || $this->option('new-salt')) {
$this->variables['HASHIDS_SALT'] = str_random(20);
}
$this->output->comment('Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.');
$this->output->comment(trans('command/messages.environment.app.author_help'));
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
'Egg Author Email',
config('pterodactyl.service.author', 'unknown@unknown.com')
trans('command/messages.environment.app.author'),
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
);
if (!filter_var($this->variables['APP_SERVICE_AUTHOR'], FILTER_VALIDATE_EMAIL)) {
$this->output->error('The service author email provided is invalid.');
$validator = $this->validator->make(
['email' => $this->variables['APP_SERVICE_AUTHOR']],
['email' => 'email']
);
if ($validator->fails()) {
foreach ($validator->errors()->all() as $error) {
$this->output->error($error);
}
return 1;
}
$this->output->comment('The application URL MUST begin with https:// or http:// depending on if you are using SSL or not. If you do not include the scheme your emails and other content will link to the wrong location.');
$this->output->comment(trans('command/messages.environment.app.app_url_help'));
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
'Application URL',
config('app.url', 'https://example.com')
trans('command/messages.environment.app.app_url'),
$this->config->get('app.url', 'http://example.org')
);
$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.');
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
'Application Timezone',
\DateTimeZone::listIdentifiers(),
config('app.timezone')
trans('command/messages.environment.app.timezone'),
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
$this->config->get('app.timezone')
);
$selected = config('cache.default', 'redis');
$selected = $this->config->get('cache.default', 'redis');
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
'Cache Driver',
self::CACHE_DRIVERS,
array_key_exists($selected, self::CACHE_DRIVERS) ? $selected : null
trans('command/messages.environment.app.cache_driver'),
self::ALLOWED_CACHE_DRIVERS,
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
);
$selected = config('session.driver', 'redis');
$selected = $this->config->get('session.driver', 'redis');
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
'Session Driver',
self::SESSION_DRIVERS,
array_key_exists($selected, self::SESSION_DRIVERS) ? $selected : null
trans('command/messages.environment.app.session_driver'),
self::ALLOWED_SESSION_DRIVERS,
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
);
$selected = config('queue.default', 'redis');
$selected = $this->config->get('queue.default', 'redis');
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
'Queue Driver',
self::QUEUE_DRIVERS,
array_key_exists($selected, self::QUEUE_DRIVERS) ? $selected : null
trans('command/messages.environment.app.queue_driver'),
self::ALLOWED_QUEUE_DRIVERS,
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
);
if (!is_null($this->option('settings-ui'))) {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
} else {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm('Enable UI based settings editor?', true) ? 'false' : 'true';
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
}
$this->output->comment('Please reference https://pterodactyl.io/panel/1.0/additional_configuration.html#telemetry for more detailed information regarding telemetry data and collection.');
$this->variables['PTERODACTYL_TELEMETRY_ENABLED'] = $this->option('telemetry') ?? $this->confirm(
'Enable sending anonymous telemetry data?',
config('pterodactyl.telemetry.enabled', true)
) ? 'true' : 'false';
// Make sure session cookies are set as "secure" when using HTTPS
if (str_starts_with($this->variables['APP_URL'], 'https://')) {
if (strpos($this->variables['APP_URL'], 'https://') === 0) {
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
}
$this->checkForRedis();
$this->writeToEnvironment($this->variables);
$this->info($this->console->output());
return 0;
$this->info($this->command->output());
}
/**
@ -152,22 +188,22 @@ class AppSettingsCommand extends Command
return;
}
$this->output->note('You\'ve selected the Redis driver for one or more options, please provide valid connection information below. In most cases you can use the defaults provided unless you have modified your setup.');
$this->output->note(trans('command/messages.environment.app.using_redis'));
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
'Redis Host',
config('database.redis.default.host')
trans('command/messages.environment.app.redis_host'),
$this->config->get('database.redis.default.host')
);
$askForRedisPassword = true;
if (!empty(config('database.redis.default.password'))) {
$this->variables['REDIS_PASSWORD'] = config('database.redis.default.password');
$askForRedisPassword = $this->confirm('It seems a password is already defined for Redis, would you like to change it?');
if (!empty($this->config->get('database.redis.default.password'))) {
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password');
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined'));
}
if ($askForRedisPassword) {
$this->output->comment('By default a Redis server instance has no password as it is running locally and inaccessible to the outside world. If this is the case, simply hit enter without entering a value.');
$this->output->comment(trans('command/messages.environment.app.redis_pass_help'));
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
'Redis Password'
trans('command/messages.environment.app.redis_password')
);
}
@ -176,8 +212,8 @@ class AppSettingsCommand extends Command
}
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
'Redis Port',
config('database.redis.default.port')
trans('command/messages.environment.app.redis_port'),
$this->config->get('database.redis.default.port')
);
}
}

View File

@ -1,18 +1,48 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\Environment;
use PDOException;
use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Database\DatabaseManager;
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class DatabaseSettingsCommand extends Command
{
use EnvironmentWriterTrait;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var \Illuminate\Contracts\Console\Kernel
*/
protected $console;
/**
* @var \Illuminate\Database\DatabaseManager
*/
protected $database;
/**
* @var string
*/
protected $description = 'Configure database settings for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:database
{--host= : The connection address for the MySQL server.}
{--port= : The connection port for the MySQL server.}
@ -20,62 +50,71 @@ class DatabaseSettingsCommand extends Command
{--username= : Username to use when connecting.}
{--password= : Password to use for this database.}';
protected array $variables = [];
/**
* @var array
*/
protected $variables = [];
/**
* DatabaseSettingsCommand constructor.
*/
public function __construct(private DatabaseManager $database, private Kernel $console)
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console)
{
parent::__construct();
$this->config = $config;
$this->console = $console;
$this->database = $database;
}
/**
* Handle command execution.
*
* @return int
*
* @throws \Pterodactyl\Exceptions\PterodactylException
*/
public function handle(): int
public function handle()
{
$this->output->note('It is highly recommended to not use "localhost" as your database host as we have seen frequent socket connection issues. If you want to use a local connection you should be using "127.0.0.1".');
$this->output->note(trans('command/messages.environment.database.host_warning'));
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
'Database Host',
config('database.connections.mysql.host', '127.0.0.1')
trans('command/messages.environment.database.host'),
$this->config->get('database.connections.mysql.host', '127.0.0.1')
);
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
'Database Port',
config('database.connections.mysql.port', 3306)
trans('command/messages.environment.database.port'),
$this->config->get('database.connections.mysql.port', 3306)
);
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
'Database Name',
config('database.connections.mysql.database', 'panel')
trans('command/messages.environment.database.database'),
$this->config->get('database.connections.mysql.database', 'panel')
);
$this->output->note('Using the "root" account for MySQL connections is not only highly frowned upon, it is also not allowed by this application. You\'ll need to have created a MySQL user for this software.');
$this->output->note(trans('command/messages.environment.database.username_warning'));
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
'Database Username',
config('database.connections.mysql.username', 'pterodactyl')
trans('command/messages.environment.database.username'),
$this->config->get('database.connections.mysql.username', 'pterodactyl')
);
$askForMySQLPassword = true;
if (!empty(config('database.connections.mysql.password')) && $this->input->isInteractive()) {
$this->variables['DB_PASSWORD'] = config('database.connections.mysql.password');
$askForMySQLPassword = $this->confirm('It appears you already have a MySQL connection password defined, would you like to change it?');
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password');
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined'));
}
if ($askForMySQLPassword) {
$this->variables['DB_PASSWORD'] = $this->option('password') ?? $this->secret('Database Password');
$this->variables['DB_PASSWORD'] = $this->option('password') ?? $this->secret(trans('command/messages.environment.database.password'));
}
try {
$this->testMySQLConnection();
} catch (\PDOException $exception) {
$this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage()));
$this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');
} catch (PDOException $exception) {
$this->output->error(trans('command/messages.environment.database.connection_error', ['error' => $exception->getMessage()]));
$this->output->error(trans('command/messages.environment.database.creds_not_saved'));
if ($this->confirm('Go back and try again?')) {
if ($this->confirm(trans('command/messages.environment.database.try_again'))) {
$this->database->disconnect('_pterodactyl_command_test');
return $this->handle();
@ -96,7 +135,7 @@ class DatabaseSettingsCommand extends Command
*/
private function testMySQLConnection()
{
config()->set('database.connections._pterodactyl_command_test', [
$this->config->set('database.connections._pterodactyl_command_test', [
'driver' => 'mysql',
'host' => $this->variables['DB_HOST'],
'port' => $this->variables['DB_PORT'],

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\Environment;
@ -10,8 +17,19 @@ class EmailSettingsCommand extends Command
{
use EnvironmentWriterTrait;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var string
*/
protected $description = 'Set or update the email sending configuration for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:mail
{--driver= : The mail driver to use.}
{--email= : Email address that messages from the Panel will originate from.}
@ -23,14 +41,19 @@ class EmailSettingsCommand extends Command
{--username=}
{--password=}';
protected array $variables = [];
/**
* @var array
*/
protected $variables = [];
/**
* EmailSettingsCommand constructor.
*/
public function __construct(private ConfigRepository $config)
public function __construct(ConfigRepository $config)
{
parent::__construct();
$this->config = $config;
}
/**
@ -44,12 +67,12 @@ class EmailSettingsCommand extends Command
trans('command/messages.environment.mail.ask_driver'),
[
'smtp' => 'SMTP Server',
'sendmail' => 'sendmail Binary',
'mail' => 'PHP\'s Internal Mail Function',
'mailgun' => 'Mailgun Transactional Email',
'mandrill' => 'Mandrill Transactional Email',
'postmark' => 'Postmark Transactional Email',
'postmark' => 'Postmarkapp Transactional Email',
],
$this->config->get('mail.default', 'smtp')
$this->config->get('mail.driver', 'smtp')
);
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';
@ -57,7 +80,7 @@ class EmailSettingsCommand extends Command
$this->{$method}();
}
$this->variables['MAIL_FROM_ADDRESS'] = $this->option('email') ?? $this->ask(
$this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask(
trans('command/messages.environment.mail.ask_mail_from'),
$this->config->get('mail.from.address')
);
@ -67,6 +90,12 @@ class EmailSettingsCommand extends Command
$this->config->get('mail.from.name')
);
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
trans('command/messages.environment.mail.ask_encryption'),
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
$this->config->get('mail.encryption', 'tls')
);
$this->writeToEnvironment($this->variables);
$this->line('Updating stored environment configuration file.');
@ -80,28 +109,22 @@ class EmailSettingsCommand extends Command
{
$this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_host'),
$this->config->get('mail.mailers.smtp.host')
$this->config->get('mail.host')
);
$this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_port'),
$this->config->get('mail.mailers.smtp.port')
$this->config->get('mail.port')
);
$this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_username'),
$this->config->get('mail.mailers.smtp.username')
$this->config->get('mail.username')
);
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
trans('command/messages.environment.mail.ask_smtp_password')
);
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
trans('command/messages.environment.mail.ask_encryption'),
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
$this->config->get('mail.mailers.smtp.encryption', 'tls')
);
}
/**

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands;
@ -8,16 +15,35 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository;
class InfoCommand extends Command
{
/**
* @var string
*/
protected $description = 'Displays the application, database, and email configurations along with the panel version.';
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var string
*/
protected $signature = 'p:info';
/**
* @var \Pterodactyl\Services\Helpers\SoftwareVersionService
*/
protected $versionService;
/**
* VersionCommand constructor.
*/
public function __construct(private ConfigRepository $config, private SoftwareVersionService $versionService)
public function __construct(ConfigRepository $config, SoftwareVersionService $versionService)
{
parent::__construct();
$this->config = $config;
$this->versionService = $versionService;
}
/**
@ -28,15 +54,15 @@ class InfoCommand extends Command
$this->output->title('Version Information');
$this->table([], [
['Panel Version', $this->config->get('app.version')],
['Latest Version', $this->versionService->getPanel()],
['Latest Version', $this->versionService->getLatestPanel()],
['Up-to-Date', $this->versionService->isLatestPanel() ? 'Yes' : $this->formatText('No', 'bg=red')],
['Unique Identifier', $this->config->get('pterodactyl.service.author')],
], 'compact');
$this->output->title('Application Configuration');
$this->table([], [
['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ?: 'bg=red')],
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ?: 'bg=red')],
['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ? '' : 'bg=red')],
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ? '' : 'bg=red')],
['Installation URL', $this->config->get('app.url')],
['Installation Directory', base_path()],
['Timezone', $this->config->get('app.timezone')],
@ -44,7 +70,6 @@ class InfoCommand extends Command
['Queue Driver', $this->config->get('queue.default')],
['Session Driver', $this->config->get('session.driver')],
['Filesystem Driver', $this->config->get('filesystems.default')],
['Default Theme', $this->config->get('themes.active')],
['Proxies', $this->config->get('trustedproxies.proxies')],
], 'compact');
@ -52,29 +77,33 @@ class InfoCommand extends Command
$driver = $this->config->get('database.default');
$this->table([], [
['Driver', $driver],
['Host', $this->config->get("database.connections.$driver.host")],
['Port', $this->config->get("database.connections.$driver.port")],
['Database', $this->config->get("database.connections.$driver.database")],
['Username', $this->config->get("database.connections.$driver.username")],
['Host', $this->config->get("database.connections.{$driver}.host")],
['Port', $this->config->get("database.connections.{$driver}.port")],
['Database', $this->config->get("database.connections.{$driver}.database")],
['Username', $this->config->get("database.connections.{$driver}.username")],
], 'compact');
// TODO: Update this to handle other mail drivers
$this->output->title('Email Configuration');
$this->table([], [
['Driver', $this->config->get('mail.default')],
['Host', $this->config->get('mail.mailers.smtp.host')],
['Port', $this->config->get('mail.mailers.smtp.port')],
['Username', $this->config->get('mail.mailers.smtp.username')],
['Driver', $this->config->get('mail.driver')],
['Host', $this->config->get('mail.host')],
['Port', $this->config->get('mail.port')],
['Username', $this->config->get('mail.username')],
['From Address', $this->config->get('mail.from.address')],
['From Name', $this->config->get('mail.from.name')],
['Encryption', $this->config->get('mail.mailers.smtp.encryption')],
['Encryption', $this->config->get('mail.encryption')],
], 'compact');
}
/**
* Format output in a Name: Value manner.
*
* @param string $value
* @param string $opts
*
* @return string
*/
private function formatText(string $value, string $opts = ''): string
private function formatText($value, $opts = '')
{
return sprintf('<%s>%s</>', $opts, $value);
}

View File

@ -3,26 +3,47 @@
namespace Pterodactyl\Console\Commands\Location;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Pterodactyl\Services\Locations\LocationDeletionService;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
class DeleteLocationCommand extends Command
{
/**
* @var \Pterodactyl\Services\Locations\LocationDeletionService
*/
protected $deletionService;
/**
* @var string
*/
protected $description = 'Deletes a location from the Panel.';
protected $signature = 'p:location:delete {--short= : The short code of the location to delete.}';
/**
* @var \Illuminate\Support\Collection|null
*/
protected $locations = null;
protected Collection $locations;
/**
* @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
*/
protected $repository;
/**
* @var string
*/
protected $signature = 'p:location:delete {--short= : The short code of the location to delete.}';
/**
* DeleteLocationCommand constructor.
*/
public function __construct(
private LocationDeletionService $deletionService,
private LocationRepositoryInterface $repository
LocationDeletionService $deletionService,
LocationRepositoryInterface $repository
) {
parent::__construct();
$this->deletionService = $deletionService;
$this->repository = $repository;
}
/**

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\Location;
@ -7,18 +14,31 @@ use Pterodactyl\Services\Locations\LocationCreationService;
class MakeLocationCommand extends Command
{
/**
* @var \Pterodactyl\Services\Locations\LocationCreationService
*/
protected $creationService;
/**
* @var string
*/
protected $signature = 'p:location:make
{--short= : The shortcode name of this location (ex. us1).}
{--long= : A longer description of this location.}';
/**
* @var string
*/
protected $description = 'Creates a new location on the system via the CLI.';
/**
* Create a new command instance.
*/
public function __construct(private LocationCreationService $creationService)
public function __construct(LocationCreationService $creationService)
{
parent::__construct();
$this->creationService = $creationService;
}
/**

View File

@ -2,20 +2,29 @@
namespace Pterodactyl\Console\Commands\Maintenance;
use SplFileInfo;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
class CleanServiceBackupFilesCommand extends Command
{
public const BACKUP_THRESHOLD_MINUTES = 5;
/**
* @var string
*/
protected $description = 'Clean orphaned .bak files created when modifying services.';
protected $signature = 'p:maintenance:clean-service-backups';
/**
* @var \Illuminate\Contracts\Filesystem\Filesystem
*/
protected $disk;
protected Filesystem $disk;
/**
* @var string
*/
protected $signature = 'p:maintenance:clean-service-backups';
/**
* CleanServiceBackupFilesCommand constructor.
@ -34,7 +43,7 @@ class CleanServiceBackupFilesCommand extends Command
{
$files = $this->disk->files('services/.bak');
collect($files)->each(function (\SplFileInfo $file) {
collect($files)->each(function (SplFileInfo $file) {
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
if ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file->getPath());

View File

@ -3,31 +3,30 @@
namespace Pterodactyl\Console\Commands\Maintenance;
use Carbon\CarbonImmutable;
use InvalidArgumentException;
use Illuminate\Console\Command;
use Pterodactyl\Repositories\Eloquent\BackupRepository;
class PruneOrphanedBackupsCommand extends Command
{
/**
* @var string
*/
protected $signature = 'p:maintenance:prune-backups {--prune-age=}';
protected $description = 'Marks all backups older than "n" minutes that have not yet completed as being failed.';
/**
* PruneOrphanedBackupsCommand constructor.
* @var string
*/
public function __construct(private BackupRepository $backupRepository)
{
parent::__construct();
}
protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.';
public function handle()
public function handle(BackupRepository $repository)
{
$since = $this->option('prune-age') ?? config('backups.prune_age', 360);
if (!$since || !is_digit($since)) {
throw new \InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.');
throw new InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.');
}
$query = $this->backupRepository->getBuilder()
$query = $repository->getBuilder()
->whereNull('completed_at')
->where('created_at', '<=', CarbonImmutable::now()->subMinutes($since)->toDateTimeString());
@ -38,7 +37,7 @@ class PruneOrphanedBackupsCommand extends Command
return;
}
$this->warn("Marking $count uncompleted backups that are older than $since minutes as failed.");
$this->warn("Marking {$count} backups that have not been marked as completed in the last {$since} minutes as failed.");
$query->update([
'is_successful' => false,

View File

@ -1,69 +0,0 @@
<?php
namespace Pterodactyl\Console\Commands\Node;
use Illuminate\Console\Command;
use Pterodactyl\Services\Nodes\NodeCreationService;
class MakeNodeCommand extends Command
{
protected $signature = 'p:node:make
{--name= : A name to identify the node.}
{--description= : A description to identify the node.}
{--locationId= : A valid locationId.}
{--fqdn= : The domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node.}
{--public= : Should the node be public or private? (public=1 / private=0).}
{--scheme= : Which scheme should be used? (Enable SSL=https / Disable SSL=http).}
{--proxy= : Is the daemon behind a proxy? (Yes=1 / No=0).}
{--maintenance= : Should maintenance mode be enabled? (Enable Maintenance mode=1 / Disable Maintenance mode=0).}
{--maxMemory= : Set the max memory amount.}
{--overallocateMemory= : Enter the amount of ram to overallocate (% or -1 to overallocate the maximum).}
{--maxDisk= : Set the max disk amount.}
{--overallocateDisk= : Enter the amount of disk to overallocate (% or -1 to overallocate the maximum).}
{--uploadSize= : Enter the maximum upload filesize.}
{--daemonListeningPort= : Enter the wings listening port.}
{--daemonSFTPPort= : Enter the wings SFTP listening port.}
{--daemonBase= : Enter the base folder.}';
protected $description = 'Creates a new node on the system via the CLI.';
/**
* MakeNodeCommand constructor.
*/
public function __construct(private NodeCreationService $creationService)
{
parent::__construct();
}
/**
* Handle the command execution process.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function handle()
{
$data['name'] = $this->option('name') ?? $this->ask('Enter a short identifier used to distinguish this node from others');
$data['description'] = $this->option('description') ?? $this->ask('Enter a description to identify the node');
$data['location_id'] = $this->option('locationId') ?? $this->ask('Enter a valid location id');
$data['scheme'] = $this->option('scheme') ?? $this->anticipate(
'Please either enter https for SSL or http for a non-ssl connection',
['https', 'http'],
'https'
);
$data['fqdn'] = $this->option('fqdn') ?? $this->ask('Enter a domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node');
$data['public'] = $this->option('public') ?? $this->confirm('Should this node be public? As a note, setting a node to private you will be denying the ability to auto-deploy to this node.', true);
$data['behind_proxy'] = $this->option('proxy') ?? $this->confirm('Is your FQDN behind a proxy?');
$data['maintenance_mode'] = $this->option('maintenance') ?? $this->confirm('Should maintenance mode be enabled?');
$data['memory'] = $this->option('maxMemory') ?? $this->ask('Enter the maximum amount of memory');
$data['memory_overallocate'] = $this->option('overallocateMemory') ?? $this->ask('Enter the amount of memory to over allocate by, -1 will disable checking and 0 will prevent creating new servers');
$data['disk'] = $this->option('maxDisk') ?? $this->ask('Enter the maximum amount of disk space');
$data['disk_overallocate'] = $this->option('overallocateDisk') ?? $this->ask('Enter the amount of memory to over allocate by, -1 will disable checking and 0 will prevent creating new server');
$data['upload_size'] = $this->option('uploadSize') ?? $this->ask('Enter the maximum filesize upload', '100');
$data['daemonListen'] = $this->option('daemonListeningPort') ?? $this->ask('Enter the wings listening port', '8080');
$data['daemonSFTP'] = $this->option('daemonSFTPPort') ?? $this->ask('Enter the wings SFTP listening port', '2022');
$data['daemonBase'] = $this->option('daemonBase') ?? $this->ask('Enter the base folder', '/var/lib/pterodactyl/volumes');
$node = $this->creationService->handle($data);
$this->line('Successfully created a new node on the location ' . $data['location_id'] . ' with the name ' . $data['name'] . ' and has an id of ' . $node->id . '.');
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace Pterodactyl\Console\Commands\Node;
use Pterodactyl\Models\Node;
use Illuminate\Console\Command;
class NodeConfigurationCommand extends Command
{
protected $signature = 'p:node:configuration
{node : The ID or UUID of the node to return the configuration for.}
{--format=yaml : The output format. Options are "yaml" and "json".}';
protected $description = 'Displays the configuration for the specified node.';
public function handle(): int
{
$column = ctype_digit((string) $this->argument('node')) ? 'id' : 'uuid';
/** @var \Pterodactyl\Models\Node $node */
$node = Node::query()->where($column, $this->argument('node'))->firstOr(function () {
$this->error('The selected node does not exist.');
exit(1);
});
$format = $this->option('format');
if (!in_array($format, ['yaml', 'yml', 'json'])) {
$this->error('Invalid format specified. Valid options are "yaml" and "json".');
return 1;
}
if ($format === 'json') {
$this->output->write($node->getJsonConfiguration(true));
} else {
$this->output->write($node->getYamlConfiguration());
}
$this->output->newLine();
return 0;
}
}

View File

@ -1,34 +0,0 @@
<?php
namespace Pterodactyl\Console\Commands\Node;
use Pterodactyl\Models\Node;
use Illuminate\Console\Command;
class NodeListCommand extends Command
{
protected $signature = 'p:node:list {--format=text : The output format: "text" or "json". }';
public function handle(): int
{
$nodes = Node::query()->with('location')->get()->map(function (Node $node) {
return [
'id' => $node->id,
'uuid' => $node->uuid,
'name' => $node->name,
'location' => $node->location->short,
'host' => $node->getConnectionAddress(),
];
});
if ($this->option('format') === 'json') {
$this->output->write($nodes->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
} else {
$this->table(['ID', 'UUID', 'Name', 'Location', 'Host'], $nodes->toArray());
}
$this->output->newLine();
return 0;
}
}

View File

@ -21,6 +21,6 @@ class UpCommand extends BaseUpCommand
return 1;
}
return parent::handle() ?? 0;
return parent::handle();
}
}

View File

@ -3,16 +3,22 @@
namespace Pterodactyl\Console\Commands\Schedule;
use Exception;
use Throwable;
use Illuminate\Console\Command;
use Pterodactyl\Models\Schedule;
use Illuminate\Support\Facades\Log;
use Illuminate\Database\Eloquent\Builder;
use Pterodactyl\Services\Schedules\ProcessScheduleService;
class ProcessRunnableCommand extends Command
{
/**
* @var string
*/
protected $signature = 'p:schedule:process';
/**
* @var string
*/
protected $description = 'Process schedules in the database and determine which are ready to run.';
/**
@ -20,9 +26,7 @@ class ProcessRunnableCommand extends Command
*/
public function handle(): int
{
$schedules = Schedule::query()
->with('tasks')
->whereRelation('server', fn (Builder $builder) => $builder->whereNull('status'))
$schedules = Schedule::query()->with('tasks')
->where('is_active', true)
->where('is_processing', false)
->whereRaw('next_run_at <= NOW()')
@ -67,10 +71,10 @@ class ProcessRunnableCommand extends Command
'schedule' => $schedule->name,
'hash' => $schedule->hashid,
]));
} catch (\Throwable|\Exception $exception) {
} catch (Throwable|Exception $exception) {
Log::error($exception, ['schedule_id' => $schedule->id]);
$this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage());
$this->error("An error was encountered while processing Schedule #{$schedule->id}: " . $exception->getMessage());
}
}
}

View File

@ -4,7 +4,6 @@ namespace Pterodactyl\Console\Commands\Server;
use Pterodactyl\Models\Server;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Factory as ValidatorFactory;
use Pterodactyl\Repositories\Wings\DaemonPowerRepository;
@ -12,33 +11,31 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
class BulkPowerActionCommand extends Command
{
/**
* @var string
*/
protected $signature = 'p:server:bulk-power
{action : The action to perform (start, stop, restart, kill)}
{--servers= : A comma separated list of servers.}
{--nodes= : A comma separated list of nodes.}';
protected $description = 'Perform bulk power management on large groupings of servers or nodes at once.';
/**
* BulkPowerActionCommand constructor.
* @var string
*/
public function __construct(private DaemonPowerRepository $powerRepository, private ValidatorFactory $validator)
{
parent::__construct();
}
protected $description = 'Perform bulk power management on large groupings of servers or nodes at once.';
/**
* Handle the bulk power request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function handle()
public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator)
{
$action = $this->argument('action');
$nodes = empty($this->option('nodes')) ? [] : explode(',', $this->option('nodes'));
$servers = empty($this->option('servers')) ? [] : explode(',', $this->option('servers'));
$validator = $this->validator->make([
$validator = $validator->make([
'action' => $action,
'nodes' => $nodes,
'servers' => $servers,
@ -64,7 +61,6 @@ class BulkPowerActionCommand extends Command
}
$bar = $this->output->createProgressBar($count);
$powerRepository = $this->powerRepository;
$this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) {
$bar->clear();
@ -88,8 +84,10 @@ class BulkPowerActionCommand extends Command
/**
* Returns the query builder instance that will return the servers that should be affected.
*
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function getQueryBuilder(array $servers, array $nodes): Builder
protected function getQueryBuilder(array $servers, array $nodes)
{
$instance = Server::query()->whereNull('status');

View File

@ -1,34 +0,0 @@
<?php
namespace Pterodactyl\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\VarDumper\VarDumper;
use Pterodactyl\Services\Telemetry\TelemetryCollectionService;
class TelemetryCommand extends Command
{
protected $description = 'Displays all the data that would be sent to the Pterodactyl Telemetry Service if telemetry collection is enabled.';
protected $signature = 'p:telemetry';
/**
* TelemetryCommand constructor.
*/
public function __construct(private TelemetryCollectionService $telemetryCollectionService)
{
parent::__construct();
}
/**
* Handle execution of command.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function handle()
{
$this->output->info('Collecting telemetry data, this may take a while...');
VarDumper::dump($this->telemetryCollectionService->collect());
}
}

View File

@ -2,6 +2,7 @@
namespace Pterodactyl\Console\Commands;
use Closure;
use Illuminate\Console\Command;
use Pterodactyl\Console\Kernel;
use Symfony\Component\Process\Process;
@ -11,6 +12,7 @@ class UpgradeCommand extends Command
{
protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/%s/panel.tar.gz';
/** @var string */
protected $signature = 'p:upgrade
{--user= : The user that PHP runs under. All files will be owned by this user.}
{--group= : The group that PHP runs under. All files will be owned by this group.}
@ -18,6 +20,7 @@ class UpgradeCommand extends Command
{--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.}
{--skip-download : If set no archive will be downloaded.}';
/** @var string */
protected $description = 'Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.';
/**
@ -176,7 +179,7 @@ class UpgradeCommand extends Command
$this->info('Panel has been successfully upgraded. Please ensure you also update any Wings instances: https://pterodactyl.io/wings/1.0/upgrading.html');
}
protected function withProgress(ProgressBar $bar, \Closure $callback)
protected function withProgress(ProgressBar $bar, Closure $callback)
{
$bar->clear();
$callback();

View File

@ -9,18 +9,39 @@ use Pterodactyl\Services\Users\UserDeletionService;
class DeleteUserCommand extends Command
{
/**
* @var \Pterodactyl\Services\Users\UserDeletionService
*/
protected $deletionService;
/**
* @var string
*/
protected $description = 'Deletes a user from the Panel if no servers are attached to their account.';
/**
* @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface
*/
protected $repository;
/**
* @var string
*/
protected $signature = 'p:user:delete {--user=}';
/**
* DeleteUserCommand constructor.
*/
public function __construct(private UserDeletionService $deletionService)
public function __construct(UserDeletionService $deletionService)
{
parent::__construct();
$this->deletionService = $deletionService;
}
/**
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function handle(): int
{
$search = $this->option('user') ?? $this->ask(trans('command/messages.user.search_users'));
@ -44,7 +65,7 @@ class DeleteUserCommand extends Command
if ($this->input->isInteractive()) {
$tableValues = [];
foreach ($results as $user) {
$tableValues[] = [$user->id, $user->email, $user->name];
$tableValues[] = [$user->id, $user->email, $user->name_first];
}
$this->table(['User ID', 'Email', 'Name'], $tableValues);

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\User;
@ -7,16 +14,29 @@ use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class DisableTwoFactorCommand extends Command
{
/**
* @var string
*/
protected $description = 'Disable two-factor authentication for a specific user in the Panel.';
/**
* @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface
*/
protected $repository;
/**
* @var string
*/
protected $signature = 'p:user:disable2fa {--email= : The email of the user to disable 2-Factor for.}';
/**
* DisableTwoFactorCommand constructor.
*/
public function __construct(private UserRepositoryInterface $repository)
public function __construct(UserRepositoryInterface $repository)
{
parent::__construct();
$this->repository = $repository;
}
/**

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\User;
@ -7,16 +14,29 @@ use Pterodactyl\Services\Users\UserCreationService;
class MakeUserCommand extends Command
{
/**
* @var \Pterodactyl\Services\Users\UserCreationService
*/
protected $creationService;
/**
* @var string
*/
protected $description = 'Creates a user on the system via the CLI.';
/**
* @var string
*/
protected $signature = 'p:user:make {--email=} {--username=} {--name-first=} {--name-last=} {--password=} {--admin=} {--no-password}';
/**
* MakeUserCommand constructor.
*/
public function __construct(private UserCreationService $creationService)
public function __construct(UserCreationService $creationService)
{
parent::__construct();
$this->creationService = $creationService;
}
/**
@ -30,8 +50,6 @@ class MakeUserCommand extends Command
$root_admin = $this->option('admin') ?? $this->confirm(trans('command/messages.user.ask_admin'));
$email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email'));
$username = $this->option('username') ?? $this->ask(trans('command/messages.user.ask_username'));
$name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first'));
$name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last'));
if (is_null($password = $this->option('password')) && !$this->option('no-password')) {
$this->warn(trans('command/messages.user.ask_password_help'));
@ -39,12 +57,12 @@ class MakeUserCommand extends Command
$password = $this->secret(trans('command/messages.user.ask_password'));
}
$user = $this->creationService->handle(compact('email', 'username', 'name_first', 'name_last', 'password', 'root_admin'));
$user = $this->creationService->handle(compact('email', 'username', 'password', 'root_admin'));
$this->table(['Field', 'Value'], [
['UUID', $user->uuid],
['Email', $user->email],
['Username', $user->username],
['Name', $user->name],
['Name', $user->name_first],
['Admin', $user->root_admin ? 'Yes' : 'No'],
]);
}

View File

@ -1,33 +0,0 @@
<?php
namespace Pterodactyl\Console\Commands;
use Illuminate\Console\Command;
class Love extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'n:love';
/**
* The console command description.
*
* @var string
*/
protected $description = '<3';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->info('Ari <3');
return Command::SUCCESS;
}
}

View File

@ -2,23 +2,15 @@
namespace Pterodactyl\Console;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\ActivityLog;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Console\PruneCommand;
use Pterodactyl\Repositories\Eloquent\SettingsRepository;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Pterodactyl\Services\Telemetry\TelemetryCollectionService;
use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand;
use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
class Kernel extends ConsoleKernel
{
/**
* Register the commands for the application.
*/
protected function commands(): void
protected function commands()
{
$this->load(__DIR__ . '/Commands');
}
@ -26,51 +18,17 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
protected function schedule(Schedule $schedule)
{
// https://laravel.com/docs/10.x/upgrade#redis-cache-tags
$schedule->command('cache:prune-stale-tags')->hourly();
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
$schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping();
if (config('backups.prune_age')) {
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
$schedule->command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes();
$schedule->command('p:maintenance:prune-backups')->everyThirtyMinutes();
}
if (config('activity.prune_days')) {
$schedule->command(PruneCommand::class, ['--model' => [ActivityLog::class]])->daily();
}
if (config('pterodactyl.telemetry.enabled')) {
$this->registerTelemetry($schedule);
}
}
/**
* I wonder what this does.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
private function registerTelemetry(Schedule $schedule): void
{
$settingsRepository = app()->make(SettingsRepository::class);
$uuid = $settingsRepository->get('app:telemetry:uuid');
if (is_null($uuid)) {
$uuid = Uuid::uuid4()->toString();
$settingsRepository->set('app:telemetry:uuid', $uuid);
}
// Calculate a fixed time to run the data push at, this will be the same time every day.
$time = hexdec(str_replace('-', '', substr($uuid, 27))) % 1440;
$hour = floor($time / 60);
$minute = $time % 60;
// Run the telemetry collector.
$schedule->call(app()->make(TelemetryCollectionService::class))->description('Collect Telemetry')->dailyAt("$hour:$minute");
// Every day cleanup any internal backups of service files.
$schedule->command('p:maintenance:clean-service-backups')->daily();
}
}

View File

@ -33,7 +33,7 @@ trait RequiresDatabaseMigrations
* them to properly run the migrations rather than ignoring all of the other previous
* errors...
*/
protected function showMigrationWarning(): void
protected function showMigrationWarning()
{
$this->getOutput()->writeln('<options=bold>
| @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |

View File

@ -1,14 +1,24 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Criteria;
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Repositories\Repository;
interface CriteriaInterface
{
/**
* Apply selected criteria to a repository call.
*
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return mixed
*/
public function apply(Model $model, Repository $repository): mixed;
public function apply($model, Repository $repository);
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Extensions;
@ -9,7 +16,12 @@ interface HashidsInterface extends VendorHashidsInterface
/**
* Decode an encoded hashid and return the first result.
*
* @param string $encoded
* @param null $default
*
* @return mixed
*
* @throws \InvalidArgumentException
*/
public function decodeFirst(string $encoded, string $default = null): mixed;
public function decodeFirst($encoded, $default = null);
}

View File

@ -1,13 +0,0 @@
<?php
namespace Pterodactyl\Contracts\Http;
interface ClientPermissionsRequest
{
/**
* Returns the permissions string indicating which permission should be used to
* validate that the authenticated user has permission to perform this action against
* the given resource (server).
*/
public function permission(): string;
}

View File

@ -2,18 +2,18 @@
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Allocation;
interface AllocationRepositoryInterface extends RepositoryInterface
{
/**
* Return all the allocations that exist for a node that are not currently
* Return all of the allocations that exist for a node that are not currently
* allocated.
*/
public function getUnassignedAllocationIds(int $node): array;
/**
* Return a single allocation from those meeting the requirements.
*
* @return \Pterodactyl\Models\Allocation|null
*/
public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false): ?Allocation;
public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false);
}

View File

@ -1,29 +0,0 @@
<?php
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\User;
use Illuminate\Support\Collection;
interface ApiKeyRepositoryInterface extends RepositoryInterface
{
/**
* Get all the account API keys that exist for a specific user.
*/
public function getAccountKeys(User $user): Collection;
/**
* Get all the application API keys that exist for a specific user.
*/
public function getApplicationKeys(User $user): Collection;
/**
* Delete an account API key from the panel for a specific user.
*/
public function deleteAccountKey(User $user, string $identifier): int;
/**
* Delete an application API key from the panel for a specific user.
*/
public function deleteApplicationKey(User $user, string $identifier): int;
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository;

View File

@ -2,6 +2,7 @@
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Database;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
@ -11,8 +12,10 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
/**
* Set the connection name to execute statements against.
*
* @return $this
*/
public function setConnection(string $connection): self;
public function setConnection(string $connection);
/**
* Return the connection to execute statements against.
@ -20,12 +23,12 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
public function getConnection(): string;
/**
* Return all the databases belonging to a server.
* Return all of the databases belonging to a server.
*/
public function getDatabasesForServer(int $server): Collection;
/**
* Return all the databases for a given host with the server relationship loaded.
* Return all of the databases for a given host with the server relationship loaded.
*/
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
@ -37,7 +40,7 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
/**
* Create a new database user on a given connection.
*/
public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool;
public function createUser(string $username, string $remote, string $password, int $max_connections): bool;
/**
* Give a specific user access to a given database.

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository;
@ -21,11 +28,13 @@ interface EggRepositoryInterface extends RepositoryInterface
/**
* Return an egg with the scriptFrom and configFrom relations loaded onto the model.
*
* @param int|string $value
*/
public function getWithCopyAttributes(int|string $value, string $column = 'id'): Egg;
public function getWithCopyAttributes($value, string $column = 'id'): Egg;
/**
* Return all the data needed to export a service.
* Return all of the data needed to export a service.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository;

View File

@ -13,12 +13,12 @@ interface LocationRepositoryInterface extends RepositoryInterface
public function getAllWithDetails(): Collection;
/**
* Return all the available locations with the nodes as a relationship.
* Return all of the available locations with the nodes as a relationship.
*/
public function getAllWithNodes(): Collection;
/**
* Return all the nodes and their respective count of servers for a location.
* Return all of the nodes and their respective count of servers for a location.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View File

@ -3,7 +3,6 @@
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Eloquent\Collection;
interface NestRepositoryInterface extends RepositoryInterface
{
@ -12,19 +11,5 @@ interface NestRepositoryInterface extends RepositoryInterface
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithEggs(int $id = null): Collection|Nest;
/**
* Return a nest or all nests and the count of eggs and servers for that nest.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithCounts(int $id = null): Collection|Nest;
/**
* Return a nest along with its associated eggs and the servers relation on those eggs.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithEggServers(int $id): Nest;
public function getWithEggs(int $id = null): Nest;
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository;

View File

@ -3,67 +3,87 @@
namespace Pterodactyl\Contracts\Repository;
use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
interface RepositoryInterface
{
/**
* Return an identifier or Model object to be used by the repository.
*
* @return string|\Closure|object
*/
public function model(): string;
public function model();
/**
* Return the model being used for this repository instance.
*
* @return mixed
*/
public function getModel(): Model;
public function getModel();
/**
* Returns an instance of a query builder.
*
* @return mixed
*/
public function getBuilder(): Builder;
public function getBuilder();
/**
* Returns the columns to be selected or returned by the query.
*
* @return mixed
*/
public function getColumns(): array;
public function getColumns();
/**
* An array of columns to filter the response by.
*
* @param array|string $columns
*
* @return $this
*/
public function setColumns(array|string $columns = ['*']): self;
public function setColumns($columns = ['*']);
/**
* Stop repository update functions from returning a fresh
* model when changes are committed.
*
* @return $this
*/
public function withoutFreshModel(): self;
public function withoutFreshModel();
/**
* Return a fresh model with a repository updates a model.
*
* @return $this
*/
public function withFreshModel(): self;
public function withFreshModel();
/**
* Set whether the repository should return a fresh model
* Set whether or not the repository should return a fresh model
* when changes are committed.
*
* @return $this
*/
public function setFreshModel(bool $fresh = true): self;
public function setFreshModel(bool $fresh = true);
/**
* Create a new model instance and persist it to the database.
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function create(array $fields, bool $validate = true, bool $force = false): mixed;
public function create(array $fields, bool $validate = true, bool $force = false);
/**
* Find a model that has the specific ID passed.
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function find(int $id): mixed;
public function find(int $id);
/**
* Find a model matching an array of where clauses.
@ -73,9 +93,11 @@ interface RepositoryInterface
/**
* Find and return the first matching instance for the given fields.
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function findFirstWhere(array $fields): mixed;
public function findFirstWhere(array $fields);
/**
* Return a count of records matching the passed arguments.
@ -95,10 +117,14 @@ interface RepositoryInterface
/**
* Update a given ID with the passed array of fields.
*
* @param int $id
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function update(int $id, array $fields, bool $validate = true, bool $force = false): mixed;
public function update($id, array $fields, bool $validate = true, bool $force = false);
/**
* Perform a mass update where matching records are updated using whereIn.
@ -109,9 +135,11 @@ interface RepositoryInterface
/**
* Update a record if it exists in the database, otherwise create it.
*
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false): mixed;
public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false);
/**
* Return all records associated with the given model.

View File

@ -8,12 +8,12 @@ use Illuminate\Support\Collection;
interface ScheduleRepositoryInterface extends RepositoryInterface
{
/**
* Return all the schedules for a given server.
* Return all of the schedules for a given server.
*/
public function findServerSchedules(int $server): Collection;
/**
* Return a schedule model with all the associated tasks as a relationship.
* Return a schedule model with all of the associated tasks as a relationship.
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View File

@ -67,7 +67,7 @@ interface ServerRepositoryInterface extends RepositoryInterface
public function isUniqueUuidCombo(string $uuid, string $short): bool;
/**
* Returns all the servers that exist for a given node in a paginated response.
* Returns all of the servers that exist for a given node in a paginated response.
*/
public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator;
}

View File

@ -7,12 +7,14 @@ use Illuminate\Support\Collection;
interface SessionRepositoryInterface extends RepositoryInterface
{
/**
* Return all the active sessions for a user.
* Return all of the active sessions for a user.
*/
public function getUserSessions(int $user): Collection;
/**
* Delete a session for a given user.
*
* @return int|null
*/
public function deleteUserSession(int $user, string $session): ?int;
public function deleteUserSession(int $user, string $session);
}

View File

@ -14,8 +14,12 @@ interface SettingsRepositoryInterface extends RepositoryInterface
/**
* Retrieve a persistent setting from the database.
*
* @param mixed $default
*
* @return mixed
*/
public function get(string $key, mixed $default): mixed;
public function get(string $key, $default);
/**
* Remove a key from the database cache.

View File

@ -15,6 +15,8 @@ interface TaskRepositoryInterface extends RepositoryInterface
/**
* Returns the next task in a schedule.
*
* @return \Pterodactyl\Models\Task|null
*/
public function getNextTask(int $schedule, int $index): ?Task;
public function getNextTask(int $schedule, int $index);
}

View File

@ -1,34 +0,0 @@
<?php
namespace Pterodactyl\Events;
use Illuminate\Support\Str;
use Pterodactyl\Models\ActivityLog;
use Illuminate\Database\Eloquent\Model;
class ActivityLogged extends Event
{
public function __construct(public ActivityLog $model)
{
}
public function is(string $event): bool
{
return $this->model->event === $event;
}
public function actor(): ?Model
{
return $this->isSystem() ? null : $this->model->actor;
}
public function isServerEvent(): bool
{
return Str::startsWith($this->model->event, 'server:');
}
public function isSystem(): bool
{
return is_null($this->model->actor_id);
}
}

View File

@ -1,13 +0,0 @@
<?php
namespace Pterodactyl\Events\Auth;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
class DirectLogin extends Event
{
public function __construct(public User $user, public bool $remember)
{
}
}

View File

@ -1,18 +1,43 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Auth;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class FailedCaptcha extends Event
class FailedCaptcha
{
use SerializesModels;
/**
* Create a new event instance.
* The IP that the request originated from.
*
* @var string
*/
public function __construct(public string $ip, public string $domain)
public $ip;
/**
* The domain that was used to try to verify the request with recaptcha api.
*
* @var string
*/
public $domain;
/**
* Create a new event instance.
*
* @param string $ip
* @param string $domain
*/
public function __construct($ip, $domain)
{
$this->ip = $ip;
$this->domain = $domain;
}
}

View File

@ -1,18 +1,43 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Auth;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class FailedPasswordReset extends Event
class FailedPasswordReset
{
use SerializesModels;
/**
* Create a new event instance.
* The IP that the request originated from.
*
* @var string
*/
public function __construct(public string $ip, public string $email)
public $ip;
/**
* The email address that was used when the reset request failed.
*
* @var string
*/
public $email;
/**
* Create a new event instance.
*
* @param string $ip
* @param string $email
*/
public function __construct($ip, $email)
{
$this->ip = $ip;
$this->email = $email;
}
}

View File

@ -1,13 +0,0 @@
<?php
namespace Pterodactyl\Events\Auth;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
class ProvidedAuthenticationToken extends Event
{
public function __construct(public User $user, public bool $recovery = false)
{
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Created extends Event
class Created
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Creating extends Event
class Creating
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Deleted extends Event
class Deleted
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Deleting extends Event
class Deleting
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -10,10 +10,16 @@ class Installed extends Event
{
use SerializesModels;
/**
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Saved extends Event
class Saved
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Saving extends Event
class Saving
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Updated extends Event
class Updated
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels;
class Updating extends Event
class Updating
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
public function __construct(Server $server)
{
$this->server = $server;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels;
class Created extends Event
class Created
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/**
* Create a new event instance.
*/
public function __construct(public Subuser $subuser)
public function __construct(Subuser $subuser)
{
$this->subuser = $subuser;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels;
class Creating extends Event
class Creating
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/**
* Create a new event instance.
*/
public function __construct(public Subuser $subuser)
public function __construct(Subuser $subuser)
{
$this->subuser = $subuser;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels;
class Deleted extends Event
class Deleted
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/**
* Create a new event instance.
*/
public function __construct(public Subuser $subuser)
public function __construct(Subuser $subuser)
{
$this->subuser = $subuser;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels;
class Deleting extends Event
class Deleting
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/**
* Create a new event instance.
*/
public function __construct(public Subuser $subuser)
public function __construct(Subuser $subuser)
{
$this->subuser = $subuser;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class Created extends Event
class Created
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/**
* Create a new event instance.
*/
public function __construct(public User $user)
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class Creating extends Event
class Creating
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/**
* Create a new event instance.
*/
public function __construct(public User $user)
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class Deleted extends Event
class Deleted
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/**
* Create a new event instance.
*/
public function __construct(public User $user)
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@ -1,19 +1,33 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels;
class Deleting extends Event
class Deleting
{
use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/**
* Create a new event instance.
*/
public function __construct(public User $user)
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@ -1,7 +1,16 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Exceptions;
class AccountNotFoundException extends \Exception
use Exception;
class AccountNotFoundException extends Exception
{
}

View File

@ -1,7 +1,16 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Exceptions;
class AutoDeploymentException extends \Exception
use Exception;
class AutoDeploymentException extends Exception
{
}

View File

@ -3,16 +3,12 @@
namespace Pterodactyl\Exceptions;
use Exception;
use Illuminate\Http\Request;
use Throwable;
use Psr\Log\LoggerInterface;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Illuminate\Container\Container;
use Illuminate\Http\RedirectResponse;
use Prologue\Alerts\AlertsMessageBag;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class DisplayException extends PterodactylException implements HttpExceptionInterface
class DisplayException extends PterodactylException
{
public const LEVEL_DEBUG = 'debug';
public const LEVEL_INFO = 'info';
@ -20,41 +16,57 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
public const LEVEL_ERROR = 'error';
/**
* DisplayException constructor.
* @var string
*/
public function __construct(string $message, ?\Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0)
protected $level;
/**
* Exception constructor.
*
* @param string $message
* @param string $level
* @param int $code
*/
public function __construct($message, Throwable $previous = null, $level = self::LEVEL_ERROR, $code = 0)
{
parent::__construct($message, $code, $previous);
$this->level = $level;
}
public function getErrorLevel(): string
/**
* @return string
*/
public function getErrorLevel()
{
return $this->level;
}
public function getStatusCode(): int
/**
* @return int
*/
public function getStatusCode()
{
return Response::HTTP_BAD_REQUEST;
}
public function getHeaders(): array
{
return [];
}
/**
* Render the exception to the user by adding a flashed message to the session
* and then redirecting them back to the page that they came from. If the
* request originated from an API hit, return the error in JSONAPI spec format.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
public function render(Request $request): JsonResponse|RedirectResponse
public function render($request)
{
if ($request->expectsJson()) {
return response()->json(Handler::toArray($this), $this->getStatusCode(), $this->getHeaders());
return response()->json(Handler::convertToArray($this, [
'detail' => $this->getMessage(),
]), method_exists($this, 'getStatusCode') ? $this->getStatusCode() : Response::HTTP_BAD_REQUEST);
}
app(AlertsMessageBag::class)->danger($this->getMessage())->flash();
return redirect()->back()->withInput();
}
@ -62,17 +74,19 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
* Log the exception to the logs using the defined error level only if the previous
* exception is set.
*
* @throws \Throwable
* @return mixed
*
* @throws \Exception
*/
public function report()
{
if (!$this->getPrevious() instanceof \Exception || !Handler::isReportable($this->getPrevious())) {
if (!$this->getPrevious() instanceof Exception || !Handler::isReportable($this->getPrevious())) {
return null;
}
try {
$logger = Container::getInstance()->make(LoggerInterface::class);
} catch (Exception) {
} catch (Exception $ex) {
throw $this->getPrevious();
}

View File

@ -3,18 +3,19 @@
namespace Pterodactyl\Exceptions;
use Exception;
use Throwable;
use PDOException;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Illuminate\Container\Container;
use Illuminate\Database\Connection;
use Illuminate\Http\RedirectResponse;
use Illuminate\Foundation\Application;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
@ -26,7 +27,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class Handler extends ExceptionHandler
{
/**
* The validation parser in Laravel formats custom rules using the class name
* Laravel's validation parser formats custom rules using the class name
* resulting in some weird rule names. This string will be parsed out and
* replaced with 'p_' in the response code.
*/
@ -34,6 +35,8 @@ class Handler extends ExceptionHandler
/**
* A list of the exception types that should not be reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
AuthenticationException::class,
@ -45,18 +48,10 @@ class Handler extends ExceptionHandler
ValidationException::class,
];
/**
* Maps exceptions to a specific response code. This handles special exception
* types that don't have a defined response code.
*/
protected static array $exceptionResponseCodes = [
AuthenticationException::class => 401,
AuthorizationException::class => 403,
ValidationException::class => 422,
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var string[]
*/
protected $dontFlash = [
'token',
@ -65,6 +60,16 @@ class Handler extends ExceptionHandler
'password_confirmation',
];
/**
* Maps specific internal exceptions to a valid HTTP status code.
*
* @var array
*/
protected static $statusCodeMap = [
AuthenticationException::class => Response::HTTP_UNAUTHORIZED,
ValidationException::class => Response::HTTP_UNPROCESSABLE_ENTITY,
];
/**
* Registers the exception handling callbacks for the application. This
* will capture specific exception types that we do not want to include
@ -73,13 +78,13 @@ class Handler extends ExceptionHandler
*
* @noinspection PhpUnusedLocalVariableInspection
*/
public function register(): void
public function register()
{
if (config('app.exceptions.report_all', false)) {
$this->dontReport = [];
}
$this->reportable(function (\PDOException $ex) {
$this->reportable(function (PDOException $ex) {
$ex = $this->generateCleanedExceptionStack($ex);
});
@ -88,7 +93,7 @@ class Handler extends ExceptionHandler
});
}
private function generateCleanedExceptionStack(\Throwable $exception): string
private function generateCleanedExceptionStack(Throwable $exception): string
{
$cleanedStack = '';
foreach ($exception->getTrace() as $index => $item) {
@ -119,9 +124,11 @@ class Handler extends ExceptionHandler
*
* @param \Illuminate\Http\Request $request
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, \Throwable $e): Response
public function render($request, Throwable $exception)
{
$connections = $this->container->make(Connection::class);
@ -138,7 +145,7 @@ class Handler extends ExceptionHandler
$connections->rollBack(0);
}
return parent::render($request, $e);
return parent::render($request, $exception);
}
/**
@ -146,8 +153,10 @@ class Handler extends ExceptionHandler
* calls to the API.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function invalidJson($request, ValidationException $exception): JsonResponse
public function invalidJson($request, ValidationException $exception)
{
$codes = Collection::make($exception->validator->failed())->mapWithKeys(function ($reasons, $field) {
$cleaned = [];
@ -169,9 +178,9 @@ class Handler extends ExceptionHandler
)),
];
$converted = $this->convertExceptionToArray($exception)['errors'][0];
$converted = self::convertToArray($exception)['errors'][0];
$converted['detail'] = $error;
$converted['meta'] = array_merge($converted['meta'] ?? [], $meta);
$converted['meta'] = is_array($converted['meta'] ?? null) ? array_merge($converted['meta'], $meta) : $meta;
$response[] = $converted;
}
@ -187,21 +196,19 @@ class Handler extends ExceptionHandler
/**
* Return the exception as a JSONAPI representation for use on API requests.
*/
protected function convertExceptionToArray(\Throwable $e, array $override = []): array
public static function convertToArray(Throwable $exception, array $override = []): array
{
$match = self::$exceptionResponseCodes[get_class($e)] ?? null;
$error = [
'code' => class_basename($e),
'status' => method_exists($e, 'getStatusCode')
? strval($e->getStatusCode())
: strval($match ?? '500'),
'detail' => $e instanceof HttpExceptionInterface || !is_null($match)
? $e->getMessage()
'code' => class_basename($exception),
'status' => method_exists($exception, 'getStatusCode')
? strval($exception->getStatusCode())
: strval(self::$statusCodeMap[get_class($exception)] ?? 500),
'detail' => $exception instanceof HttpExceptionInterface
? $exception->getMessage()
: 'An unexpected error was encountered while processing this request, please try again.',
];
if ($e instanceof ModelNotFoundException || $e->getPrevious() instanceof ModelNotFoundException) {
if ($exception instanceof ModelNotFoundException || $exception->getPrevious() instanceof ModelNotFoundException) {
// Show a nicer error message compared to the standard "No query results for model"
// response that is normally returned. If we are in debug mode this will get overwritten
// with a more specific error message to help narrow down things.
@ -210,19 +217,14 @@ class Handler extends ExceptionHandler
if (config('app.debug')) {
$error = array_merge($error, [
'detail' => $e->getMessage(),
'detail' => $exception->getMessage(),
'source' => [
'line' => $e->getLine(),
'file' => str_replace(Application::getInstance()->basePath(), '', $e->getFile()),
'line' => $exception->getLine(),
'file' => str_replace(Application::getInstance()->basePath(), '', $exception->getFile()),
],
'meta' => [
'trace' => Collection::make($e->getTrace())
->map(fn ($trace) => Arr::except($trace, ['args']))
->all(),
'previous' => Collection::make($this->extractPrevious($e))
->map(fn ($exception) => $e->getTrace())
->map(fn ($trace) => Arr::except($trace, ['args']))
->all(),
'class' => get_class($exception),
'trace' => explode("\n", $exception->getTraceAsString()),
],
]);
}
@ -233,7 +235,7 @@ class Handler extends ExceptionHandler
/**
* Return an array of exceptions that should not be reported.
*/
public static function isReportable(\Exception $exception): bool
public static function isReportable(Exception $exception): bool
{
return (new static(Container::getInstance()))->shouldReport($exception);
}
@ -242,42 +244,26 @@ class Handler extends ExceptionHandler
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return new JsonResponse($this->convertExceptionToArray($exception), JsonResponse::HTTP_UNAUTHORIZED);
return new JsonResponse(self::convertToArray($exception), JsonResponse::HTTP_UNAUTHORIZED);
}
return redirect()->guest('/auth/login');
return $this->container->make('redirect')->guest('/auth/login');
}
/**
* Extracts all the previous exceptions that lead to the one passed into this
* function being thrown.
* Converts an exception into an array to render in the response. Overrides
* Laravel's built-in converter to output as a JSONAPI spec compliant object.
*
* @return \Throwable[]
* @return array
*/
protected function extractPrevious(\Throwable $e): array
protected function convertExceptionToArray(Throwable $exception)
{
$previous = [];
while ($value = $e->getPrevious()) {
if (!$value instanceof \Throwable) {
break;
}
$previous[] = $value;
$e = $value;
}
return $previous;
}
/**
* Helper method to allow reaching into the handler to convert an exception
* into the expected array response type.
*/
public static function toArray(\Throwable $e): array
{
return (new self(app()))->convertExceptionToArray($e);
return self::convertToArray($exception);
}
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Exceptions\Http\Base;

View File

@ -12,15 +12,20 @@ use Pterodactyl\Exceptions\DisplayException;
*/
class DaemonConnectionException extends DisplayException
{
private int $statusCode = Response::HTTP_GATEWAY_TIMEOUT;
/**
* @var int
*/
private $statusCode = Response::HTTP_GATEWAY_TIMEOUT;
/**
* Every request to the Wings instance will return a unique X-Request-Id header
* which allows for all errors to be efficiently tied to a specific request that
* triggered them, and gives users a more direct method of informing hosts when
* something goes wrong.
*
* @var string|null
*/
private ?string $requestId;
private $requestId;
/**
* Throw a displayable exception caused by a daemon connection error.
@ -29,7 +34,7 @@ class DaemonConnectionException extends DisplayException
{
/** @var \GuzzleHttp\Psr7\Response|null $response */
$response = method_exists($previous, 'getResponse') ? $previous->getResponse() : null;
$this->requestId = $response?->getHeaderLine('X-Request-Id');
$this->requestId = $response ? $response->getHeaderLine('X-Request-Id') : null;
if ($useStatusCode) {
$this->statusCode = is_null($response) ? $this->statusCode : $response->getStatusCode();
@ -67,6 +72,8 @@ class DaemonConnectionException extends DisplayException
/**
* Override the default reporting method for DisplayException by just logging immediately
* here and including the specific X-Request-Id header that was returned by the call.
*
* @return void
*/
public function report()
{
@ -77,13 +84,18 @@ class DaemonConnectionException extends DisplayException
/**
* Return the HTTP status code for this exception.
*
* @return int
*/
public function getStatusCode(): int
public function getStatusCode()
{
return $this->statusCode;
}
public function getRequestId(): ?string
/**
* @return string|null
*/
public function getRequestId()
{
return $this->requestId;
}

View File

@ -0,0 +1,21 @@
<?php
namespace Pterodactyl\Exceptions\Http;
use Illuminate\Http\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
class QueryValueOutOfRangeHttpException extends HttpException
{
/**
* QueryValueOutOfRangeHttpException constructor.
*/
public function __construct(string $name, int $min, int $max, \Throwable $previous = null)
{
parent::__construct(
Response::HTTP_BAD_REQUEST,
'\"' . $name . '\" query parameter must be between ' . $min . ' and ' . $max,
$previous,
);
}
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Exceptions\Http\Server;

View File

@ -2,6 +2,7 @@
namespace Pterodactyl\Exceptions\Http\Server;
use Throwable;
use Pterodactyl\Models\Server;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
@ -11,13 +12,11 @@ class ServerStateConflictException extends ConflictHttpException
* Exception thrown when the server is in an unsupported state for API access or
* certain operations within the codebase.
*/
public function __construct(Server $server, \Throwable $previous = null)
public function __construct(Server $server, Throwable $previous = null)
{
$message = 'This server is currently in an unsupported state, please try again later.';
if ($server->isSuspended()) {
$message = 'This server is currently suspended and the functionality requested is unavailable.';
} elseif ($server->node->isUnderMaintenance()) {
$message = 'The node of this server is currently under maintenance and the functionality requested is unavailable.';
} elseif (!$server->isInstalled()) {
$message = 'This server has not yet completed its installation process, please try again later.';
} elseif ($server->status === Server::STATUS_RESTORING_BACKUP) {

Some files were not shown because too many files have changed in this diff Show More