Compare commits

...

524 Commits

Author SHA1 Message Date
Angelillo15 c332151c9a Merge branch 'release/v1.11.7' of https://github.com/pterodactyl/panel into release/v1.11.5 2024-05-11 17:11:39 +02:00
Angelillo15 235e1007f7
Update README.md 2024-05-08 16:18:24 +02:00
Pterodactyl CI 62b8a53165 ci(release): bump version 2024-05-08 04:17:09 +00:00
Matthew Penner 3a0b7d13a9
Update CHANGELOG.md 2024-05-07 22:13:13 -06:00
Matthew Penner a96d87cf23
Update README.md 2024-05-07 22:12:15 -06:00
Daniel Barton 049ad838e3
egg(minecraft): add Java 21 to image list (#5093) 2024-05-07 21:52:33 -06:00
Daniel Barton dbd7f31c41
Update Minecraft Eula link (#5090)
Co-authored-by: Alan Escarcha <alanescarcha11@gmail.com>
2024-05-06 18:50:06 -06:00
Daniel Barton 2ffe019675
ui(server): support for decompressing .7z files (#5016) 2024-05-04 17:16:00 -06:00
Matthew Penner 7bfc265a7e
api(remote): fix use of missing `node_id` field
Fixes #5088
2024-05-04 16:06:13 -06:00
Matthew Penner b7b2413f3d
Update CHANGELOG.md 2024-05-02 13:37:18 -06:00
Matthew Penner 96e6c66040
Update README.md 2024-05-02 13:22:31 -06:00
Matthew Penner 6dc85c731e
chore: update `SECURITY.md`
ref; https://github.com/pterodactyl/panel/pull/5074 which targets the
wrong branch
2024-04-16 15:17:36 -06:00
Matthew Penner 0dad4c5a48
ui(admin): better handling of manual HTML rendering 2024-04-11 10:47:00 -06:00
Matthew Penner b1fa3927c1
api(remote): fix oops in BackupStatusController 2024-04-11 10:42:18 -06:00
Matthew Penner f671046947
admin: tweaks to validation and rendering 2024-04-10 18:13:25 -06:00
Matthew Penner 319ca683f8
api(remote): ensure requesting node is checked 2024-04-10 17:38:09 -06:00
Matthew Penner 1172d71d31
app: improve `docker_image` validation 2024-04-10 17:22:29 -06:00
Matthew Penner 2497819ca7
Update README.md 2024-03-16 14:02:07 -06:00
Matthew Penner 787bf34a59
nix: update to php 8.2 2024-03-16 14:01:51 -06:00
Angelillo15 6592e8e1cb
release 1.11.5 2024-01-16 19:44:02 +01:00
Angelillo15 a5c52e1af5
Update docker.yaml 2024-01-16 18:58:28 +01:00
Matthew Penner f0489f677b
Update README.md 2023-12-29 22:09:21 -07:00
Matthew Penner 8abf2d8106
ui(server): fix defaultValue not being used with VariableBox select 2023-10-20 19:30:25 -06:00
Matthew Penner 341eda7855
egg(rust): change ordering of mod frameworks 2023-10-20 19:29:21 -06:00
Angelillo15 9678ae0037 Bump version 2023-10-17 22:33:15 +02:00
Angelillo15 d4ac089be8 Fix height 2023-10-17 22:32:54 +02:00
Angelillo15 7dcfb4426a Add release script 2023-10-17 22:25:08 +02:00
Angelillo15 7d58952a9b Put fork version 2023-10-17 21:51:44 +02:00
Angelillo15 5cea017833 Change branding in admin 2023-10-17 21:51:34 +02:00
Angelillo15 9979521c3a Change wheelchar -> cogs 2023-10-17 21:51:21 +02:00
Angelillo15 6b9dd72815 Fix progess bar 2023-10-17 21:51:04 +02:00
Angelillo15 fae1ac5ae8 Fix ProgressBar 2023-10-17 21:50:57 +02:00
Angelillo15 9c054b7af3 Change branding 2023-10-17 21:49:21 +02:00
Angelillo15 5694e2ae0c Make sidebar toggle button to only appear in sidebar pages 2023-10-17 21:49:14 +02:00
Angelillo15 7935e9f4a8 Fix sidebar css 2023-10-17 21:48:35 +02:00
Angelillo15 91364425ad Add NookTheme version 2023-10-17 21:48:24 +02:00
Angelillo15 f6cf39fb99 Disable host check 2023-10-17 21:48:15 +02:00
Angelillo15 54b1793e2d Merge remote-tracking branch 'upstream/release/v1.11.5' into release/v1.11.5 2023-10-16 16:32:56 +02:00
Angelillo15 40dd354b18 Merge branch 'release/v1.11.4' into release/v1.11.3 2023-10-14 21:02:03 +02:00
Pterodactyl CI 22629f4ab8 ci(release): bump version 2023-10-12 20:00:25 +00:00
Matthew Penner 742e352c67
Update CHANGELOG.md 2023-10-12 13:55:53 -06:00
Matthew Penner a62e8b1a67
egg(rust): use yolk image instead of the deprecated one 2023-10-12 13:54:42 -06:00
Angelillo15 6837384c19
Merge branch 'release/v1.10.4' into release/v1.11.3 2023-10-11 22:49:51 +02:00
Pterodactyl CI 35d49d3caa ci(release): bump version 2023-10-10 19:25:34 +00:00
Matthew Penner 35159b3715
Update CHANGELOG.md 2023-10-10 13:13:00 -06:00
Matthew Penner 7fa0c26d80
Update README.md 2023-10-02 17:06:05 -06:00
Boy132 5a417e9adb
app(setup): replace `mail` with `sendmail` driver (#4750) 2023-08-22 19:18:05 -06:00
Boy132 51cee7688a
app: update prune-backup command description (#4754) 2023-08-22 19:17:18 -06:00
Boy132 67b2d944a6
ui(client): allow MassActionBar to be clicked through (#4753) 2023-08-22 19:12:57 -06:00
Matthew Penner 57d27293d2
github(template): update paste domain (#4757)
Switch from `bin.ptdl.co` to `pteropaste.com`
2023-08-22 15:08:14 -10:00
Boy132 1af200c464 Replace `bin.ptdl.co` with `pteropaste.com`
ptdl.co always has cert issues. pteropaste is used anywhere else (e.g. in Discord bot commands)
Also increased the line number to 150.
2023-08-22 15:05:55 -10:00
Matthew Penner 97049f48c3
ui(server): hide sensitive information in copy-on-click notifications (#4761) 2023-08-22 15:04:35 -10:00
Vadym 2d4071ca25 do not show strings with password in notification text 2023-08-22 15:03:47 -10:00
Matthew Penner 5cd2697be3
api(client): allow setting empty server description
Closes https://github.com/pterodactyl/panel/issues/4752
2023-08-22 15:02:56 -10:00
Robert Nisipeanu 85f1259709 fix(4752): check if description field present on request 2023-08-22 15:01:49 -10:00
Matthew Penner bf1768406b
ui(server): fix permissions check on file manager (#4793) 2023-08-22 15:01:14 -10:00
Boy132 a83058668f only files check for "read-content", check folders for "read"
fixes #4792
2023-08-22 15:00:25 -10:00
Matthew Penner 987440c8ca
app: fix formatting 2023-08-22 18:59:34 -06:00
Matthew Penner 341fa0a52d
docker: fix log directory (#4839) 2023-08-22 14:59:12 -10:00
Michael Parker aa2f797f6f fix panel log folder
resolves #4838

Fixes an issue with the log symlink as well
2023-08-22 14:57:45 -10:00
Matthew Penner 04d83edd36
app: fix `getMySQLTimezoneOffset()` truncating seconds
Previously the `getMySQLTimezoneOffset()` function would truncate the
seconds part of a time offset (returning `+9:00` instead of `+9:30`) for
example. This only affects timezones with offsets that contain minutes.

Closes https://github.com/pterodactyl/panel/issues/4821
Superseeds https://github.com/pterodactyl/panel/pull/4827

Co-authored-by: danny6167 <daniel@barteck.com.au>
2023-08-22 18:54:59 -06:00
Matthew Penner 15860613b6
Update README.md 2023-08-22 18:50:11 -06:00
Angelillo15 a3b81929ab Fix navigation bar in mobile devices 2023-08-07 21:47:02 +02:00
Angelillo15 6169663f16 Fix readme.md 2023-08-07 16:08:00 +02:00
Angelillo15 da6f027324 Fix height of progress bar 2023-08-07 15:58:51 +02:00
Angelillo15 f173a5e496 Fix height and make smaller the icons height 2023-08-07 15:58:16 +02:00
Angelillo15 9b00a38d3c Added a clean before the build 2023-08-07 15:54:01 +02:00
Angelillo15 883bb53c5c Changed scrollbar color 2023-08-07 15:53:43 +02:00
Angelillo15 34a559f3e8 Added json clean command 2023-08-06 18:57:05 +02:00
Angelillo15 a6db4e2382 Edited the readme.md 2023-08-06 18:34:25 +02:00
Angelillo15 f5fda554fa Added icon bg 2023-08-06 18:10:29 +02:00
Angelillo15 bab2b21098 Edited colors of Networking statics 2023-08-05 13:37:01 +02:00
Angelillo15 f92af06eda Edited load bar 2023-08-05 13:36:39 +02:00
Angelillo15 6c624fd31b Added margin top of 4 2023-08-05 13:36:23 +02:00
Angelillo15 36ea087179 added topbar classname 2023-08-05 13:35:59 +02:00
Angelillo15 64dc2500a1 Added class nook-container 2023-08-05 13:35:42 +02:00
Angelillo15 d68c63c401 Remove margin and added top of 6vh 2023-08-05 13:35:27 +02:00
Angelillo15 7601e3fe76 added orange color 2023-08-05 13:35:01 +02:00
Angelillo15 4ac857da5b Added console 2023-08-04 23:53:40 +02:00
Angelillo15 8595f2a09a Added love command 2023-08-04 23:46:42 +02:00
Angelillo15 d2984af12c Change colors of Stat element in the panel 2023-08-04 23:27:50 +02:00
Angelillo15 f8312b1cb2 Added new icons to router 2023-08-04 20:33:10 +02:00
Angelillo15 d777b3b55e Change account router 2023-08-04 20:32:58 +02:00
Angelillo15 6c04718c35 Change content container class to use sidebar 2023-08-04 20:24:08 +02:00
Angelillo15 099cda8ebb Change className 2023-08-04 20:23:27 +02:00
Angelillo15 72d086d292 Added sidebar id to the id list 2023-08-04 20:23:14 +02:00
Angelillo15 860b337b1f Added NavBar buttons 2023-08-04 20:22:50 +02:00
Angelillo15 638bf4cb59 added content container 2023-08-04 20:22:31 +02:00
Angelillo15 aa13ce4698 Implements new ServerRouter 2023-08-04 19:23:13 +02:00
Angelillo15 da0be11d29 Deleted Sidebar from dashboard 2023-08-04 19:22:54 +02:00
Angelillo15 dc6b5e704f Create SideBar with Children props 2023-08-04 19:22:32 +02:00
Angelillo15 cc4c5eac21 Added icon prop 2023-08-04 19:22:12 +02:00
Angelillo15 ae53bd8034 Added icon 2023-08-04 19:21:53 +02:00
Matthew Penner 3cd15d6f21
ci(docker): skip login on pull requests 2023-07-11 20:52:09 -06:00
Matthew Penner 29783ed240
egg(rust): add support for Carbon
Rebased version of #4734 to 1.0-develop
2023-07-11 20:37:14 -06:00
Angelillo15 37b9ef5585 Add sidebar base logic 2023-07-09 03:02:17 +02:00
Angelillo15 6d8f76dec5 Change background colors 2023-07-08 22:54:58 +02:00
Angelillo15 80f51e0af2 Addapt dev settings 2023-07-08 22:48:06 +02:00
Matthew Penner 7c8bdfc4d8
Update README.md 2023-06-28 20:23:53 -06:00
Matthew Penner b23f3114e4
Update README.md 2023-05-12 23:08:43 -06:00
Matthew Penner 8bfcffc477
Update README.md 2023-03-11 14:11:34 -07:00
Matthew Penner 1d38b4f0e2
Laravel 10 (#4706) 2023-02-23 12:30:16 -07:00
Matthew Penner ad4ddc6300
nix: update flake 2023-02-23 12:24:47 -07:00
Devonte W b746c3ead1
fix(api/client): add validation for backup request body (#4704) 2023-02-23 12:23:12 -07:00
Devonte W aea5c474db
fix(resources/api): allow svg xml format (#4705) 2023-02-23 12:19:58 -07:00
Matthew Penner 2a7833ca17
Update README.md 2023-02-06 10:22:21 -07:00
Alex 9b47403e00
egg(rust): add server.queryport option (#4681) 2023-02-04 14:42:04 -07:00
Pterodactyl CI a99941eb2b ci(release): bump version 2023-01-27 19:26:50 +00:00
Matthew Penner 43f7c10617
Update CHANGELOG.md 2023-01-27 12:24:55 -07:00
Matthew Penner 866b6df4b0
api(task): ensure `sequence_id` always starts at `1` 2023-01-24 16:19:34 -07:00
Matthew Penner 2b14e46eec
api: fix `sequence_id` being ignored in server task API
Closes #4434
2023-01-24 15:57:24 -07:00
Matthew Penner 20f23a0b27
db: add `uuid` column to `failed_jobs` table
Refer to
<https://laravel.com/docs/8.x/upgrade#failed-jobs-table-batch-support>
for more information regarding this change.

Closes #4652
2023-01-24 14:02:41 -07:00
Matthew Penner a27ea3d1bc
config(queue): default to `redis` driver
Updates the default `QUEUE_CONNECTION` value to be `redis`
instead of `sync`.  This can cause problems if users skip
the initial setup or select the prefilled options rather
than the recommended ones.

Closes #4660
2023-01-24 13:48:34 -07:00
Matthew Penner fbdac5b63f
ui(server): fix `reinstall_failed` conflict state 2023-01-17 15:21:31 -07:00
Jelco c74314d2ab
Fix file repository not catching 404 responses (#4637) 2023-01-17 15:12:22 -07:00
Matthew Penner dd595437e6
Update README.md, fix CI status badge 2023-01-17 15:06:56 -07:00
Boy132 2ed7f1c912
Fix `MAIL_FROM_ADDRESS` in EmailSettingsCommand (#4648) 2023-01-17 15:01:53 -07:00
Matthew Penner a2fb319ff5
Update README.md sponsors 2023-01-01 15:26:38 -07:00
Omar Kamel e43da311fe
api(client): keep existing server description when empty (#4619) 2022-12-14 14:19:45 -07:00
Matthew Penner ac53e7b061
Update CHANGELOG.md 2022-12-12 16:09:09 -07:00
Matthew Penner 8978da335e
app(telemetry): disable server_usage for eggs and nests 2022-12-12 16:07:33 -07:00
VibeGAMESNL 680bce6d94
api(client): fix decompress timeout (#4568) 2022-12-12 16:07:13 -07:00
Matthew Penner 428311e854
database: fix mail settings migration 2022-12-12 15:47:48 -07:00
Matthew Penner 6df31e1923
database: fix migration transaction failure? 2022-12-12 15:26:47 -07:00
Matthew Penner c8c648f0e5
php-cs-fixer 2022-12-12 15:14:37 -07:00
Matthew Penner 0751eeec97
database: add migration for new mail config keys 2022-12-12 15:12:03 -07:00
Matthew Penner 24e1c56378
Update SECURITY.md 2022-12-12 14:35:24 -07:00
Matthew Penner 4626118d77
app: fix remaining email config keys 2022-12-12 14:31:49 -07:00
Matthew Penner 6377e3309a
config(queue): fix queue names 2022-12-12 14:29:19 -07:00
Matthew Penner c14fc1ccb0
config(mail): fix SERVER_NAME; closes #4600 2022-12-12 14:26:07 -07:00
Matthew Penner 63a179d7f3
app: fix email config keys 2022-12-12 14:21:47 -07:00
Matthew Penner 3432cadd4a
ci(docker): fix version starting with `v` prefix 2022-12-05 15:43:10 -07:00
Matthew Penner 411017198e
Update CHANGELOG.md 2022-12-05 13:16:03 -07:00
Matthew Penner e763c72d63
ci(docker): fix version in app.php 2022-12-05 12:39:07 -07:00
Matthew Penner a2970cd784
ci: tweak docker and release workflows 2022-12-05 09:58:13 -07:00
Matthew Penner ca4aa795be
ci(docker): fix latest tag 2022-12-04 18:37:45 -07:00
Matthew Penner c802b49b7a
ci(docker): fix app version 2022-12-04 18:36:26 -07:00
Matthew Penner 7d93f1566c
ci: overhaul workflows 2022-12-04 17:40:17 -07:00
Matthew Penner 598c956e4e
ui(server): fix file uploads being canceled instead of completed 2022-12-04 16:36:53 -07:00
Matthew Penner 158facd534
eslint: fix prettier config 2022-12-04 16:32:15 -07:00
Matthew Penner dd69652942
Fix `No application encryption key has been specified` error while trying to generate said key 2022-12-04 16:09:42 -07:00
Matthew Penner 73b27aea8e
Update CHANGELOG.md 2022-12-04 15:27:21 -07:00
Matthew Penner fa7503816a
Add telemetry prompt in `p:environment:setup` command 2022-12-04 14:59:45 -07:00
Matthew Penner 250c557e23
telemetry: include more detailed server egg and nest usage 2022-12-01 12:09:27 -07:00
Matthew Penner 6272bb6710
api(remote): cleanup 2022-12-01 11:52:22 -07:00
Matthew Penner 3c278a8c51
api(remote): check if transfer is present before trying to update status 2022-12-01 11:51:26 -07:00
Matthew Penner 794248d4d7
routes: fix imports 2022-12-01 11:51:26 -07:00
Wunderharke c8f7bdf9cb
egg(teamspeak): fix database support (#4513) 2022-11-28 12:04:56 -07:00
TaktischerSpeck 75f36839df
egg(teamspeak): port and argument updates (#4546) 2022-11-28 11:59:48 -07:00
Charles Morgan a4e547dc67
ui(server): fix console searchbar z-index (#4587) 2022-11-27 19:38:28 -07:00
Matthew Penner 1bb1b13f6d
Update CHANGELOG.md 2022-11-22 13:40:58 -07:00
Matthew Penner 5b36313c57
Update README.md 2022-11-22 13:39:57 -07:00
Matthew Penner ee033d6d08
Telemetry (#4564) 2022-11-22 13:39:43 -07:00
Dane Everitt df9a7f71f9
Support canceling file uploads (#4441)
Closes #4440
2022-11-21 13:58:55 -07:00
Lance Pioch a4f6870518
server: track reinstall failures differently from initial install failures (#4531) 2022-11-21 13:53:54 -07:00
Matthew Penner 039ad4abf0
api(server): log activity when server description is changed 2022-11-21 13:43:19 -07:00
Devonte W 634c9353e3
fix(transformers): force object type for properties (#4544) 2022-11-21 13:28:46 -07:00
Matthew Penner c3521e0221
api(server): fix undefined header 2022-11-21 13:20:50 -07:00
Matthew Penner 2f4a60c961
ui(admin): change `MB` suffixes to `MiB`
Closes #4542
2022-11-21 13:10:00 -07:00
Matthew Penner c1584d9a5b
Update CHANGELOG.md 2022-11-14 20:31:03 -07:00
Matthew Penner 897ca48ded
github: re-enable blank issues 2022-11-14 18:28:02 -07:00
Matthew Penner df2402b54f
Streaming Transfers (#4548) 2022-11-14 18:25:07 -07:00
Boy132 032e4f2e31
Apply node maintenance mode to servers (#4421) 2022-11-06 16:02:30 -07:00
Lance Pioch 4032481a4f
Update validation rules for remote activity logs (#4526) 2022-11-06 15:42:48 -07:00
Lance Pioch 9b218f2190
URL encode password in JDBC connection string (#4527) 2022-11-06 15:24:33 -07:00
Alex c068f57e4e
fix(forge): validate only input and not length (#4528)
Only allows digits, dots and dashes in the input, which is what Forge versions consists of. Removes arbitrary char limit.
2022-11-06 15:15:12 -07:00
Matthew Penner f8ec8b4d5a
Merge branch 'develop' into 1.0-develop 2022-10-31 12:10:04 -06:00
Matthew Penner d466934103
Laravel Sail (#4508) 2022-10-31 11:38:56 -06:00
Matthew Penner 846ff7644f
Fix missing email sender 2022-10-31 11:02:34 -06:00
Matthew Penner b7a65436fa
Merge branch '1.0-develop' into develop 2022-10-31 10:59:35 -06:00
Matthew Penner 1b78030291
Fix compatibility with old queue names 2022-10-31 10:58:32 -06:00
Quinten e21aab2537
Update mumble egg (#4437) 2022-10-31 10:29:29 -06:00
Lance Pioch 16c2b606b4
Add ManifestDoesNotExistException and Solution (#4455)
Co-authored-by: Matthew Penner <matthew@pterodactyl.io>
2022-10-31 10:29:10 -06:00
Boy132 f2095e815e
Allow users to change the server description (#4420) 2022-10-31 10:20:53 -06:00
Matthew Penner b1abae8106
Update README.md 2022-10-30 13:58:29 -06:00
Lance Pioch 548affba84
Fix linting (#4504) 2022-10-29 17:58:55 -06:00
Matthew Penner 5f57e63fe4
ci(lint): install composer dependencies 2022-10-26 10:45:43 -06:00
Matthew Penner 6f0bb43314
ci: cleanup, add dedicated lint workflow 2022-10-26 10:43:05 -06:00
Jelco 5c78b380c5
Fix InMemoryFilesystemAdapter (#4489) 2022-10-26 10:26:56 -06:00
Matthew Penner d31ece1c75
nix: add flake with dev shell 2022-10-24 09:48:30 -06:00
Lance Pioch e49ba65709
Fix config key names (#4464) 2022-10-23 18:51:20 -06:00
Matthew Penner 7266c66ebf
un-type getRulesForUpdate; fixes #4463 2022-10-23 18:14:50 -06:00
Lance Pioch 860b2d890b
Fix `php artisan up` (#4457) 2022-10-21 11:31:59 -06:00
Matthew Penner 5331fd2cdb
ci(docker): build local code checkout, add caching to dev build 2022-10-20 14:32:23 -06:00
Matthew Penner 4dd30fe2f0
composer: update lock 2022-10-19 22:47:53 -06:00
Dane Everitt d1beb2e1ad
Fix file verification on upload; just block folders (#4442) 2022-10-16 17:24:49 -06:00
Matthew Penner 9c6822f62d
Update CHANGELOG.md 2022-10-16 12:34:36 -06:00
Pterodactyl CI d0974b0066 bump version for release 2022-10-16 18:23:08 +00:00
Matthew Penner 2828a4b1e0
fix AssetManifestService error when loading the panel 2022-10-14 11:00:10 -06:00
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00
Matthew Penner 95e15d2c8a
Cleanup FQDN validation logic, fallback to old hostname check (#4409)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-09 16:19:16 -06:00
Dane Everitt c748fa9842
fix: exclude any permissions not defined internally when updating or creating subusers (#4416) 2022-10-09 16:14:16 -06:00
Cubxity 597821b3bb
fix: byte units (#4419) 2022-10-09 16:09:24 -06:00
Dane Everitt e0e0689846
feat: bump account key limit to 25 (#4417)
Closes #4394
2022-10-08 15:14:03 -06:00
DaneEveritt 2e61a4db13
fix: eslint errors 2022-10-08 11:30:14 -07:00
Matthew Penner ba10646e8a
Update CONTRIBUTING.md and SECURITY.md 2022-10-05 10:31:06 -06:00
Matthew Penner ac8629d449
Update CHANGELOG.md 2022-10-04 20:49:03 -06:00
Devonte 9b531d5fd9
Include `oom_disabled` in application API request (#4262) 2022-10-04 20:12:46 -06:00
Aspect d7b387be3e
Show UptimeDuration for starting servers (#4284) 2022-10-04 20:12:07 -06:00
Matthew Penner 7b91c38396
Lookup both A and AAAA records for node FQDNs (#4398)
Allows IPv6 addresses to be used, instead of IPv4 being required.

Closes <https://github.com/pterodactyl/panel/issues/4011>
2022-10-04 20:03:52 -06:00
Matthew Penner 815e1e4c4d
Ensure server is not in a conflicting state before initiating a transfer (#4403) 2022-10-04 19:57:24 -06:00
Matthew Penner ff37c51eef
Use different clone logic for arrays (#4402)
Closes <https://github.com/pterodactyl/panel/issues/3985>
2022-10-04 19:48:08 -06:00
Matthew Penner 44598bf724
Support configuring storage class for S3 backup uploads (#4399)
Closes <https://github.com/pterodactyl/panel/issues/4072>
2022-10-04 19:39:25 -06:00
diamkil 6aede6b63d
Allow uploading multiple files via web UI (#4392) 2022-09-29 17:43:20 -06:00
Matthew Penner 16c110a489
Update FUNDING.yml 2022-09-26 11:23:48 -06:00
Matthew Penner 2dcc46ecd6
backups: support Cloudflare R2 by listing uploaded parts from Wings 2022-09-26 11:15:52 -06:00
Matthew Penner 0dc77aec25
Update README.md 2022-09-25 19:12:08 -06:00
Matthew Penner 9bcafd983f
admin: fix rendering of egg descriptions 2022-09-25 19:00:49 -06:00
Pascal Zarrad 1ca4b08b48
backups: add S3 part size configuration (#4382) 2022-09-25 14:38:49 -06:00
Matthew Penner 68e9100e57
admin(eggs): add `force_outgoing_ip` option (#4323)
Closes #3841
2022-09-25 13:24:54 -06:00
Boy132 b04a47a4a4
Handle "in:true,false" variable rules as checkbox (#4334) 2022-09-25 13:18:13 -06:00
Matthew Penner 8e1a21563e
server: add configuration for install notifications (#4331)
* server: track `installed_at`, only send install notification on first install
* server: add configuration for install notifications
2022-09-25 13:16:58 -06:00
SS 23124c9b08
docker: update README.md (#4388) 2022-09-25 13:11:45 -06:00
Harry W a6b250913b
fix: page title for SSH keys (#4391) 2022-09-25 13:05:53 -06:00
DaneEveritt e040fd1ebd
Fix display of database rows when password is not available
closes #4381
2022-09-17 11:50:40 -07:00
DaneEveritt bf2456d0fc
Ensure eggs endpoint always returns an object, even when empty
closes #4296
2022-09-17 11:36:41 -07:00
Cam White (Jex) b050174f90
Bump fork-ts-checker-webpack-plugin to 6.5.2 (#4357) 2022-09-05 14:01:03 -04:00
hz-ad ab08afb2da
Updating sponsors (#4345) 2022-09-01 15:47:17 -04:00
DaneEveritt be29fe1db2
Break activity log values ignoring word boundaries
Not my favorite approach, but it'll work. closes #4305
2022-08-07 15:00:43 -04:00
DaneEveritt 2da8042b0f
Fix `clock()` usage causing errors in prod environments 2022-07-24 20:43:14 -04:00
DaneEveritt 07f1ef4262
Update security versions 2022-07-24 19:45:49 -04:00
DaneEveritt f614b443dd
Update CHANGELOG.md 2022-07-24 19:37:15 -04:00
DaneEveritt 03a6e26c4d
Improve create directory dialog 2022-07-24 19:23:45 -04:00
DaneEveritt 8d82aa2124
Improve design of drag & drop overlay 2022-07-24 18:59:20 -04:00
DaneEveritt 4458822c60
Cleanup file upload behavior 2022-07-24 18:50:47 -04:00
DaneEveritt 1cfa4100ad
Show an error if a user attempts to upload a folder 2022-07-24 18:22:50 -04:00
DaneEveritt 1d5d92f678
Use a different styling for file uploads 2022-07-24 18:03:45 -04:00
Boy132 12242848b0
File upload status (v2 backport) (#4219) 2022-07-24 17:18:32 -04:00
DaneEveritt 2eda1995b9
Send server name and description to wings to make available to replacers 2022-07-24 17:15:24 -04:00
DaneEveritt abac317802
Make recaptcha domain configurable 2022-07-24 17:13:17 -04:00
DaneEveritt f8c48214a5
Track file uploads on Wings, not the panel 2022-07-24 17:13:17 -04:00
Alex 6a11c32bb2
fix: do not style 2fa QR code (#4278)
Dark rounded background shadow around the QR code makes it more difficult or impossible to scan on some devices. Replaces it with a white shadow to make easier scanning.
2022-07-24 17:10:59 -04:00
Michael (Parker) Parker eb503c5523
fix docker builds (#4249)
Updates php to 8.1
Resolves the issue when running docker-compose unconfigured redirects to https.
2022-07-16 08:48:40 -04:00
simonmicro 1250713299
Changed scroll down indicator icon (#4231)
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2022-07-16 08:48:10 -04:00
Simon Stjernholm 5700dd6a8e
fixes loading overlay to console only (#4246)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-07-16 08:30:00 -04:00
DaneEveritt d4708e9e63
Always show IP address to admins 2022-07-10 14:56:19 -04:00
DaneEveritt d6c30092ec
Utilize a unique ID for activity logs to improve rendering perf 2022-07-10 14:53:29 -04:00
DaneEveritt e878015109
Correctly wrap content in pre tag so it doesn't overflow 2022-07-10 14:53:15 -04:00
DaneEveritt edbbe520a7
Fix missing padding on overflowing dialogs 2022-07-10 14:52:57 -04:00
DaneEveritt 7558c0380e
Don't log SFTP logins, it just is noisy 2022-07-10 14:30:11 -04:00
DaneEveritt 8b59c1c1a8
Support new sftp event types 2022-07-10 13:47:19 -04:00
DaneEveritt 33ab762f5a
Add support for tracking more SFTP specific events 2022-07-09 19:30:38 -04:00
DaneEveritt 2e01891074
Account for natural event naming 2022-07-09 17:53:07 -04:00
DaneEveritt 1eee55b27c
Add endpoint needed for recieving and processing activity 2022-07-09 17:45:38 -04:00
DaneEveritt 9b8479e85d
Update README.md 2022-07-09 12:01:24 -04:00
DaneEveritt 26d7d7e0e0
Fix SWR key logic 2022-07-04 18:22:58 -04:00
DaneEveritt d6b6ac6dab
Key activity log cache to the server instance, not the user instance. 2022-07-04 18:13:15 -04:00
DaneEveritt 4a8c3c4a34
Add activity tracking for console/power actions 2022-07-04 18:11:53 -04:00
DaneEveritt dc90d8b505
Include the "user_uuid" claim on JWTs for easier Wings user tracking 2022-07-04 17:34:56 -04:00
DaneEveritt 74c3b00828
Update CHANGELOG.md 2022-07-03 19:51:12 -04:00
DaneEveritt 15aaa2b3c3
Fix display issues due to removal of quirks mode 2022-07-03 14:44:00 -04:00
DaneEveritt 0216e3fd5b
Don't log activity if the email wasn't actually changed 2022-07-03 14:29:01 -04:00
DaneEveritt 2d836156d2
Update totp disable modal; require password for enable operation 2022-07-03 14:27:37 -04:00
DaneEveritt 92926ca193
Cleanup logic powering totp enabling modal 2022-07-03 13:43:54 -04:00
DaneEveritt a4feed24a8
Improve dialog logic, add "asDialog" helper 2022-07-03 13:29:23 -04:00
DaneEveritt 822949408f
Use new two-step configuration modal 2022-07-02 18:53:03 -04:00
DaneEveritt 870a964050
Fix checkboxes 2022-07-02 18:27:29 -04:00
DaneEveritt e49e6ee802
Better dialog setting logic 2022-07-02 18:27:22 -04:00
DaneEveritt 7a6440988b
Support tooltip on disabled buttons, support click action 2022-07-02 17:24:49 -04:00
DaneEveritt 25d61525b3
Update new input styling 2022-07-02 17:24:24 -04:00
DaneEveritt 7c4028f8f1
Update dialog logic to support defining buttons/icon from anywhere 2022-07-02 17:24:12 -04:00
DaneEveritt 48af9bced1
Fix activity log rendering; closes #4208 2022-06-30 21:06:50 -04:00
DaneEveritt 0d0c595909
Show starting/stopping correctly in stats; closes #4209 2022-06-30 20:33:09 -04:00
DaneEveritt 3120e1d4a0
Fix console rendering on Safari; closes #4189 2022-06-30 20:30:01 -04:00
Boy132 003afb271b
fix: java version modal default value (#4216) 2022-06-30 20:23:40 -04:00
VinGal cc06d1faa9
Fixes rounding when 0.001% or less on CPU usage. (#4207) 2022-06-30 20:23:27 -04:00
Arnaud Lier ccea09c9d9
Enable standards mode (#4194) 2022-06-30 20:23:15 -04:00
DaneEveritt 4fa735da3f
Update CHANGELOG.md 2022-06-27 21:01:24 -04:00
DaneEveritt 20a7794a18
Fix incorrect type definitions 2022-06-27 20:54:58 -04:00
DaneEveritt 4aa163b76f
Hide IP addresses from activity logs not generated by the user themselves 2022-06-27 20:52:27 -04:00
DaneEveritt b570769a34
Fix permission matching on routes; closes #4181 2022-06-27 20:41:49 -04:00
DaneEveritt bd278b2688
Fix install warning display and make it reactive 2022-06-27 20:36:24 -04:00
Boy132 2dda151a49
fix: correct route for console (#4178)
fixes #4177
2022-06-27 20:21:12 -04:00
DaneEveritt 7886251cd8
Fix infinity display 2022-06-27 20:16:43 -04:00
DaneEveritt 050d4e7a36
Show the resource limits next to numbers 2022-06-27 20:14:55 -04:00
DaneEveritt 5f156e193a
Improve the graph display; hide the bottom bar when no data exists. 2022-06-27 19:59:36 -04:00
DaneEveritt bf287c45d6
Logic improvements, move stat blocks to right side 2022-06-27 19:56:26 -04:00
DaneEveritt ad6e9f076b
Fix copy to clipboard when clicking server address
closes #4187
2022-06-27 19:18:58 -04:00
DaneEveritt 72f545259f
Roll back changes to conversion unit (1000->1024)
closes #4183
2022-06-27 18:46:36 -04:00
Ziga Zajc 1b5d77dc17
Changed Mb to MB (#4171) 2022-06-27 18:30:46 -04:00
Boy132 ac997cd7a6
fix: use correct network stat (#4175) 2022-06-27 18:30:21 -04:00
Boy132 63cf6ee96e
fix: round cpu usage in chart (#4182)
fixes #4168
2022-06-27 18:30:00 -04:00
DaneEveritt 16725e656b
Bundle the new eslintrc config file 2022-06-26 21:18:53 -04:00
Argonaut Network 9bcf90db93
Fix grammatical error (#4138) 2022-06-26 21:17:02 -04:00
Torsten Widmann 8f2defc6f8
add new map to description (#4142) 2022-06-26 21:16:39 -04:00
Alex 3339a316ca
feat: use max percentage instead of xmx (#4146)
Replaces Xmx with a percentage-based argument, in this case leaving 5% overhead.

Resolves issue of container OOM/freezing when all memory is allocated to the java application or when users attempt to use unlimited memory of 0. That's because all the allocated memory is set to Xmx by default. Causes Wings resource overhead allocation to be unnecessary.

Expands Forge installer exit code to provide instructions regarding increasing Wings installer resource limits when using unlimited memory (0) as the default 1024MB is not enough to run the installer.

The percentage is set as a floating point, because of a JDK 8 bug with integers
2022-06-26 21:16:26 -04:00
DaneEveritt c9ab0abba9
Use node 16 for all build actions 2022-06-26 21:09:40 -04:00
DaneEveritt 446562fcff
Update NodeFactory.php 2022-06-26 21:00:19 -04:00
DaneEveritt 80ae600fe1
Correctly update dependencies for release 2022-06-26 17:31:47 -04:00
DaneEveritt 13bdb66ff0
Revert "Package updates prior to release"
This reverts commit af2a84d379.
2022-06-26 17:19:12 -04:00
DaneEveritt af2a84d379
Package updates prior to release 2022-06-26 17:11:55 -04:00
DaneEveritt 3f2bd78563
Generate a more unique username 2022-06-26 16:37:43 -04:00
DaneEveritt 43156e8d53
Improve error messaging for validation exceptions 2022-06-26 16:31:48 -04:00
DaneEveritt 271197e823
Fix cs-fix run 2022-06-26 16:21:07 -04:00
DaneEveritt c166f1305b
Remove unused deps 2022-06-26 16:14:32 -04:00
DaneEveritt d172d2829f
Update CHANGELOG.md 2022-06-26 15:42:11 -04:00
DaneEveritt fc6c8f1d82
remove old eslint config 2022-06-26 15:30:30 -04:00
DaneEveritt 922d75f471
fix remaining eslint error 2022-06-26 15:30:05 -04:00
DaneEveritt dc84af9937
Apply new eslint rules; default to prettier for styling 2022-06-26 15:13:52 -04:00
DaneEveritt f22cce8881
Update eslint parsers for new typescript version 2022-06-26 14:38:58 -04:00
DaneEveritt 1eb3ea2ee4
Some code cleanup, add jest coverage and begin using it for utility functions 2022-06-26 14:34:09 -04:00
DaneEveritt ca39830333
allow filtering servers by description; closes #4150 2022-06-26 13:26:12 -04:00
DaneEveritt b3a57bd0ad
fix includes for client API keys on admin accounts; closes #4164 2022-06-26 13:23:22 -04:00
DaneEveritt 82d8713b5d
Fix allocation display when a description is present 2022-06-25 21:41:52 -04:00
DaneEveritt 47d6235ea0
Keep server address at the top 2022-06-25 21:31:10 -04:00
DaneEveritt 00338e431b
Automatically hide the kill modal when server stops 2022-06-25 21:29:41 -04:00
DaneEveritt 76f3b996fe
Auto resize values when they'd overflow the container 2022-06-25 21:27:18 -04:00
DaneEveritt 182507ff0e
Upgrade charts to ChartJS 3 and improve UI for them 2022-06-25 20:51:49 -04:00
Dane Everitt 980f828edd
Update README.md 2022-06-24 10:51:39 -04:00
DaneEveritt 54c619e6ba
Some mobile improvements for the UI; make console fill space better 2022-06-21 18:43:59 -04:00
DaneEveritt faff263f17
First pass at new server console design 2022-06-20 17:26:47 -04:00
DaneEveritt 61018b5e67
Update more of the UI to use new design elements 2022-06-20 15:28:27 -04:00
DaneEveritt 2824db7352
Update file manager design a bit 2022-06-20 14:16:42 -04:00
DaneEveritt 8bd518048e
Fix excessive re-rendering due to route changesd 2022-06-20 13:19:40 -04:00
DaneEveritt 7b0e2ce99d
Button styling cleanup, prop consistency 2022-06-20 12:38:23 -04:00
DaneEveritt 7dd74ecc9d
Modal cleanup, begin transitioning towards the new dialog 2022-06-20 11:17:33 -04:00
DaneEveritt 3834aca3fe
Use nicer avatars when showing activity log 2022-06-19 13:46:15 -04:00
DaneEveritt 76472411e3
Some better activity translations 2022-06-18 16:36:19 -04:00
DaneEveritt cf01490883
Support hiding activity from admin accounts not associated with the server 2022-06-18 15:48:22 -04:00
DaneEveritt 95de4c30fc
Abuse the translation engine to handle more of the formatting for us 2022-06-18 15:28:42 -04:00
DaneEveritt b052d29a5f
Fix failing integration test 2022-06-18 14:25:24 -04:00
DaneEveritt 7224ca81de
Fix bug preventing the creation of API keys with CIDR ranges 2022-06-18 14:21:20 -04:00
DaneEveritt d47a05881b
Show when an event was triggered via the API directly 2022-06-18 12:52:26 -04:00
DaneEveritt 4f3651b578
Fix typo with identifier 2022-06-18 12:16:54 -04:00
DaneEveritt 0520014c0f
Add support for tracking when an activity event is triggered from an API key 2022-06-18 12:07:44 -04:00
DaneEveritt 92c1c162af
Code cleanup for facades 2022-06-18 12:07:32 -04:00
DaneEveritt 6ffe5730da
Log when an API key is blocked due to IP restrictions 2022-06-18 12:04:51 -04:00
DaneEveritt 0be96cfd26
Update README.md 2022-06-16 20:36:15 -04:00
DaneEveritt cd97936179
Improve mobile support 2022-06-12 15:40:14 -04:00
DaneEveritt 68a654f9e8
Selectively show the additional metadata if it isn't in the display string at all 2022-06-12 15:30:49 -04:00
DaneEveritt 88987fb6c7
Correctly pull button styles 2022-06-12 15:17:14 -04:00
DaneEveritt 2f1c8ae91d
Add basic server activity log view 2022-06-12 15:16:48 -04:00
DaneEveritt 0b4936ff1c
Break out rows for activity; show metadata icon 2022-06-12 15:08:26 -04:00
DaneEveritt 33823b65de
Fix dialog and tooltip design 2022-06-12 15:07:52 -04:00
DaneEveritt 064a942574
Little bit of language cleanup 2022-06-12 13:36:42 -04:00
DaneEveritt b50e722948
Add account related routes to router file 2022-06-12 13:33:25 -04:00
DaneEveritt 7197d28815
Chunk out the different routers and clean up feature logic 2022-06-12 11:56:00 -04:00
DaneEveritt 04e97cc67e
Make it easier for plugins to extend the navigation and add routes 2022-06-12 11:36:55 -04:00
DaneEveritt 88a7bd7578
Make the delay less goofy when mousing over elements 2022-06-12 09:39:20 -04:00
DaneEveritt f860fd2cfe
Improve usability of icon buttons in header with tooltip 2022-06-12 09:35:02 -04:00
DaneEveritt 9c957952fb
Improve mobile display of activity log 2022-06-12 09:09:01 -04:00
DaneEveritt 4d30cc9e7e
Add translation values to activity log output 2022-06-11 14:52:41 -04:00
DaneEveritt 06427f8d13
Don't make two API calls for activity log data 2022-06-11 14:52:33 -04:00
DaneEveritt 986c375052
Improve support for use of i18next; rely on browser caching to keep things simple 2022-06-11 14:04:09 -04:00
DaneEveritt 8e02966935
Use a normal HTML tag for this 2022-06-11 11:05:03 -04:00
DaneEveritt e17c2ec262
Add base activity log strings 2022-06-11 11:03:40 -04:00
DaneEveritt 278d8b7bf6
Update CHANGELOG.md 2022-06-11 10:04:44 -04:00
DaneEveritt 0bfba306bf
Add filtering support for activity logs 2022-06-05 19:23:25 -04:00
DaneEveritt c6e8b893c8
Add basic activity log view 2022-06-05 18:35:53 -04:00
DaneEveritt d1da46c5aa
Fix incorrect API definitions 2022-06-05 18:28:08 -04:00
DaneEveritt 2a2fc42e37
Add support for tooltips 2022-06-05 18:27:54 -04:00
DaneEveritt 1a5465dc34
Update react, add some V2 components for V1 usage 2022-06-05 14:56:42 -04:00
DaneEveritt 921da09a63
Update to Tailwind 3; support normal tailwind usage without twin.macro 2022-06-05 14:34:29 -04:00
DaneEveritt 21ca91abd0
Allow SES region configuration; closes #4124 2022-06-05 13:32:36 -04:00
DaneEveritt 8771597560
Fix database deletion; closes #4114
Co-Authored-By: Dawid <minerpl03@gmail.com>
2022-06-05 13:28:46 -04:00
Harry W c0a3dea6d8
Disable autocapitalization on console input (#4120) 2022-06-05 13:22:41 -04:00
Kevin Brekelmans 7743d00aee
Update README.md (#4104) 2022-05-30 18:18:10 -04:00
DaneEveritt 03a497fb8a
Use a post request to delete SSH keys, some hashes use slashes which cause 404 errors; closes #4100 2022-05-30 17:28:42 -04:00
DaneEveritt 5143faa4b1
Update changelog 2022-05-30 11:40:21 -04:00
DaneEveritt 4213775b5c
Fix mounting behavior to work correctly when adding to a server 2022-05-30 11:33:42 -04:00
DaneEveritt dbc9846320
Fix cache busting when creating a new server 2022-05-30 11:09:51 -04:00
Boy132 025e1a21ae
fix validator import (#4094) 2022-05-30 10:24:59 -04:00
DaneEveritt 8cf1311b84
Update dependencies prior to release tag 2022-05-29 20:43:52 -04:00
DaneEveritt e5fec9934d
Update CHANGELOG.md 2022-05-29 20:42:55 -04:00
DaneEveritt 9300e1116d
Fix failing tests 2022-05-29 20:39:51 -04:00
DaneEveritt a5521ecb79
Add support for returning transforming activity logs on the front-end 2022-05-29 20:34:48 -04:00
DaneEveritt e15985ea39
Add support for automatically pruning activity logs 2022-05-29 19:45:00 -04:00
DaneEveritt 9b7af02690
Add activity logging to most of the endpoints 2022-05-29 19:26:28 -04:00
DaneEveritt 287fd60891
Log activity when modifying account details 2022-05-29 18:48:35 -04:00
DaneEveritt 0b2c0db170
Remove last references to audit logs 2022-05-29 18:20:54 -04:00
DaneEveritt 0621d8475d
Return tests to passing now that we don't ignore a critical event... 2022-05-29 17:52:14 -04:00
DaneEveritt 09832cc558
Ensure we can properly create an activity log entry; always return soft-deleted models 2022-05-29 17:07:54 -04:00
DaneEveritt f1c1699994
Fix tests with model events 2022-05-29 17:07:34 -04:00
DaneEveritt 2fc5a734f9
Update backup logic to use activity logs, not audit logs 2022-05-29 16:19:04 -04:00
DaneEveritt cbecfff6da
Add activity logging for files 2022-05-29 13:56:39 -04:00
DaneEveritt 0999ad7ff0
Add activity logging for authentication events 2022-05-28 17:03:58 -04:00
DaneEveritt 5bb66a00d8
Add new activity logging code to replace audit log 2022-05-28 15:36:26 -04:00
DaneEveritt c14c7b436e
Pass along new fields to Wings instance when endpoint is used; closes #4048 2022-05-28 13:45:23 -04:00
DaneEveritt 3fceb588fb
Fix router logic to account for logged out users; closes #4085
Middleware was removed from the `/` route to redirect users without authentication, so now we need to handle this on the front-end properly.
2022-05-28 13:32:35 -04:00
DaneEveritt b051718afe
Fix up API handling logic for keys and set a prefix on all keys 2022-05-22 19:03:51 -04:00
DaneEveritt 8605d175d6
Ensure admin endpoints continue to work 2022-05-22 18:56:22 -04:00
DaneEveritt 3f99b00cf7
Fix display exception handling 2022-05-22 18:21:38 -04:00
DaneEveritt dca53611ff
Ensure we don't cause a mess with the auth providers 2022-05-22 18:16:47 -04:00
DaneEveritt 3ae70efc14
Use existing method to handle the login 2022-05-22 17:26:32 -04:00
DaneEveritt 4d3362b24f
Perform a bit of code cleanup 2022-05-22 17:23:48 -04:00
DaneEveritt be88e4e893
Ignore migrations, pass credentials 2022-05-22 17:01:39 -04:00
DaneEveritt 56f15c15a1
We can make this middleware significantly simpler 2022-05-22 16:54:07 -04:00
DaneEveritt 0fa33e0438
Mark a request as being stateful if a cookie for the session is provided at all
This accounts for poorly configured API clients that try to use cookies for authentication purposes. Treat everything with a session cookie as being a stateful request from the front-end.
2022-05-22 16:50:36 -04:00
DaneEveritt 33bafe9277
Simplify transformer logic 2022-05-22 16:23:22 -04:00
DaneEveritt f7fc67344e
Ensure tokens are found in the database using the expected logic 2022-05-22 16:05:58 -04:00
DaneEveritt e9c633fd03
Update transformers and controllers to no longer pull an API key attribute 2022-05-22 15:37:39 -04:00
DaneEveritt bd37978a98
Initial pass at implementing Laravel Sanctum for authorization on the API 2022-05-22 14:57:06 -04:00
DaneEveritt e313dff674
Massively simplify API binding logic
Changes the API internals to use normal Laravel binding which automatically supports nested-models and can determine their relationships. This removes a lot of confusingly complex internal logic and replaces it with standard Laravel code.

This also removes a deprecated "getModel" method and fully replaces it with a "parameter" method that does stricter type-checking.
2022-05-22 14:10:01 -04:00
DaneEveritt f1235c7f88
Update CHANGELOG.md 2022-05-21 17:02:40 -04:00
DaneEveritt 05f41a2ca8
Don't trim strings on file manager endpoints; ref #4081 2022-05-21 16:58:06 -04:00
Alex d0b6ae00dc
fix: update Paper API (#4080)
Paper api endpoints have been updated to api.papermc.io/v2 from the old papermc.io/api/v2
2022-05-21 15:50:07 -04:00
DaneEveritt d4bf6bd46a
Add test coverage and fix permissions mistake 2022-05-15 17:30:57 -04:00
DaneEveritt 8483db755d
Fix SSH key factory 2022-05-15 16:47:58 -04:00
DaneEveritt a9364061c1
Store keys in standard format; query with fingerprint not public key 2022-05-15 16:41:15 -04:00
DaneEveritt b563f13d09
Trim the key provided to query correctly; don't increment throttles when keys aren't found 2022-05-15 16:23:17 -04:00
DaneEveritt 3d6a30c9fd
Oops, don't make this abstract 2022-05-15 16:06:00 -04:00
DaneEveritt 412ac5ef39
Have the panel handle all of the authorization for both public key and password based attempts 2022-05-15 16:00:08 -04:00
DaneEveritt e856daee19
Reject requests for public key auth when the user has no keys 2022-05-15 15:47:06 -04:00
DaneEveritt 12927a3202
Update SFTP authentication endpoint to support returning user public keys 2022-05-15 15:37:58 -04:00
DaneEveritt cca0010a00
Update egg import/update logic to all use the same pathwaus 2022-05-15 14:40:19 -04:00
DaneEveritt 6554164252
Add test coverage for the SSH key endpoints 2022-05-14 18:08:48 -04:00
DaneEveritt 97280a62a2
Add support for storing SSH keys on user accounts 2022-05-14 17:31:53 -04:00
DaneEveritt 5705d7dbdd
Run php-cs-fixer 2022-05-14 16:03:50 -04:00
DaneEveritt 65f27d41a2
Switch to more recent Laravel route definition methods 2022-05-14 15:51:05 -04:00
DaneEveritt 62b178ed02
Show network usage on the server console view 2022-05-13 23:00:59 -04:00
DaneEveritt 8791d681bc
Fix server image selection not... existing 2022-05-13 22:09:20 -04:00
DaneEveritt 3e1f70570b
Update CHANGELOG.md 2022-05-13 21:54:24 -04:00
DaneEveritt 97a7959096
Support outputting all of the nodes on the instance 2022-05-13 21:49:06 -04:00
DaneEveritt 3f47d7a12c
Allow returning the node configuration from the CLI; closes pterodactyl/panel#4047 2022-05-13 21:30:16 -04:00
DaneEveritt 100d4ee726
Remove more unnecessary translations 2022-05-12 17:53:29 -04:00
Alex 0e3e14aa93
fix: artisan translations (#4069) 2022-05-08 11:28:17 -04:00
DaneEveritt 44bb8b4abf
Fix bad config for PHP 8.1 2022-05-07 18:33:41 -04:00
DaneEveritt a6df0afefd
Update CHANGELOG.md 2022-05-07 18:30:12 -04:00
DaneEveritt 6d5ca5a811
Update java version modal to only suggest allowed images 2022-05-07 18:18:14 -04:00
DaneEveritt c8faf64059
Support naming docker images on eggs; closes #4052
Bumps PTDL_v1 export images to PTDL_v2, updates the Minecraft specific eggs to use named images.
2022-05-07 17:45:22 -04:00
DaneEveritt 53207abcb3
Add base model layout from V2 for frontend 2022-05-07 16:52:58 -04:00
DaneEveritt 634b80ed42
Add support for filtering allocations to determine if they're assigned or not; closes #3872 2022-05-07 16:16:11 -04:00
DaneEveritt 1ae98604a4
Mark the 2FA field as a one-time-password field for autocomplete; closes #4038 2022-05-07 15:25:50 -04:00
DaneEveritt e88d24e0db
Don't allow allocations to be deleted by users if no limit is defined; closes #3703 2022-05-07 15:05:28 -04:00
DaneEveritt c751ce7f44
Allow more values for remote field when creating a database; closes #3842 2022-05-07 14:17:10 -04:00
DaneEveritt b07fdc100c
Don't run schedules when a server is suspended or installing; closes #4008 2022-05-04 20:41:53 -04:00
DaneEveritt ab37ee8633
Remove dusk tests, they're not used 2022-05-04 20:41:32 -04:00
DaneEveritt 66da520e11
Simplify testing process for integration tests, don't require second connection 2022-05-04 20:41:04 -04:00
DaneEveritt 8c63eebf13
Fix fractal errors 2022-05-04 19:35:10 -04:00
DaneEveritt 530558b0f8
Update deprecated JSON response creation and unnecessary middleware 2022-05-04 19:23:01 -04:00
DaneEveritt f5ad9b9e11
Replace debug bar with clockwork 2022-05-04 19:19:00 -04:00
DaneEveritt 4252014d18
Update includes definition to match updated package requirements 2022-05-04 19:11:42 -04:00
DaneEveritt 34ffaebd3e
Run cs-fix, ensure we only install dependency versions supporting 7.4+ 2022-05-04 19:01:29 -04:00
DaneEveritt 3e55a79439
Don't default to redis on the first runs, causes errors when trying to setup environment 2022-05-04 17:48:09 -04:00
DaneEveritt 21685d6fc6
Update composer dependencies 2022-05-04 17:46:15 -04:00
Jelco af4616ccf2
Add cron cheatsheet (#3866) 2022-03-28 12:43:45 -07:00
Jim C K Flaten 2680fe4c8e
Feature/task order (#3807) 2022-03-28 12:31:35 -07:00
FabianS 82818414a3
Ability to create nodes with artisan (#3319) 2022-03-28 12:28:16 -07:00
Георгий Пронюк 281256e17c
Grant all necessary permissions to generated SQL users (#3800)
* grant all necessary permissions to users

* fix CREATE TEMPORARY TABLES

Co-authored-by: A248 <theanandbeh@gmail.com>

Co-authored-by: A248 <theanandbeh@gmail.com>
Co-authored-by: Matthew Penner <me@matthewp.io>
2022-03-28 12:22:37 -07:00
Mrxbox98 a9ebf5b883
Added build workflow (#3963) 2022-03-28 12:13:27 -07:00
Alex 695c2647c8
fix(paper): fetching older versions (#3998)
Limit the results to a single match to prevent results such as "true true true" since the current version check expects only a single match
2022-03-28 12:12:21 -07:00
root 14cc98f75f
Tempest Hosting added (#4007) 2022-03-28 10:25:40 -07:00
Dane Everitt 61d6fa3168
Update contribution guidelines to clarify what types of PRs will be accepted 2022-02-20 10:59:58 -05:00
Dane Everitt a071676be4
Update webpack HMR for new dev environment 2022-02-12 13:18:08 -05:00
Dane Everitt 0bd182c2a7
Lower the default guzzle timeouts; ref pterodactyl/panel#3936 2022-02-05 12:33:54 -05:00
Alex 5120590e47
ref: remove google analytics (#3912) 2022-02-05 09:08:43 -08:00
Mrxbox98 0ff60d83eb
Fix incorrect alignment on 2FA boxes due to incorrect TW breakpoints (#3914) 2022-02-05 09:08:11 -08:00
Alex 5c229d60e3
feat(tf2): add GSLT variable (#3927)
Add GSLT variable similar to CS:GO.
2022-02-05 09:05:47 -08:00
Alex edfd97e0b4
feat(pid_limit): expand list of errors for pid_limit feature (#3942)
Expands the list of errors for pid_limit egg feature to support Steam PID errors and re-organize the list to be prettier
2022-02-05 09:05:36 -08:00
Alex 05bdffcd61
ref: set redis as default option for env drivers setup (#3915)
Redis is the recommended value yet the default options are different, e.g cache being file.
2022-02-05 09:05:18 -08:00
Dane Everitt 8dee69e78f
Add fields for game and image details 2022-01-30 09:04:54 -08:00
Alex 7866c19007
feat(docker): automated certificate renewal with certbot (#3916)
* feat(docker): automated certificate renewal with certbot

Executes cron on the first day of every month at 23:00 to reduce the load on LE when everyone else is doing it at 00. Certificate that expires in less than 30 days will be renewed.

closes #3907
2022-01-28 08:32:33 -08:00
Dane Everitt 0a4ba6a7dc
Force https on URLs when behind proxy; closes #3623 2022-01-23 12:58:44 -05:00
Dane Everitt 60b82343b2
Update SECURITY.md 2022-01-19 18:10:51 -08:00
Dane Everitt dfa329ddf2
[security] ensure session is only for that request when authenticating user API key
https://github.com/pterodactyl/panel/security/advisories/GHSA-7v3x-h7r2-34jv
2022-01-19 21:09:17 -05:00
Mrxbox98 21f74a835c
Fixed error (#3870) 2022-01-19 17:06:31 -08:00
Dane Everitt ee870d45e8
Update CHANGELOG.md 2022-01-19 19:55:33 -05:00
Alex 0ff2f28ced
feat(egg): Add Steam out of disk space modal (#3891) 2022-01-18 13:00:10 -07:00
Mrxbox98 1f3217c3c5
fix(server/files): duplicate entry when making a nested folder (#3813) 2022-01-18 12:49:06 -07:00
Alex 5f308feb3f
feat(model/pid): lowercase error array element (#3892) 2022-01-18 12:34:44 -07:00
Alex e881285ef1
ci(release): add ESLint config (#3747) 2022-01-17 20:17:13 -07:00
Wuzado 99ebd2e75c
Add the DB_PORT environmental variable to the example Docker Compose config (#3796) 2022-01-17 20:12:14 -07:00
Boy132 7d0d71baec
Checkbox & Dropdown for Startup Variables (#3769) 2022-01-17 20:08:53 -07:00
Paperboypaddy16 e7884e4f0b
Fixed link for docker-compose.yml under Setup (#3829) 2022-01-17 20:05:04 -07:00
Charles Morgan aed9f85bce
Add PID Modal (#3845) 2022-01-17 20:02:10 -07:00
Matthew Penner 1eaf411cb4
node: lowercase fqdn in letsencrypt path (#3890) 2022-01-17 19:56:57 -07:00
Alex 28f7a809a5
fix: exception localization (#3850)
resolves #3849
2022-01-15 08:10:37 -08:00
Wuzado 49dd719117
fix(docker): handle cases where DB_PORT is not defined (#3808)
Co-authored-by: Alex <admin@softwarenoob.com>
2022-01-15 08:10:19 -08:00
Paul Vogel 04656f8da8
Fix anchor in link to docker docs (#3793)
The former version does not "scroll" to the section
2022-01-15 08:10:01 -08:00
Jelco 95ff5f88c3
update required versions (#3881) 2022-01-12 13:53:36 -08:00
Dane Everitt f2e92d80ac
Adjust copyright in footer to be more consistent 2022-01-02 07:25:07 -08:00
Dane Everitt a6a9b31278
Avoid having to update the license each year 2022-01-02 07:21:56 -08:00
Dane Everitt 4dc6121e5c
Update README.md 2022-01-02 07:19:16 -08:00
SirEpiclyAmazing e771d36d41
Disallow crawlers (#3832) 2021-12-28 08:02:08 -05:00
Boy132 1d02365efe
Fix eslint warnings (#3814) 2021-12-19 09:50:18 -08:00
wingdings255 1564742606
Update egg-ark--survival-evolved.json (#3809) 2021-12-19 09:44:32 -08:00
Mrxbox98 66c56b0da8
CPU Graph change (#3804) 2021-12-12 10:19:06 -08:00
Mrxbox98 15619fb8e4
Fixes overlapping Two Factor Authentication Box (#3803) 2021-12-12 10:15:44 -08:00
Alex 4e6fe112b0
fix(forge): actually fix forge regex (#3801)
For whatever reason, stupid me rebased the wrong branch in previous PR #3783 and didn't notice it, which contained the old egg instead.

This one actually fixes the regex and includes more debugging steps for easier troubleshooting.

Easy to view diff: <https://www.diffchecker.com/3iJ9lVzH>
2021-12-12 10:14:25 -08:00
Mrxbox98 f04b87a37c
FireFox Font Fix (#3805) 2021-12-12 10:14:09 -08:00
hz-ad 928b060647
Include HostEZ in sponsors list (#3788)
Update to append HostEZ to the sponsors list
2021-12-06 11:00:29 -08:00
Alex b8bf537737
cmd(setup): validate email input, closes #3175 (#3716) 2021-12-04 10:52:09 -08:00
Charles Morgan 0d5ff6afac
Add Pug / Jade to file editor, closes #3512 (#3514) 2021-12-04 10:51:52 -08:00
Alex 5cde059f21
docs(docker): display correct variable for certificates (#3723)
Docker image and compose file uses `LE_EMAIL` and not `LETSENCRYPT_EMAIL`

Co-authored-by: Matthew Penner <me@matthewp.io>
2021-12-04 10:51:15 -08:00
Alex 0db772a82b
eggs: update source install script (#3604)
Installing basic packages are unnecessary as they already exist in yolks installer image. This also gets rid of Debian 10 lib32gcc package not being found, since installer image is Debian 11.
2021-12-04 10:50:50 -08:00
Paul Vogel dcbc1360a9
Improve test coverage for LocationController (#3779)
By adding tests for create, update, delete
2021-12-04 10:50:36 -08:00
Patrick R 622b939f00
Show ipv6 with correct in-url syntax (#3776) 2021-12-04 10:35:55 -08:00
Lukas Moucka e8e2911a92
Change order of docker images in JavaVersionModalFeature (#3782)
This changes the order of the Docker images in JavaVersionModalFeature, and also sets the default state to Java 17. Previously it was Java 16, even though the first entry in the list was Java 8, that confused a lot of people
2021-12-04 10:35:39 -08:00
Boy132 96c3338e96
Add the MC 1.18 message to Java Version Modal (#3778) 2021-12-04 10:35:20 -08:00
Alex 49d5ef271d
ARM64 support for the Panel Docker image, closes #3580 (#3709)
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2021-12-04 10:33:42 -08:00
Boy132 4cc8658334
GSL Token Modal Feature (#3746) 2021-12-04 10:29:24 -08:00
Yusta a6e0e5dbda
Add app_url for mail sender (#3753)
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2021-12-04 10:26:00 -08:00
Desjardins Jérôme 10aaf00e83
use DB_PORT for mysql database connection (#3762)
DB_PORT is the env variable defined for the mysql port into Panel Configuration.
2021-12-04 10:25:02 -08:00
Paul Vogel b9d73afb63
Fix typo in messsage when deleting a database (#3777) 2021-12-04 10:24:06 -08:00
Alex 59d47e746b
fix: Forge version regex for 1.17+ JPMS (#3783)
For 1.17 JPMS arguments, fix regex to match`^1\.(17|18|19|20|21|22|23)` or latest instead of only dot . minor versions, which is something I didn't notice in a previous PR. This should future proof it.

Changes Java image display order defaulting to 17, which the 1.17+ requires for unix args.
2021-12-04 10:23:37 -08:00
Alex 01e7a45cc5
fix(eggs): Forge latest version fetching (#3770)
Fixes a typo in fetching the latest versions. It was overwritten to "recommended" by mistake.

Easy to read diff: <https://www.diffchecker.com/U04gJTRu>
2021-11-29 10:14:08 -08:00
Dane Everitt 30bb629bad
Update CHANGELOG.md 2021-11-16 20:36:53 -08:00
Dane Everitt bf9cbe2c6d
Add consistent CSRF token verification to API endpoints; address security concern with non-CSRF protected endpoints 2021-11-16 20:02:18 -08:00
Matthew Penner cc31a0a6d0
tests(integration): don't expect non-required fields 2021-11-15 11:29:22 -07:00
Alex 01871d8a6c
add Java 17 LTS image to Minecraft eggs (#3744)
* feat: add Java 17 LTS for Minecraft

* feat: add java 17 option to java modal
2021-11-15 08:15:27 -08:00
Dane Everitt 17c03e9a4d
Fix broken session management for application api 2021-11-03 21:33:21 -07:00
Dane Everitt e8a8405899
Remove tests 2021-11-03 21:22:14 -07:00
Dane Everitt 60eff40a0c
Fix session management on client API requests; closes #3727
Versions of Pterodactyl prior to 1.6.3 used a different throttle pathway for
requests. That pathway found the current request user before continuing on to
other in-app middleware, thus the user was available downstream.

Changes introduced in 1.6.3 changed the throttler logic, therefore removing this
step. As a result, the client API could not always get the currently authenticated
user when cookies were used (aka, requests from the Panel UI, and not API directly).

This change corrects the logic to get the session setup correctly before falling
through to authenticating as a user using the API key. If a cookie is present and a
user is found as a result that session will be used. If an API key is provided it is
ignored when a cookie is also present.

In order to keep the API stateless any session created for an API request stemming
from an API key will have the associated session deleted at the end of the request,
and the 'Set-Cookies' header will be stripped from the response.
2021-11-03 20:51:39 -07:00
Alex d0663dcbd4
fix: use POST for admin logout route (#3710)
Quick fix for logging out from the admin panel as the auth route was changed from GET to POST.
2021-10-30 13:27:59 -07:00
Alex 4dca4f0aa9
change display format of the container uptime (#3706)
* change display format of the container uptime

Display `day, hour, min` if days is more than 0, otherwise default to existing `hour, min, sec`. Removes pads to make it more clean in this new format.

* clean the return
2021-10-24 14:41:01 -07:00
Samuel Ryberg c4ab318d5a
Update docker-compose.example.yml (#3707) 2021-10-24 10:21:58 -07:00
Alex ef4410bac6
expose uptime to client resources API endpoint (#3705)
resolves #3704
2021-10-24 10:12:17 -07:00
Anders G. Jørgensen 72680fc954
Don't force enable-query (#3700)
But make sure the query.port is set correctly, if query is enabled.
2021-10-23 13:11:45 -07:00
Dane Everitt d65e2978d0
Update CHANGELOG.md 2021-10-23 13:02:25 -07:00
Dane Everitt 45999ba4ee
(security) use POST for logout rather than GET
see https://github.com/pterodactyl/panel/security/advisories/GHSA-m49f-hcxp-6hm6
2021-10-23 13:00:21 -07:00
Dane Everitt 22a8b2b3a2
Use more standardized rate limiting in Laravel; apply limits to auth routes 2021-10-23 12:17:16 -07:00
Alex f77932a617
cmd(upgrade): Attempt to gain users attention during upgrade (#3678)
* cmd(upgrade):  Attempt to gain users attention during upgrade

Changes color of the user and group to gain attention, common issue is having wrong user/group which breaks the panel. Outputs termination message when users spam enter skipping the upgrade wondering why it didn't upgrade.

Reminder to update wings, because users forget it.

* cmd(upgrade): Display wings upgrade documentation link
2021-10-10 11:08:22 -07:00
Alex c12f1463b0
eggs(forge): Add support for 1.17+ Forge (#3676)
Support new 1.17+ Forge JPMS arguments that don't ship any executable jar. It will use unix_args.txt file for 1.17+ when one exists, otherwise defaults to using the jar file

Fix forge latest build version option to actually use latest instead of recommended
Set build version input rules to only accept valid values of the latest and recommended
Remove spaces from the version variables to avoid issues with curl. Forge site displays versions with spaces to end users
2021-10-10 10:50:01 -07:00
Alex 5b6de4df6f
eggs(rust): custom map url (#3625)
Introduces custom map URL variable. If none is provided, it will default to using normal map size and seed. Otherwise, it will use the custom map and remove map size/seed from the startup as required.
2021-10-09 10:31:47 -07:00
Waseem Hassan Shahid 8b236c6907
Fix SSL config docker (#3616)
* Don't copy default nginx config at build time

* Use http.d folder for nginx configs

* Add default config back

* Change the panel config name
2021-10-09 10:31:29 -07:00
Matthew Penner 4fa38b8e9c
Fix wings receiving wrong suspended status on sync (#3667)
Due to wings pulling the server configuration rather than the Panel pushing it,
wings gets the wrong status for a server if both the status update and sync request
are ran in a transaction due to the status not being persisted in the database.

Fixes #3639
2021-10-07 08:46:09 -07:00
Cyra de0d5c9b8a
Updated CHS sponsor entry to use new domain (#3659)
Updated CHS sponsor entry to use new domain
Updated from captiolsolutions.cloud to chs.gg
2021-10-04 08:23:10 -07:00
Dane Everitt 81ba333270
If uptime is present in stats output, display it for the server; closes #3653 2021-10-03 12:59:44 -07:00
Dane Everitt 63e01f9aee
Update SECURITY.md 2021-10-02 08:21:04 -07:00
Dane Everitt c57eb2c9e6
Update CHANGELOG.md 2021-09-21 21:36:29 -07:00
Dane Everitt 4a84c36009
Fix security vulnerability when authenticating a two-factor authentication token for a user
See associated security advisory for technical details on the content of this security fix.

GHSA ID: GHSA-5vfx-8w6m-h3v4
2021-09-21 21:30:08 -07:00
Dane Everitt 5fdb0a5909
Correctly expose OOM disable state for a server 2021-09-13 21:02:12 -07:00
Dane Everitt f5a1ce13b8
Update CHANGELOG.md 2021-09-13 20:47:30 -07:00
Matthew Penner bc25468802
server: fix build modification not being persisted (#3610) 2021-09-12 23:18:17 -06:00
1015 changed files with 26522 additions and 22475 deletions

View File

@ -1,11 +0,0 @@
module.exports = {
twin: {
preset: 'styled-components',
autoCssProp: true,
},
styledComponents: {
pure: true,
displayName: false,
fileName: false,
},
};

View File

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

13
.env.ci
View File

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

View File

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

View File

@ -1,4 +1,6 @@
public public
node_modules node_modules
resources/views resources/views
babel.config.js
tailwind.config.js
webpack.config.js webpack.config.js

51
.eslintrc.js Normal file
View File

@ -0,0 +1,51 @@
/** @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' }],
},
};

View File

@ -1,98 +0,0 @@
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"
rules:
quotes:
- warn
- single
indent:
- warn
- 4
- SwitchCase: 1
semi:
- warn
- always
comma-dangle:
- warn
- always-multiline
spaced-comment:
- warn
array-bracket-spacing:
- warn
- always
# 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,2 +1 @@
github: [DaneEveritt] github: [matthewpi]
custom: ["https://paypal.me/PterodactylSoftware"]

View File

@ -7,14 +7,6 @@ body:
value: | value: |
Bug reports should only be used for reporting issues with how the software works. For assistance installing this software, as well as debugging issues with dependencies, please use our [Discord server](https://discord.gg/pterodactyl). Bug reports should only be used for reporting issues with how the software works. For assistance installing this software, as well as debugging issues with dependencies, please use our [Discord server](https://discord.gg/pterodactyl).
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please [search here](https://github.com/pterodactyl/panel/issues) to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues before opening this issue.
required: true
- type: textarea - type: textarea
attributes: attributes:
label: Current Behavior label: Current Behavior
@ -32,7 +24,7 @@ body:
- type: textarea - type: textarea
attributes: attributes:
label: Steps to Reproduce label: Steps to Reproduce
description: Please be as detailed as possible when providing steps to reproduce, failure to provide steps will likely result in this issue being closed. description: Please be as detailed as possible when providing steps to reproduce, failure to provide steps will result in this issue being closed.
validations: validations:
required: true required: true
@ -54,6 +46,20 @@ body:
validations: validations:
required: true required: true
- type: input
id: egg-details
attributes:
label: Games and/or Eggs Affected
description: Please include the specific game(s) or egg(s) you are running into this bug with.
placeholder: Minecraft (Paper), Minecraft (Forge)
- type: input
id: docker-image
attributes:
label: Docker Image
description: The specific Docker image you are using for the game(s) above.
placeholder: ghcr.io/pterodactyl/yolks:java_17
- type: textarea - type: textarea
id: panel-logs id: panel-logs
attributes: attributes:
@ -62,8 +68,20 @@ body:
Run the following command to collect logs on your system. Run the following command to collect logs on your system.
Wings: `sudo wings diagnostics` Wings: `sudo wings diagnostics`
Panel: `tail -n 100 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc bin.ptdl.co 99` Panel: `tail -n 150 /var/www/pterodactyl/storage/logs/laravel-$(date +%F).log | nc pteropaste.com 99`
placeholder: "https://bin.ptdl.co/a1h6z" placeholder: "https://pteropaste.com/a1h6z"
render: bash render: bash
validations: validations:
required: false required: false
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please [search here](https://github.com/pterodactyl/panel/issues) to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues before opening this issue.
required: true
- label: I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
required: true
- label: I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
required: true

View File

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

View File

@ -12,7 +12,7 @@ You can provide additional settings using a custom `.env` file or by setting the
## Setup ## Setup
Start the docker container and the required dependencies (either provide existing ones or start containers as well, see the [docker-compose.yml](docker-compose.yml) file as an example). Start the docker container and the required dependencies (either provide existing ones or start containers as well, see the [docker-compose.yml](https://github.com/pterodactyl/panel/blob/develop/docker-compose.example.yml) file as an example.
After the startup is complete you'll need to create a user. After the startup is complete you'll need to create a user.
If you are running the docker container without docker-compose, use: If you are running the docker container without docker-compose, use:
@ -27,13 +27,13 @@ docker-compose exec panel php artisan p:user:make
## Environment Variables ## 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. 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 `LETSENCRYPT_EMAIL` as well so Certificates can be generated. Note: If your `APP_URL` starts with `https://` you need to provide an `LE_EMAIL` as well so Certificates can be generated.
| Variable | Description | Required | | Variable | Description | Required |
| ------------------- | ------------------------------------------------------------------------------ | -------- | | ------------------- | ------------------------------------------------------------------------------ | -------- |
| `APP_URL` | The URL the panel will be reachable with (including protocol) | yes | | `APP_URL` | The URL the panel will be reachable with (including protocol) | yes |
| `APP_TIMEZONE` | The timezone to use for the panel | yes | | `APP_TIMEZONE` | The timezone to use for the panel | yes |
| `LETSENCRYPT_EMAIL` | The email used for letsencrypt certificate generation | yes | | `LE_EMAIL` | The email used for letsencrypt certificate generation | yes |
| `DB_HOST` | The host of the mysql instance | yes | | `DB_HOST` | The host of the mysql instance | yes |
| `DB_PORT` | The port of the mysql instance | yes | | `DB_PORT` | The port of the mysql instance | yes |
| `DB_DATABASE` | The name of the mysql database | yes | | `DB_DATABASE` | The name of the mysql database | yes |

View File

@ -3,7 +3,7 @@ cd /app
mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \ mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \
&& chmod 777 /var/log/panel/logs/ \ && chmod 777 /var/log/panel/logs/ \
&& ln -s /var/log/panel/logs/ /app/storage/logs/ && ln -s /app/storage/logs/ /var/log/panel/
## check for .env file and generate app keys if missing ## check for .env file and generate app keys if missing
if [ -f /app/var/.env ]; then if [ -f /app/var/.env ]; then
@ -30,7 +30,7 @@ else
fi fi
echo "Checking if https is required." echo "Checking if https is required."
if [ -f /etc/nginx/conf.d/default.conf ]; then if [ -f /etc/nginx/http.d/panel.conf ]; then
echo "Using nginx config already in place." echo "Using nginx config already in place."
if [ $LE_EMAIL ]; then if [ $LE_EMAIL ]; then
echo "Checking for cert update" echo "Checking for cert update"
@ -42,20 +42,27 @@ else
echo "Checking if letsencrypt email is set." echo "Checking if letsencrypt email is set."
if [ -z $LE_EMAIL ]; then if [ -z $LE_EMAIL ]; then
echo "No letsencrypt email is set using http config." echo "No letsencrypt email is set using http config."
cp .github/docker/default.conf /etc/nginx/conf.d/default.conf cp .github/docker/default.conf /etc/nginx/http.d/panel.conf
else else
echo "writing ssl config" echo "writing ssl config"
cp .github/docker/default_ssl.conf /etc/nginx/conf.d/default.conf cp .github/docker/default_ssl.conf /etc/nginx/http.d/panel.conf
echo "updating ssl config for domain" echo "updating ssl config for domain"
sed -i "s|<domain>|$(echo $APP_URL | sed 's~http[s]*://~~g')|g" /etc/nginx/conf.d/default.conf sed -i "s|<domain>|$(echo $APP_URL | sed 's~http[s]*://~~g')|g" /etc/nginx/http.d/panel.conf
echo "generating certs" echo "generating certs"
certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n
fi fi
echo "Removing the default nginx config"
rm -rf /etc/nginx/http.d/default.conf
fi
if [[ -z $DB_PORT ]]; then
echo -e "DB_PORT not specified, defaulting to 3306"
DB_PORT=3306
fi fi
## check for DB up before starting the panel ## check for DB up before starting the panel
echo "Checking database status." echo "Checking database status."
until nc -z -v -w30 $DB_HOST 3306 until nc -z -v -w30 $DB_HOST $DB_PORT
do do
echo "Waiting for database connection..." echo "Waiting for database connection..."
# wait for 1 seconds before check again # wait for 1 seconds before check again

35
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,35 @@
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

72
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,72 @@
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

69
.github/workflows/docker.yaml vendored Normal file
View File

@ -0,0 +1,69 @@
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

View File

@ -1,47 +0,0 @@
name: Publish Docker Image
on:
push:
branches:
- 'develop'
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Image to GitHub Packages
runs-on: ubuntu-latest
# 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
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' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

36
.github/workflows/lint.yaml vendored Normal file
View File

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

View File

@ -1,59 +0,0 @@
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: [ 7.4, 8.0 ]
database: [ 'mariadb:10.2', '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:
- uses: actions/checkout@v2
- name: get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
- 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
- run: cp .env.ci .env
- run: composer install --prefer-dist --no-interaction --no-progress
- run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php
continue-on-error: true
- name: execute unit tests
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
if: ${{ always() }}
env:
DB_CONNECTION: testing
TESTING_DB_HOST: UNIT_NO_DB
- name: execute integration tests
run: vendor/bin/phpunit tests/Integration
env:
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
TESTING_DB_USERNAME: root

19
.gitignore vendored
View File

@ -1,7 +1,6 @@
/vendor /vendor
*.DS_Store* *.DS_Store*
!.env.ci !.env.ci
!.env.dusk
!.env.example !.env.example
.env* .env*
.vagrant/* .vagrant/*
@ -9,32 +8,30 @@
storage/framework/* storage/framework/*
/.idea /.idea
/nbproject /nbproject
/.direnv
node_modules node_modules
*.log *.log
_ide_helper.php _ide_helper.php
_ide_helper_models.php _ide_helper_models.php
.phpstorm.meta.php .phpstorm.meta.php
.php_cs.cache
.yarn .yarn
public/assets/manifest.json public/assets/manifest.json
# For local development with docker # For local development with docker
# Remove if we ever put the Dockerfile in the repo # Remove if we ever put the Dockerfile in the repo
.dockerignore .dockerignore
#Dockerfile
docker-compose.yml docker-compose.yml
# for image related files # for image related files
misc misc
.phpstorm.meta.php .php-cs-fixer.cache
.php_cs.cache
coverage.xml coverage.xml
# Vagrant
*.log
resources/lang/locales.js resources/lang/locales.js
resources/assets/pterodactyl/scripts/helpers/ziggy.js
resources/assets/scripts/helpers/ziggy.js
.phpunit.result.cache .phpunit.result.cache
/public/build
/public/hot
result
docker-compose.yaml
release

View File

@ -29,7 +29,7 @@ return (new Config())
'no_unreachable_default_argument_value' => true, 'no_unreachable_default_argument_value' => true,
'no_useless_return' => true, 'no_useless_return' => true,
'ordered_imports' => [ 'ordered_imports' => [
'sortAlgorithm' => 'length', 'sort_algorithm' => 'length',
], ],
'phpdoc_align' => [ 'phpdoc_align' => [
'align' => 'left', 'align' => 'left',

9
.prettierrc.json Normal file
View File

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

View File

@ -1 +0,0 @@
@types/react-native

View File

@ -5,9 +5,9 @@ Release versions of Pterodactyl will include pre-compiled, minified, and hashed
However, if you are interested in running custom themes or making modifications to the React files you'll need a build However, if you are interested in running custom themes or making modifications to the React files you'll need a build
system in place to generate these compiled assets. To get your environment setup you'll need at minimum: system in place to generate these compiled assets. To get your environment setup you'll need at minimum:
* Node.js 12 * [Node.js](https://nodejs.org/en/) v14.x.x
* [Yarn](https://classic.yarnpkg.com/lang/en/) v1 * [Yarn](https://classic.yarnpkg.com/lang/en/) v1.x.x
* [Go](https://golang.org/) 1.15. * [Go](https://golang.org/) 1.17.x
### Install Dependencies ### Install Dependencies
```bash ```bash

View File

@ -3,6 +3,369 @@ 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. 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.
* Fixes formatting of IPv6 addresses when displaying allocations to users.
* Fixes an exception thrown while trying to return error messages from API endpoints that inproperly masked the true underlying error.
* Fixes SSL certificate path generation for Let's Encrypt by ensuring they are always transformed to lowercase.
* Removes duplicate entries when creating a nested folder in the file manager.
* Fixes missing validation of Egg Author email addresses during the setup process that could cause unexpected failures later on.
* Fixes font rendering issues of the console on Firefox due to an outdated version of xterm.js being used.
* Fixes display overlap issues of the two-factor configuration form in a user's settings.
* **[security]** When authenticating using an API key a user session is now only persisted for the duration of the request before being destroyed.
### Changed
* CPU graph changed to show the maximum amount of CPU available to a server to better match how the memory graph is displayed.
### Added
* Adds support for `DB_PORT` environment variable in the Docker enterpoint for the Panel image.
* Adds suport for ARM environments in the Docker image.
* Adds a new warning modal for Steam servers shown when an invalid Game Server Login Token (GSL Token) is detected.
* Adds a new warning modal for Steam servers shown when the installation process runs out of available disk space.
* Adds a new warning modal for Minecraft servers shown when a server exceeds the maximum number of child processes.
* Adds support for displaying certain server variable fields as a checkbox when they're detected as using `boolean` or `in:0,1` validation rules.
* Adds support for Pug and Jade in the file editor.
* Adds an entry to the `robots.txt` file to correctly disallow all bot indexing.
## v1.6.6
### Fixed
* **[security]** Fixes a CSRF vulnerability for both the administrative test email endpoint and node auto-deployment token generation endpoint. [GHSA-wwgq-9jhf-qgw6](https://github.com/pterodactyl/panel/security/advisories/GHSA-wwgq-9jhf-qgw6)
### Changed
* Updates Minecraft eggs to include latest Java 17 yolk by default.
## v1.6.5
### Fixed
* Fixes broken application API endpoints due to changes introduced with session management in 1.6.4.
## v1.6.4
_This release should not be used, please use `1.6.5`. It has been pulled from our releases._
### Fixed
* Fixes a session management bug that would cause a user who signs out of one browser to be unintentionally logged out of other browser sessions when using the client API.
## v1.6.3
### Fixed
* **[Security]** Changes logout endpoint to be a POST request with CSRF-token validation to prevent a malicious actor from triggering a user logout.
* Fixes Wings receiving the wrong server suspension state when syncing servers.
### Added
* Adds additional throttling to login and password reset endpoints.
* Adds server uptime display when viewing a server console.
## v1.6.2
### Fixed
* **[Security]** Fixes an authentication bypass vulerability that could allow a malicious actor to login as another user in the Panel without knowing that user's email or password.
## v1.6.1
### Fixed
* Fixes server build modifications not being properly persisted to the database when edited.
* Correctly exposes the `oom_disabled` field in the `build` limits block for a server build so that Wings can pick it up.
*
## v1.6.0 ## v1.6.0
### Fixed ### Fixed
* Fixes array merging logic for server transfers that would cause a 500 error to occur in some scenarios. * Fixes array merging logic for server transfers that would cause a 500 error to occur in some scenarios.

View File

@ -1,55 +1,31 @@
# Contributing # Contributing
We're glad you want to help us out and make this panel the best that it can be! We have a few simple things to follow
when making changes to files and adding new features.
### Development Environment Pterodactyl does not accept Pull Requests (PRs) _for new functionality_ from users that are not currently part of the
Please check the [`pterodactyl/development`](https://github.com/pterodactyl/development) repository for a Vagrant & core project team. It has become overwhelming to try and give the proper time and attention that such complicated PRs
Docker setup that should run on most macOS and Linux distributions. In the event that your platform is not supported tend to require — and deserve. As a result, it is in the project's best interest to limit the scope of work on
you're welcome to open a PR, or just take a look at our setup scripts to see what you'll need to successfully develop new functionality to work done within the core project team.
with Pterodactyl.
#### Building Assets PRs that address existing _bugs_ with a corresponding issue opened in our issue tracker will continue to be accepted
Please see [`BUILDING.md`](https://github.com/pterodactyl/panel/blob/develop/BUILDING.md) for details on how to actually and reviewed. Their scope is often significantly more targeted, and simply improving upon existing and well defined
build and run the development server. logic.
### Project Branches
This section mainly applies to those with read/write access to our repositories, but can be helpful for others.
The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most
part, this means you will need to create `feature/` branches in order to add new functionality or change how things
work. When making a feature branch, if it is referencing something in the issue tracker, please title the branch
`feature/PTDL-###` where `###` is the issue number.
All new code should contain tests to ensure their functionality is not unintentionally changed down the road. This
is especially important for any API actions or authentication based controls.
### The CHANGELOG
You should not make any changes to the `CHANGELOG.md` file during your code updates. This is updated by the maintainers
at the time of deployment to include the relevant changes that were made.
### Code Guidelines
We are a `PSR-4` and `PSR-0` compliant project, so please follow those guidelines at a minimum. In addition we run
`php-cs-fixer` on all PRs and releases to enforce a consistent code style. The following command executed on your machine
should show any areas where the code style does not line up correctly.
```
vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php_cs.dist
```
### Responsible Disclosure ### 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 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 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. 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 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 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. keeping this community safe.
If you've found what you believe is a security issue please email `dane åt pterodactyl døt io`. 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.
### Contact Us ### 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. 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). You can also find us on [Discord](https://discord.gg/pterodactyl).

View File

@ -2,7 +2,7 @@
# Build the assets that are needed for the frontend. This build stage is then discarded # Build the assets that are needed for the frontend. This build stage is then discarded
# since we won't need NodeJS anymore in the future. This Docker image ships a final production # since we won't need NodeJS anymore in the future. This Docker image ships a final production
# level distribution of Pterodactyl. # level distribution of Pterodactyl.
FROM mhart/alpine-node:14 FROM --platform=$TARGETOS/$TARGETARCH mhart/alpine-node:14
WORKDIR /app WORKDIR /app
COPY . ./ COPY . ./
RUN yarn install --frozen-lockfile \ RUN yarn install --frozen-lockfile \
@ -10,11 +10,11 @@ RUN yarn install --frozen-lockfile \
# Stage 1: # Stage 1:
# Build the actual container with all of the needed PHP dependencies that will run the application. # Build the actual container with all of the needed PHP dependencies that will run the application.
FROM php:7.4-fpm-alpine FROM --platform=$TARGETOS/$TARGETARCH php:8.1-fpm-alpine
WORKDIR /app WORKDIR /app
COPY . ./ COPY . ./
COPY --from=0 /app/public/assets ./public/assets COPY --from=0 /app/public/assets ./public/assets
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot \ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot certbot-nginx \
&& docker-php-ext-configure zip \ && docker-php-ext-configure zip \
&& docker-php-ext-install bcmath gd pdo_mysql zip \ && docker-php-ext-install bcmath gd pdo_mysql zip \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
@ -23,10 +23,12 @@ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar un
&& chmod 777 -R bootstrap storage \ && chmod 777 -R bootstrap storage \
&& composer install --no-dev --optimize-autoloader \ && composer install --no-dev --optimize-autoloader \
&& rm -rf .env bootstrap/cache/*.php \ && rm -rf .env bootstrap/cache/*.php \
&& mkdir -p /app/storage/logs/ \
&& chown -R nginx:nginx . && chown -R nginx:nginx .
RUN rm /usr/local/etc/php-fpm.conf \ RUN rm /usr/local/etc/php-fpm.conf \
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ && echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
&& echo "0 23 * * * certbot renew --nginx --quiet" >> /var/spool/cron/crontabs/root \
&& sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \ && sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \
&& mkdir -p /var/run/php /var/run/nginx && mkdir -p /var/run/php /var/run/nginx

View File

@ -1,7 +1,8 @@
# The MIT License (MIT) # The MIT License (MIT)
``` ```
Copyright (c) 2015 - 2021 Dane Everitt <dane@daneeveritt.com> and Contributors Pterodactyl®
Copyright © Dane Everitt <dane@daneeveritt.com> and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

674
NookLicense.md Normal file
View File

@ -0,0 +1,674 @@
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>.

196
README.md
View File

@ -1,99 +1,135 @@
[![Logo Image](https://cdn.pterodactyl.io/logos/new/pterodactyl_logo.png)](https://pterodactyl.io) # Nook Theme
NookTheme is a free and open source [Pterodactyl theme](https://pterodactyl.io) designed to be simple, clean, and modern.
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pterodactyl/panel/tests?label=Tests&style=for-the-badge) ![Image](https://i.imgur.com/AFjHGBr.png)
![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)
# Pterodactyl Panel <details>
Pterodactyl is an open-source game server management panel built with PHP 7, React, and Go. Designed with security <summary>View Screnshots</summary>
in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive
UI to end users.
Stop settling for less. Make game servers a first class citizen on your platform. ![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>
![Image](https://cdn.pterodactyl.io/site-assets/pterodactyl_v1_demo.gif) ## Installation
## Sponsors This will update your panel to the latest version of NookTheme panel is based. <br>
I would like to extend my sincere thanks to the following sponsors for helping fund Pterodactyl's developement. You can see the version in the current branch name.
[Interested in becoming a sponsor?](https://github.com/sponsors/DaneEveritt) ### Enter Maintenance Mode
| Company | About | 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
| [**WISP**](https://wisp.gg) | Extra features. | potentially new 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. | ```bash
| [**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. | cd /var/www/pterodactyl
| [**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. | php artisan down
| [**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. | ### Download the theme
| [**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. | The first step in the update process is to download the new panel files from GitHub. The command below will download
| [**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. | the release archive for the most recent version of Pterodactyl, save it in the current directory and will automatically
| [**Capitol Hosting Solutions**](https://capitolsolutions.cloud/) | 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! | unpack the archive into your current folder.
| [**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. | ```bash
| [**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.| curl -L https://github.com/Nookure/NookTheme/releases/latest/download/panel.tar.gz | tar -xzv
| [**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! | ```
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
```
## Documentation ## Documentation
* [Panel Documentation](https://pterodactyl.io/panel/1.0/getting_started.html) * [Panel Documentation](https://pterodactyl.io/panel/1.0/getting_started.html)
* [Wings Documentation](https://pterodactyl.io/wings/1.0/installing.html) * [Wings Documentation](https://pterodactyl.io/wings/1.0/installing.html)
* [Community Guides](https://pterodactyl.io/community/about.html) * [Community Guides](https://pterodactyl.io/community/about.html)
* Or, get additional help [via Discord](https://discord.gg/pterodactyl) * Or, get additional help [via Discord](https://discord.nookure.com/)
### Supported Games ## Star History
We support a huge variety of games by utilizing Docker containers to isolate each instance, giving you the power to
host your games across the world without having to bloat each physical machine with additional dependencies.
Some of our core supported games include: <a href="https://star-history.com/#Nookure/NookTheme&Timeline">
<picture>
* Minecraft — including Paper, Sponge, Bungeecord, Waterfall, and more <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline&theme=dark" />
* Rust <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
* Terraria <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
* Teamspeak </picture>
* Mumble </a>
* 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 ## License
```
Copyright (c) 2015 - 2021 Dane Everitt <dane@daneeveritt.com> and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Pterodactyl® Copyright © 2015 - 2023 Dane Everitt and contributors.
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all > Nookure is not affiliated with Pterodactyl® Panel or its contributors.
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR Pterodactyl code released under the [MIT License](./LICENSE.md).
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
Some Javascript and CSS used within the panel are licensed under a `MIT` or `Apache 2.0` license. Please check their NookTheme code edits released under the [GNU GPLv3 License](./NookLicense.md).
respective header files for more information.

View File

@ -1,22 +1,18 @@
# Security Policy # Security Policy
## Supported Versions ## Supported Versions
The following versions of Pterodactyl are receiving active support and maintenance. Any security vulnerabilities discovered must be reproducible in 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 | | Panel | Daemon | Supported |
| ----- | ------------ | ------------------ | |--------|--------------|--------------------|
| 1.4.x | wings@1.4.x | :white_check_mark: | | 1.11.x | wings@1.11.x | :white_check_mark: |
| 1.3.x | wings@1.3.x | :x: |
| 1.2.x | wings@1.2.x | :x: |
| 1.1.x | wings@1.1.x | :x: |
| 1.0.x | wings@1.0.x | :x: |
| 0.7.x | daemon@0.6.x | :x: | | 0.7.x | daemon@0.6.x | :x: |
| 0.6.x | daemon@0.5.x | :x: |
| 0.5.x | daemon@0.4.x | :x: |
## Reporting a Vulnerability ## Reporting a Vulnerability
Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can send an email to `dane [ät] pterodactyl.io`. Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can email `matthew@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. 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,31 +1,22 @@
<?php <?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; namespace Pterodactyl\Console\Commands\Environment;
use DateTimeZone;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait; use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class AppSettingsCommand extends Command class AppSettingsCommand extends Command
{ {
use EnvironmentWriterTrait; use EnvironmentWriterTrait;
public const ALLOWED_CACHE_DRIVERS = [ public const CACHE_DRIVERS = [
'redis' => 'Redis (recommended)', 'redis' => 'Redis (recommended)',
'memcached' => 'Memcached', 'memcached' => 'Memcached',
'file' => 'Filesystem', 'file' => 'Filesystem',
]; ];
public const ALLOWED_SESSION_DRIVERS = [ public const SESSION_DRIVERS = [
'redis' => 'Redis (recommended)', 'redis' => 'Redis (recommended)',
'memcached' => 'Memcached', 'memcached' => 'Memcached',
'database' => 'MySQL Database', 'database' => 'MySQL Database',
@ -33,30 +24,14 @@ class AppSettingsCommand extends Command
'cookie' => 'Cookie', 'cookie' => 'Cookie',
]; ];
public const ALLOWED_QUEUE_DRIVERS = [ public const QUEUE_DRIVERS = [
'redis' => 'Redis (recommended)', 'redis' => 'Redis (recommended)',
'database' => 'MySQL Database', 'database' => 'MySQL Database',
'sync' => 'Sync', 'sync' => 'Sync',
]; ];
/**
* @var \Illuminate\Contracts\Console\Kernel
*/
protected $command;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var string
*/
protected $description = 'Configure basic environment settings for the Panel.'; protected $description = 'Configure basic environment settings for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:setup protected $signature = 'p:environment:setup
{--new-salt : Whether or not to generate a new salt for Hashids.} {--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.} {--author= : The email that services created on this instance should be linked to.}
@ -68,22 +43,17 @@ class AppSettingsCommand extends Command
{--redis-host= : Redis host to use for connections.} {--redis-host= : Redis host to use for connections.}
{--redis-pass= : Password used to connect to redis.} {--redis-pass= : Password used to connect to redis.}
{--redis-port= : Port to connect to redis over.} {--redis-port= : Port to connect to redis over.}
{--settings-ui= : Enable or disable the settings UI.}'; {--settings-ui= : Enable or disable the settings UI.}
{--telemetry= : Enable or disable anonymous telemetry.}';
/** protected array $variables = [];
* @var array
*/
protected $variables = [];
/** /**
* AppSettingsCommand constructor. * AppSettingsCommand constructor.
*/ */
public function __construct(ConfigRepository $config, Kernel $command) public function __construct(private Kernel $console)
{ {
parent::__construct(); parent::__construct();
$this->command = $command;
$this->config = $config;
} }
/** /**
@ -91,67 +61,81 @@ class AppSettingsCommand extends Command
* *
* @throws \Pterodactyl\Exceptions\PterodactylException * @throws \Pterodactyl\Exceptions\PterodactylException
*/ */
public function handle() public function handle(): int
{ {
if (empty($this->config->get('hashids.salt')) || $this->option('new-salt')) { if (empty(config('hashids.salt')) || $this->option('new-salt')) {
$this->variables['HASHIDS_SALT'] = str_random(20); $this->variables['HASHIDS_SALT'] = str_random(20);
} }
$this->output->comment(trans('command/messages.environment.app.author_help')); $this->output->comment('Provide the email address that eggs exported by this Panel should be from. This should be a valid email address.');
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask( $this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
trans('command/messages.environment.app.author'), 'Egg Author Email',
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com') config('pterodactyl.service.author', 'unknown@unknown.com')
); );
$this->output->comment(trans('command/messages.environment.app.app_url_help')); if (!filter_var($this->variables['APP_SERVICE_AUTHOR'], FILTER_VALIDATE_EMAIL)) {
$this->output->error('The service author email provided is invalid.');
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->variables['APP_URL'] = $this->option('url') ?? $this->ask( $this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
trans('command/messages.environment.app.app_url'), 'Application URL',
$this->config->get('app.url', 'http://example.org') config('app.url', 'https://example.com')
); );
$this->output->comment(trans('command/messages.environment.app.timezone_help')); $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->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate( $this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
trans('command/messages.environment.app.timezone'), 'Application Timezone',
DateTimeZone::listIdentifiers(DateTimeZone::ALL), \DateTimeZone::listIdentifiers(),
$this->config->get('app.timezone') config('app.timezone')
); );
$selected = $this->config->get('cache.default', 'redis'); $selected = config('cache.default', 'redis');
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice( $this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
trans('command/messages.environment.app.cache_driver'), 'Cache Driver',
self::ALLOWED_CACHE_DRIVERS, self::CACHE_DRIVERS,
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null array_key_exists($selected, self::CACHE_DRIVERS) ? $selected : null
); );
$selected = $this->config->get('session.driver', 'redis'); $selected = config('session.driver', 'redis');
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice( $this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
trans('command/messages.environment.app.session_driver'), 'Session Driver',
self::ALLOWED_SESSION_DRIVERS, self::SESSION_DRIVERS,
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null array_key_exists($selected, self::SESSION_DRIVERS) ? $selected : null
); );
$selected = $this->config->get('queue.default', 'redis'); $selected = config('queue.default', 'redis');
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice( $this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
trans('command/messages.environment.app.queue_driver'), 'Queue Driver',
self::ALLOWED_QUEUE_DRIVERS, self::QUEUE_DRIVERS,
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null array_key_exists($selected, self::QUEUE_DRIVERS) ? $selected : null
); );
if (!is_null($this->option('settings-ui'))) { if (!is_null($this->option('settings-ui'))) {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true'; $this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
} else { } else {
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true'; $this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm('Enable UI based settings editor?', 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 // Make sure session cookies are set as "secure" when using HTTPS
if (strpos($this->variables['APP_URL'], 'https://') === 0) { if (str_starts_with($this->variables['APP_URL'], 'https://')) {
$this->variables['SESSION_SECURE_COOKIE'] = 'true'; $this->variables['SESSION_SECURE_COOKIE'] = 'true';
} }
$this->checkForRedis(); $this->checkForRedis();
$this->writeToEnvironment($this->variables); $this->writeToEnvironment($this->variables);
$this->info($this->command->output()); $this->info($this->console->output());
return 0;
} }
/** /**
@ -168,22 +152,22 @@ class AppSettingsCommand extends Command
return; return;
} }
$this->output->note(trans('command/messages.environment.app.using_redis')); $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->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask( $this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
trans('command/messages.environment.app.redis_host'), 'Redis Host',
$this->config->get('database.redis.default.host') config('database.redis.default.host')
); );
$askForRedisPassword = true; $askForRedisPassword = true;
if (!empty($this->config->get('database.redis.default.password'))) { if (!empty(config('database.redis.default.password'))) {
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password'); $this->variables['REDIS_PASSWORD'] = config('database.redis.default.password');
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined')); $askForRedisPassword = $this->confirm('It seems a password is already defined for Redis, would you like to change it?');
} }
if ($askForRedisPassword) { if ($askForRedisPassword) {
$this->output->comment(trans('command/messages.environment.app.redis_pass_help')); $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->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden( $this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
trans('command/messages.environment.app.redis_password') 'Redis Password'
); );
} }
@ -192,8 +176,8 @@ class AppSettingsCommand extends Command
} }
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask( $this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
trans('command/messages.environment.app.redis_port'), 'Redis Port',
$this->config->get('database.redis.default.port') config('database.redis.default.port')
); );
} }
} }

View File

@ -1,48 +1,18 @@
<?php <?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; namespace Pterodactyl\Console\Commands\Environment;
use PDOException;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use Pterodactyl\Traits\Commands\EnvironmentWriterTrait; use Pterodactyl\Traits\Commands\EnvironmentWriterTrait;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class DatabaseSettingsCommand extends Command class DatabaseSettingsCommand extends Command
{ {
use EnvironmentWriterTrait; 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.'; protected $description = 'Configure database settings for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:database protected $signature = 'p:environment:database
{--host= : The connection address for the MySQL server.} {--host= : The connection address for the MySQL server.}
{--port= : The connection port for the MySQL server.} {--port= : The connection port for the MySQL server.}
@ -50,71 +20,62 @@ class DatabaseSettingsCommand extends Command
{--username= : Username to use when connecting.} {--username= : Username to use when connecting.}
{--password= : Password to use for this database.}'; {--password= : Password to use for this database.}';
/** protected array $variables = [];
* @var array
*/
protected $variables = [];
/** /**
* DatabaseSettingsCommand constructor. * DatabaseSettingsCommand constructor.
*/ */
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console) public function __construct(private DatabaseManager $database, private Kernel $console)
{ {
parent::__construct(); parent::__construct();
$this->config = $config;
$this->console = $console;
$this->database = $database;
} }
/** /**
* Handle command execution. * Handle command execution.
* *
* @return int
*
* @throws \Pterodactyl\Exceptions\PterodactylException * @throws \Pterodactyl\Exceptions\PterodactylException
*/ */
public function handle() public function handle(): int
{ {
$this->output->note(trans('command/messages.environment.database.host_warning')); $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->variables['DB_HOST'] = $this->option('host') ?? $this->ask( $this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.database.host'), 'Database Host',
$this->config->get('database.connections.mysql.host', '127.0.0.1') config('database.connections.mysql.host', '127.0.0.1')
); );
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask( $this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
trans('command/messages.environment.database.port'), 'Database Port',
$this->config->get('database.connections.mysql.port', 3306) config('database.connections.mysql.port', 3306)
); );
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
trans('command/messages.environment.database.database'), 'Database Name',
$this->config->get('database.connections.mysql.database', 'panel') config('database.connections.mysql.database', 'panel')
); );
$this->output->note(trans('command/messages.environment.database.username_warning')); $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->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask( $this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.database.username'), 'Database Username',
$this->config->get('database.connections.mysql.username', 'pterodactyl') config('database.connections.mysql.username', 'pterodactyl')
); );
$askForMySQLPassword = true; $askForMySQLPassword = true;
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) { if (!empty(config('database.connections.mysql.password')) && $this->input->isInteractive()) {
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password'); $this->variables['DB_PASSWORD'] = config('database.connections.mysql.password');
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined')); $askForMySQLPassword = $this->confirm('It appears you already have a MySQL connection password defined, would you like to change it?');
} }
if ($askForMySQLPassword) { if ($askForMySQLPassword) {
$this->variables['DB_PASSWORD'] = $this->option('password') ?? $this->secret(trans('command/messages.environment.database.password')); $this->variables['DB_PASSWORD'] = $this->option('password') ?? $this->secret('Database Password');
} }
try { try {
$this->testMySQLConnection(); $this->testMySQLConnection();
} catch (PDOException $exception) { } catch (\PDOException $exception) {
$this->output->error(trans('command/messages.environment.database.connection_error', ['error' => $exception->getMessage()])); $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(trans('command/messages.environment.database.creds_not_saved')); $this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');
if ($this->confirm(trans('command/messages.environment.database.try_again'))) { if ($this->confirm('Go back and try again?')) {
$this->database->disconnect('_pterodactyl_command_test'); $this->database->disconnect('_pterodactyl_command_test');
return $this->handle(); return $this->handle();
@ -135,7 +96,7 @@ class DatabaseSettingsCommand extends Command
*/ */
private function testMySQLConnection() private function testMySQLConnection()
{ {
$this->config->set('database.connections._pterodactyl_command_test', [ config()->set('database.connections._pterodactyl_command_test', [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => $this->variables['DB_HOST'], 'host' => $this->variables['DB_HOST'],
'port' => $this->variables['DB_PORT'], 'port' => $this->variables['DB_PORT'],

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands\Environment;
@ -17,19 +10,8 @@ class EmailSettingsCommand extends Command
{ {
use EnvironmentWriterTrait; use EnvironmentWriterTrait;
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* @var string
*/
protected $description = 'Set or update the email sending configuration for the Panel.'; protected $description = 'Set or update the email sending configuration for the Panel.';
/**
* @var string
*/
protected $signature = 'p:environment:mail protected $signature = 'p:environment:mail
{--driver= : The mail driver to use.} {--driver= : The mail driver to use.}
{--email= : Email address that messages from the Panel will originate from.} {--email= : Email address that messages from the Panel will originate from.}
@ -41,19 +23,14 @@ class EmailSettingsCommand extends Command
{--username=} {--username=}
{--password=}'; {--password=}';
/** protected array $variables = [];
* @var array
*/
protected $variables = [];
/** /**
* EmailSettingsCommand constructor. * EmailSettingsCommand constructor.
*/ */
public function __construct(ConfigRepository $config) public function __construct(private ConfigRepository $config)
{ {
parent::__construct(); parent::__construct();
$this->config = $config;
} }
/** /**
@ -67,12 +44,12 @@ class EmailSettingsCommand extends Command
trans('command/messages.environment.mail.ask_driver'), trans('command/messages.environment.mail.ask_driver'),
[ [
'smtp' => 'SMTP Server', 'smtp' => 'SMTP Server',
'mail' => 'PHP\'s Internal Mail Function', 'sendmail' => 'sendmail Binary',
'mailgun' => 'Mailgun Transactional Email', 'mailgun' => 'Mailgun Transactional Email',
'mandrill' => 'Mandrill Transactional Email', 'mandrill' => 'Mandrill Transactional Email',
'postmark' => 'Postmarkapp Transactional Email', 'postmark' => 'Postmark Transactional Email',
], ],
$this->config->get('mail.driver', 'smtp') $this->config->get('mail.default', 'smtp')
); );
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';
@ -80,7 +57,7 @@ class EmailSettingsCommand extends Command
$this->{$method}(); $this->{$method}();
} }
$this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask( $this->variables['MAIL_FROM_ADDRESS'] = $this->option('email') ?? $this->ask(
trans('command/messages.environment.mail.ask_mail_from'), trans('command/messages.environment.mail.ask_mail_from'),
$this->config->get('mail.from.address') $this->config->get('mail.from.address')
); );
@ -90,12 +67,6 @@ class EmailSettingsCommand extends Command
$this->config->get('mail.from.name') $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->writeToEnvironment($this->variables);
$this->line('Updating stored environment configuration file.'); $this->line('Updating stored environment configuration file.');
@ -109,22 +80,28 @@ class EmailSettingsCommand extends Command
{ {
$this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask( $this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_host'), trans('command/messages.environment.mail.ask_smtp_host'),
$this->config->get('mail.host') $this->config->get('mail.mailers.smtp.host')
); );
$this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask( $this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_port'), trans('command/messages.environment.mail.ask_smtp_port'),
$this->config->get('mail.port') $this->config->get('mail.mailers.smtp.port')
); );
$this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask( $this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask(
trans('command/messages.environment.mail.ask_smtp_username'), trans('command/messages.environment.mail.ask_smtp_username'),
$this->config->get('mail.username') $this->config->get('mail.mailers.smtp.username')
); );
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret( $this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
trans('command/messages.environment.mail.ask_smtp_password') 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,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands;
@ -15,35 +8,16 @@ use Illuminate\Contracts\Config\Repository as ConfigRepository;
class InfoCommand extends Command class InfoCommand extends Command
{ {
/**
* @var string
*/
protected $description = 'Displays the application, database, and email configurations along with the panel version.'; 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'; protected $signature = 'p:info';
/**
* @var \Pterodactyl\Services\Helpers\SoftwareVersionService
*/
protected $versionService;
/** /**
* VersionCommand constructor. * VersionCommand constructor.
*/ */
public function __construct(ConfigRepository $config, SoftwareVersionService $versionService) public function __construct(private ConfigRepository $config, private SoftwareVersionService $versionService)
{ {
parent::__construct(); parent::__construct();
$this->config = $config;
$this->versionService = $versionService;
} }
/** /**
@ -78,33 +52,29 @@ class InfoCommand extends Command
$driver = $this->config->get('database.default'); $driver = $this->config->get('database.default');
$this->table([], [ $this->table([], [
['Driver', $driver], ['Driver', $driver],
['Host', $this->config->get("database.connections.{$driver}.host")], ['Host', $this->config->get("database.connections.$driver.host")],
['Port', $this->config->get("database.connections.{$driver}.port")], ['Port', $this->config->get("database.connections.$driver.port")],
['Database', $this->config->get("database.connections.{$driver}.database")], ['Database', $this->config->get("database.connections.$driver.database")],
['Username', $this->config->get("database.connections.{$driver}.username")], ['Username', $this->config->get("database.connections.$driver.username")],
], 'compact'); ], 'compact');
// TODO: Update this to handle other mail drivers
$this->output->title('Email Configuration'); $this->output->title('Email Configuration');
$this->table([], [ $this->table([], [
['Driver', $this->config->get('mail.driver')], ['Driver', $this->config->get('mail.default')],
['Host', $this->config->get('mail.host')], ['Host', $this->config->get('mail.mailers.smtp.host')],
['Port', $this->config->get('mail.port')], ['Port', $this->config->get('mail.mailers.smtp.port')],
['Username', $this->config->get('mail.username')], ['Username', $this->config->get('mail.mailers.smtp.username')],
['From Address', $this->config->get('mail.from.address')], ['From Address', $this->config->get('mail.from.address')],
['From Name', $this->config->get('mail.from.name')], ['From Name', $this->config->get('mail.from.name')],
['Encryption', $this->config->get('mail.encryption')], ['Encryption', $this->config->get('mail.mailers.smtp.encryption')],
], 'compact'); ], 'compact');
} }
/** /**
* Format output in a Name: Value manner. * Format output in a Name: Value manner.
*
* @param string $value
* @param string $opts
*
* @return string
*/ */
private function formatText($value, $opts = '') private function formatText(string $value, string $opts = ''): string
{ {
return sprintf('<%s>%s</>', $opts, $value); return sprintf('<%s>%s</>', $opts, $value);
} }

View File

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

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands\Location;
@ -14,31 +7,18 @@ use Pterodactyl\Services\Locations\LocationCreationService;
class MakeLocationCommand extends Command class MakeLocationCommand extends Command
{ {
/**
* @var \Pterodactyl\Services\Locations\LocationCreationService
*/
protected $creationService;
/**
* @var string
*/
protected $signature = 'p:location:make protected $signature = 'p:location:make
{--short= : The shortcode name of this location (ex. us1).} {--short= : The shortcode name of this location (ex. us1).}
{--long= : A longer description of this location.}'; {--long= : A longer description of this location.}';
/**
* @var string
*/
protected $description = 'Creates a new location on the system via the CLI.'; protected $description = 'Creates a new location on the system via the CLI.';
/** /**
* Create a new command instance. * Create a new command instance.
*/ */
public function __construct(LocationCreationService $creationService) public function __construct(private LocationCreationService $creationService)
{ {
parent::__construct(); parent::__construct();
$this->creationService = $creationService;
} }
/** /**

View File

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

View File

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

View File

@ -0,0 +1,69 @@
<?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

@ -0,0 +1,44 @@
<?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

@ -0,0 +1,34 @@
<?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

@ -13,14 +13,14 @@ class SeedCommand extends BaseSeedCommand
* Block someone from running this seed command if they have not completed * Block someone from running this seed command if they have not completed
* the migration process. * the migration process.
*/ */
public function handle() public function handle(): int
{ {
if (!$this->hasCompletedMigrations()) { if (!$this->hasCompletedMigrations()) {
$this->showMigrationWarning(); $this->showMigrationWarning();
return; return 1;
} }
parent::handle(); return parent::handle();
} }
} }

View File

@ -13,14 +13,14 @@ class UpCommand extends BaseUpCommand
* Block someone from running this up command if they have not completed * Block someone from running this up command if they have not completed
* the migration process. * the migration process.
*/ */
public function handle() public function handle(): int
{ {
if (!$this->hasCompletedMigrations()) { if (!$this->hasCompletedMigrations()) {
$this->showMigrationWarning(); $this->showMigrationWarning();
return; return 1;
} }
parent::handle(); return parent::handle() ?? 0;
} }
} }

View File

@ -3,30 +3,26 @@
namespace Pterodactyl\Console\Commands\Schedule; namespace Pterodactyl\Console\Commands\Schedule;
use Exception; use Exception;
use Throwable;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Schedule;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Database\Eloquent\Builder;
use Pterodactyl\Services\Schedules\ProcessScheduleService; use Pterodactyl\Services\Schedules\ProcessScheduleService;
class ProcessRunnableCommand extends Command class ProcessRunnableCommand extends Command
{ {
/**
* @var string
*/
protected $signature = 'p:schedule:process'; protected $signature = 'p:schedule:process';
/**
* @var string
*/
protected $description = 'Process schedules in the database and determine which are ready to run.'; protected $description = 'Process schedules in the database and determine which are ready to run.';
/** /**
* Handle command execution. * Handle command execution.
*/ */
public function handle() public function handle(): int
{ {
$schedules = Schedule::query()->with('tasks') $schedules = Schedule::query()
->with('tasks')
->whereRelation('server', fn (Builder $builder) => $builder->whereNull('status'))
->where('is_active', true) ->where('is_active', true)
->where('is_processing', false) ->where('is_processing', false)
->whereRaw('next_run_at <= NOW()') ->whereRaw('next_run_at <= NOW()')
@ -35,7 +31,7 @@ class ProcessRunnableCommand extends Command
if ($schedules->count() < 1) { if ($schedules->count() < 1) {
$this->line('There are no scheduled tasks for servers that need to be run.'); $this->line('There are no scheduled tasks for servers that need to be run.');
return; return 0;
} }
$bar = $this->output->createProgressBar(count($schedules)); $bar = $this->output->createProgressBar(count($schedules));
@ -47,6 +43,8 @@ class ProcessRunnableCommand extends Command
} }
$this->line(''); $this->line('');
return 0;
} }
/** /**
@ -69,10 +67,10 @@ class ProcessRunnableCommand extends Command
'schedule' => $schedule->name, 'schedule' => $schedule->name,
'hash' => $schedule->hashid, 'hash' => $schedule->hashid,
])); ]));
} catch (Throwable | Exception $exception) { } catch (\Throwable|\Exception $exception) {
Log::error($exception, ['schedule_id' => $schedule->id]); 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,6 +4,7 @@ namespace Pterodactyl\Console\Commands\Server;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Factory as ValidatorFactory; use Illuminate\Validation\Factory as ValidatorFactory;
use Pterodactyl\Repositories\Wings\DaemonPowerRepository; use Pterodactyl\Repositories\Wings\DaemonPowerRepository;
@ -11,31 +12,33 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
class BulkPowerActionCommand extends Command class BulkPowerActionCommand extends Command
{ {
/**
* @var string
*/
protected $signature = 'p:server:bulk-power protected $signature = 'p:server:bulk-power
{action : The action to perform (start, stop, restart, kill)} {action : The action to perform (start, stop, restart, kill)}
{--servers= : A comma separated list of servers.} {--servers= : A comma separated list of servers.}
{--nodes= : A comma separated list of nodes.}'; {--nodes= : A comma separated list of nodes.}';
/**
* @var string
*/
protected $description = 'Perform bulk power management on large groupings of servers or nodes at once.'; protected $description = 'Perform bulk power management on large groupings of servers or nodes at once.';
/**
* BulkPowerActionCommand constructor.
*/
public function __construct(private DaemonPowerRepository $powerRepository, private ValidatorFactory $validator)
{
parent::__construct();
}
/** /**
* Handle the bulk power request. * Handle the bulk power request.
* *
* @throws \Illuminate\Validation\ValidationException * @throws \Illuminate\Validation\ValidationException
*/ */
public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator) public function handle()
{ {
$action = $this->argument('action'); $action = $this->argument('action');
$nodes = empty($this->option('nodes')) ? [] : explode(',', $this->option('nodes')); $nodes = empty($this->option('nodes')) ? [] : explode(',', $this->option('nodes'));
$servers = empty($this->option('servers')) ? [] : explode(',', $this->option('servers')); $servers = empty($this->option('servers')) ? [] : explode(',', $this->option('servers'));
$validator = $validator->make([ $validator = $this->validator->make([
'action' => $action, 'action' => $action,
'nodes' => $nodes, 'nodes' => $nodes,
'servers' => $servers, 'servers' => $servers,
@ -61,6 +64,7 @@ class BulkPowerActionCommand extends Command
} }
$bar = $this->output->createProgressBar($count); $bar = $this->output->createProgressBar($count);
$powerRepository = $this->powerRepository;
$this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) { $this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) {
$bar->clear(); $bar->clear();
@ -84,10 +88,8 @@ class BulkPowerActionCommand extends Command
/** /**
* Returns the query builder instance that will return the servers that should be affected. * 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) protected function getQueryBuilder(array $servers, array $nodes): Builder
{ {
$instance = Server::query()->whereNull('status'); $instance = Server::query()->whereNull('status');

View File

@ -0,0 +1,34 @@
<?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,7 +2,6 @@
namespace Pterodactyl\Console\Commands; namespace Pterodactyl\Console\Commands;
use Closure;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Console\Kernel; use Pterodactyl\Console\Kernel;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
@ -12,7 +11,6 @@ class UpgradeCommand extends Command
{ {
protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/%s/panel.tar.gz'; protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/%s/panel.tar.gz';
/** @var string */
protected $signature = 'p:upgrade protected $signature = 'p:upgrade
{--user= : The user that PHP runs under. All files will be owned by this user.} {--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.} {--group= : The group that PHP runs under. All files will be owned by this group.}
@ -20,7 +18,6 @@ class UpgradeCommand extends Command
{--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.} {--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.}
{--skip-download : If set no archive will be downloaded.}'; {--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.'; protected $description = 'Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.';
/** /**
@ -57,7 +54,7 @@ class UpgradeCommand extends Command
$userDetails = posix_getpwuid(fileowner('public')); $userDetails = posix_getpwuid(fileowner('public'));
$user = $userDetails['name'] ?? 'www-data'; $user = $userDetails['name'] ?? 'www-data';
if (!$this->confirm("Your webserver user has been detected as [{$user}]: is this correct?", true)) { if (!$this->confirm("Your webserver user has been detected as <fg=blue>[{$user}]:</> is this correct?", true)) {
$user = $this->anticipate( $user = $this->anticipate(
'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data", "nginx", or "apache".', 'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data", "nginx", or "apache".',
[ [
@ -73,7 +70,7 @@ class UpgradeCommand extends Command
$groupDetails = posix_getgrgid(filegroup('public')); $groupDetails = posix_getgrgid(filegroup('public'));
$group = $groupDetails['name'] ?? 'www-data'; $group = $groupDetails['name'] ?? 'www-data';
if (!$this->confirm("Your webserver group has been detected as [{$group}]: is this correct?", true)) { if (!$this->confirm("Your webserver group has been detected as <fg=blue>[{$group}]:</> is this correct?", true)) {
$group = $this->anticipate( $group = $this->anticipate(
'Please enter the name of the group running your webserver process. Normally this is the same as your user.', 'Please enter the name of the group running your webserver process. Normally this is the same as your user.',
[ [
@ -86,11 +83,13 @@ class UpgradeCommand extends Command
} }
if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) { if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) {
$this->warn('Upgrade process terminated by user.');
return; return;
} }
} }
ini_set('output_buffering', 0); ini_set('output_buffering', '0');
$bar = $this->output->createProgressBar($skipDownload ? 9 : 10); $bar = $this->output->createProgressBar($skipDownload ? 9 : 10);
$bar->start(); $bar->start();
@ -173,11 +172,11 @@ class UpgradeCommand extends Command
$this->call('up'); $this->call('up');
}); });
$this->newLine(); $this->newLine(2);
$this->info('Finished running upgrade.'); $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(); $bar->clear();
$callback(); $callback();

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands\User;
@ -16,42 +9,19 @@ use Pterodactyl\Services\Users\UserDeletionService;
class DeleteUserCommand extends Command 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.'; 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=}'; protected $signature = 'p:user:delete {--user=}';
/** /**
* DeleteUserCommand constructor. * DeleteUserCommand constructor.
*/ */
public function __construct(UserDeletionService $deletionService) public function __construct(private UserDeletionService $deletionService)
{ {
parent::__construct(); parent::__construct();
$this->deletionService = $deletionService;
} }
/** public function handle(): int
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function handle()
{ {
$search = $this->option('user') ?? $this->ask(trans('command/messages.user.search_users')); $search = $this->option('user') ?? $this->ask(trans('command/messages.user.search_users'));
Assert::notEmpty($search, 'Search term should be an email address, got: %s.'); Assert::notEmpty($search, 'Search term should be an email address, got: %s.');
@ -68,7 +38,7 @@ class DeleteUserCommand extends Command
return $this->handle(); return $this->handle();
} }
return false; return 1;
} }
if ($this->input->isInteractive()) { if ($this->input->isInteractive()) {
@ -85,7 +55,7 @@ class DeleteUserCommand extends Command
if (count($results) > 1) { if (count($results) > 1) {
$this->error(trans('command/messages.user.multiple_found')); $this->error(trans('command/messages.user.multiple_found'));
return false; return 1;
} }
$deleteUser = $results->first(); $deleteUser = $results->first();
@ -95,5 +65,7 @@ class DeleteUserCommand extends Command
$this->deletionService->handle($deleteUser); $this->deletionService->handle($deleteUser);
$this->info(trans('command/messages.user.deleted')); $this->info(trans('command/messages.user.deleted'));
} }
return 0;
} }
} }

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands\User;
@ -14,29 +7,16 @@ use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class DisableTwoFactorCommand extends Command class DisableTwoFactorCommand extends Command
{ {
/**
* @var string
*/
protected $description = 'Disable two-factor authentication for a specific user in the Panel.'; 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.}'; protected $signature = 'p:user:disable2fa {--email= : The email of the user to disable 2-Factor for.}';
/** /**
* DisableTwoFactorCommand constructor. * DisableTwoFactorCommand constructor.
*/ */
public function __construct(UserRepositoryInterface $repository) public function __construct(private UserRepositoryInterface $repository)
{ {
parent::__construct(); parent::__construct();
$this->repository = $repository;
} }
/** /**

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Console\Commands\User;
@ -14,29 +7,16 @@ use Pterodactyl\Services\Users\UserCreationService;
class MakeUserCommand extends Command class MakeUserCommand extends Command
{ {
/**
* @var \Pterodactyl\Services\Users\UserCreationService
*/
protected $creationService;
/**
* @var string
*/
protected $description = 'Creates a user on the system via the CLI.'; 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}'; protected $signature = 'p:user:make {--email=} {--username=} {--name-first=} {--name-last=} {--password=} {--admin=} {--no-password}';
/** /**
* MakeUserCommand constructor. * MakeUserCommand constructor.
*/ */
public function __construct(UserCreationService $creationService) public function __construct(private UserCreationService $creationService)
{ {
parent::__construct(); parent::__construct();
$this->creationService = $creationService;
} }
/** /**

View File

@ -0,0 +1,33 @@
<?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,15 +2,23 @@
namespace Pterodactyl\Console; namespace Pterodactyl\Console;
use Ramsey\Uuid\Uuid;
use Pterodactyl\Models\ActivityLog;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Console\PruneCommand;
use Pterodactyl\Repositories\Eloquent\SettingsRepository;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; 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 class Kernel extends ConsoleKernel
{ {
/** /**
* Register the commands for the application. * Register the commands for the application.
*/ */
protected function commands() protected function commands(): void
{ {
$this->load(__DIR__ . '/Commands'); $this->load(__DIR__ . '/Commands');
} }
@ -18,17 +26,51 @@ class Kernel extends ConsoleKernel
/** /**
* Define the application's command schedule. * Define the application's command schedule.
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule): void
{ {
// 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. // Execute scheduled commands for servers every minute, as if there was a normal cron running.
$schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping(); $schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
if (config('backups.prune_age')) { if (config('backups.prune_age')) {
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
$schedule->command('p:maintenance:prune-backups')->everyThirtyMinutes(); $schedule->command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes();
} }
// Every day cleanup any internal backups of service files. if (config('activity.prune_days')) {
$schedule->command('p:maintenance:clean-service-backups')->daily(); $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");
} }
} }

View File

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

View File

@ -1,24 +1,14 @@
<?php <?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; namespace Pterodactyl\Contracts\Criteria;
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Repositories\Repository; use Pterodactyl\Repositories\Repository;
interface CriteriaInterface interface CriteriaInterface
{ {
/** /**
* Apply selected criteria to a repository call. * Apply selected criteria to a repository call.
*
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return mixed
*/ */
public function apply($model, Repository $repository); public function apply(Model $model, Repository $repository): mixed;
} }

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Contracts\Extensions;
@ -16,12 +9,7 @@ interface HashidsInterface extends VendorHashidsInterface
/** /**
* Decode an encoded hashid and return the first result. * Decode an encoded hashid and return the first result.
* *
* @param string $encoded
* @param null $default
*
* @return mixed
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function decodeFirst($encoded, $default = null); public function decodeFirst(string $encoded, string $default = null): mixed;
} }

View File

@ -6,7 +6,7 @@ interface ClientPermissionsRequest
{ {
/** /**
* Returns the permissions string indicating which permission should be used to * Returns the permissions string indicating which permission should be used to
* validate that the authenticated user has permission to perform this action aganist * validate that the authenticated user has permission to perform this action against
* the given resource (server). * the given resource (server).
*/ */
public function permission(): string; public function permission(): string;

View File

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

View File

@ -8,12 +8,12 @@ use Illuminate\Support\Collection;
interface ApiKeyRepositoryInterface extends RepositoryInterface interface ApiKeyRepositoryInterface extends RepositoryInterface
{ {
/** /**
* Get all of the account API keys that exist for a specific user. * Get all the account API keys that exist for a specific user.
*/ */
public function getAccountKeys(User $user): Collection; public function getAccountKeys(User $user): Collection;
/** /**
* Get all of the application API keys that exist for a specific user. * Get all the application API keys that exist for a specific user.
*/ */
public function getApplicationKeys(User $user): Collection; public function getApplicationKeys(User $user): Collection;

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Contracts\Repository;

View File

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

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Contracts\Repository;
@ -28,13 +21,11 @@ interface EggRepositoryInterface extends RepositoryInterface
/** /**
* Return an egg with the scriptFrom and configFrom relations loaded onto the model. * Return an egg with the scriptFrom and configFrom relations loaded onto the model.
*
* @param int|string $value
*/ */
public function getWithCopyAttributes($value, string $column = 'id'): Egg; public function getWithCopyAttributes(int|string $value, string $column = 'id'): Egg;
/** /**
* Return all of the data needed to export a service. * Return all the data needed to export a service.
* *
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Contracts\Repository;

View File

@ -13,14 +13,12 @@ interface LocationRepositoryInterface extends RepositoryInterface
public function getAllWithDetails(): Collection; public function getAllWithDetails(): Collection;
/** /**
* Return all of the available locations with the nodes as a relationship. * Return all the available locations with the nodes as a relationship.
*/ */
public function getAllWithNodes(): Collection; public function getAllWithNodes(): Collection;
/** /**
* Return all of the nodes and their respective count of servers for a location. * Return all the nodes and their respective count of servers for a location.
*
* @return mixed
* *
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
@ -29,8 +27,6 @@ interface LocationRepositoryInterface extends RepositoryInterface
/** /**
* Return a location and the count of nodes in that location. * Return a location and the count of nodes in that location.
* *
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function getWithNodeCount(int $id): Location; public function getWithNodeCount(int $id): Location;

View File

@ -1,37 +1,25 @@
<?php <?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; namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Nest; use Pterodactyl\Models\Nest;
use Illuminate\Database\Eloquent\Collection;
interface NestRepositoryInterface extends RepositoryInterface interface NestRepositoryInterface extends RepositoryInterface
{ {
/** /**
* Return a nest or all nests with their associated eggs and variables. * Return a nest or all nests with their associated eggs and variables.
* *
* @param int $id
*
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function getWithEggs(int $id = null); public function getWithEggs(int $id = null): Collection|Nest;
/** /**
* Return a nest or all nests and the count of eggs and servers for that nest. * Return a nest or all nests and the count of eggs and servers for that nest.
* *
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function getWithCounts(int $id = null); public function getWithCounts(int $id = null): Collection|Nest;
/** /**
* Return a nest along with its associated eggs and the servers relation on those eggs. * Return a nest along with its associated eggs and the servers relation on those eggs.

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Contracts\Repository;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,34 @@
<?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

@ -0,0 +1,13 @@
<?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,43 +1,18 @@
<?php <?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; namespace Pterodactyl\Events\Auth;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FailedCaptcha class FailedCaptcha extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The IP that the request originated from.
*
* @var string
*/
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. * Create a new event instance.
*
* @param string $ip
* @param string $domain
*/ */
public function __construct($ip, $domain) public function __construct(public string $ip, public string $domain)
{ {
$this->ip = $ip;
$this->domain = $domain;
} }
} }

View File

@ -1,43 +1,18 @@
<?php <?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; namespace Pterodactyl\Events\Auth;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FailedPasswordReset class FailedPasswordReset extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The IP that the request originated from.
*
* @var string
*/
public $ip;
/**
* The email address that was used when the reset request failed.
*
* @var string
*/
public $email;
/** /**
* Create a new event instance. * Create a new event instance.
*
* @param string $ip
* @param string $email
*/ */
public function __construct($ip, $email) public function __construct(public string $ip, public string $email)
{ {
$this->ip = $ip;
$this->email = $email;
} }
} }

View File

@ -0,0 +1,13 @@
<?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,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Created class Created extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Creating class Creating extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleted class Deleted extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleting class Deleting extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

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

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Saved class Saved extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Saving class Saving extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Updated class Updated extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Server;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Updating class Updating extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Server $server) public function __construct(public Server $server)
{ {
$this->server = $server;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Created class Created extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Subuser $subuser) public function __construct(public Subuser $subuser)
{ {
$this->subuser = $subuser;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Creating class Creating extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Subuser $subuser) public function __construct(public Subuser $subuser)
{ {
$this->subuser = $subuser;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleted class Deleted extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Subuser $subuser) public function __construct(public Subuser $subuser)
{ {
$this->subuser = $subuser;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\Subuser;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleting class Deleting extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(Subuser $subuser) public function __construct(public Subuser $subuser)
{ {
$this->subuser = $subuser;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Created class Created extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(User $user) public function __construct(public User $user)
{ {
$this->user = $user;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Creating class Creating extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(User $user) public function __construct(public User $user)
{ {
$this->user = $user;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleted class Deleted extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(User $user) public function __construct(public User $user)
{ {
$this->user = $user;
} }
} }

View File

@ -1,33 +1,19 @@
<?php <?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; namespace Pterodactyl\Events\User;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Events\Event;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Deleting class Deleting extends Event
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(User $user) public function __construct(public User $user)
{ {
$this->user = $user;
} }
} }

View File

@ -1,16 +1,7 @@
<?php <?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; namespace Pterodactyl\Exceptions;
use Exception; class AccountNotFoundException extends \Exception
class AccountNotFoundException extends Exception
{ {
} }

View File

@ -1,16 +1,7 @@
<?php <?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; namespace Pterodactyl\Exceptions;
use Exception; class AutoDeploymentException extends \Exception
class AutoDeploymentException extends Exception
{ {
} }

View File

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

View File

@ -3,22 +3,22 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; use Exception;
use Throwable;
use PDOException;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Swift_TransportException;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Illuminate\Database\Connection; use Illuminate\Database\Connection;
use Illuminate\Http\RedirectResponse;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use Illuminate\Session\TokenMismatchException; use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Mailer\Exception\TransportException;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
@ -26,7 +26,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
* Laravel's validation parser formats custom rules using the class name * The validation parser in Laravel formats custom rules using the class name
* resulting in some weird rule names. This string will be parsed out and * resulting in some weird rule names. This string will be parsed out and
* replaced with 'p_' in the response code. * replaced with 'p_' in the response code.
*/ */
@ -34,8 +34,6 @@ class Handler extends ExceptionHandler
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that should not be reported.
*
* @var array
*/ */
protected $dontReport = [ protected $dontReport = [
AuthenticationException::class, AuthenticationException::class,
@ -47,10 +45,18 @@ class Handler extends ExceptionHandler
ValidationException::class, 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. * A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/ */
protected $dontFlash = [ protected $dontFlash = [
'token', 'token',
@ -67,22 +73,22 @@ class Handler extends ExceptionHandler
* *
* @noinspection PhpUnusedLocalVariableInspection * @noinspection PhpUnusedLocalVariableInspection
*/ */
public function register() public function register(): void
{ {
if (config('app.exceptions.report_all', false)) { if (config('app.exceptions.report_all', false)) {
$this->dontReport = []; $this->dontReport = [];
} }
$this->reportable(function (PDOException $ex) { $this->reportable(function (\PDOException $ex) {
$ex = $this->generateCleanedExceptionStack($ex); $ex = $this->generateCleanedExceptionStack($ex);
}); });
$this->reportable(function (Swift_TransportException $ex) { $this->reportable(function (TransportException $ex) {
$ex = $this->generateCleanedExceptionStack($ex); $ex = $this->generateCleanedExceptionStack($ex);
}); });
} }
private function generateCleanedExceptionStack(Throwable $exception): string private function generateCleanedExceptionStack(\Throwable $exception): string
{ {
$cleanedStack = ''; $cleanedStack = '';
foreach ($exception->getTrace() as $index => $item) { foreach ($exception->getTrace() as $index => $item) {
@ -113,11 +119,9 @@ class Handler extends ExceptionHandler
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* *
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable * @throws \Throwable
*/ */
public function render($request, Throwable $exception) public function render($request, \Throwable $e): Response
{ {
$connections = $this->container->make(Connection::class); $connections = $this->container->make(Connection::class);
@ -134,7 +138,7 @@ class Handler extends ExceptionHandler
$connections->rollBack(0); $connections->rollBack(0);
} }
return parent::render($request, $exception); return parent::render($request, $e);
} }
/** /**
@ -142,10 +146,8 @@ class Handler extends ExceptionHandler
* calls to the API. * calls to the API.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
*/ */
public function invalidJson($request, ValidationException $exception) public function invalidJson($request, ValidationException $exception): JsonResponse
{ {
$codes = Collection::make($exception->validator->failed())->mapWithKeys(function ($reasons, $field) { $codes = Collection::make($exception->validator->failed())->mapWithKeys(function ($reasons, $field) {
$cleaned = []; $cleaned = [];
@ -167,9 +169,9 @@ class Handler extends ExceptionHandler
)), )),
]; ];
$converted = self::convertToArray($exception)['errors'][0]; $converted = $this->convertExceptionToArray($exception)['errors'][0];
$converted['detail'] = $error; $converted['detail'] = $error;
$converted['meta'] = is_array($converted['meta'] ?? null) ? array_merge($converted['meta'], $meta) : $meta; $converted['meta'] = array_merge($converted['meta'] ?? [], $meta);
$response[] = $converted; $response[] = $converted;
} }
@ -185,19 +187,21 @@ class Handler extends ExceptionHandler
/** /**
* Return the exception as a JSONAPI representation for use on API requests. * Return the exception as a JSONAPI representation for use on API requests.
*/ */
public static function convertToArray(Throwable $exception, array $override = []): array protected function convertExceptionToArray(\Throwable $e, array $override = []): array
{ {
$match = self::$exceptionResponseCodes[get_class($e)] ?? null;
$error = [ $error = [
'code' => class_basename($exception), 'code' => class_basename($e),
'status' => method_exists($exception, 'getStatusCode') 'status' => method_exists($e, 'getStatusCode')
? strval($exception->getStatusCode()) ? strval($e->getStatusCode())
: ($exception instanceof ValidationException ? '422' : '500'), : strval($match ?? '500'),
'detail' => $exception instanceof HttpExceptionInterface 'detail' => $e instanceof HttpExceptionInterface || !is_null($match)
? $exception->getMessage() ? $e->getMessage()
: 'An unexpected error was encountered while processing this request, please try again.', : 'An unexpected error was encountered while processing this request, please try again.',
]; ];
if ($exception instanceof ModelNotFoundException || $exception->getPrevious() instanceof ModelNotFoundException) { if ($e instanceof ModelNotFoundException || $e->getPrevious() instanceof ModelNotFoundException) {
// Show a nicer error message compared to the standard "No query results for model" // 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 // 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. // with a more specific error message to help narrow down things.
@ -206,13 +210,19 @@ class Handler extends ExceptionHandler
if (config('app.debug')) { if (config('app.debug')) {
$error = array_merge($error, [ $error = array_merge($error, [
'detail' => $exception->getMessage(), 'detail' => $e->getMessage(),
'source' => [ 'source' => [
'line' => $exception->getLine(), 'line' => $e->getLine(),
'file' => str_replace(Application::getInstance()->basePath(), '', $exception->getFile()), 'file' => str_replace(Application::getInstance()->basePath(), '', $e->getFile()),
], ],
'meta' => [ 'meta' => [
'trace' => explode("\n", $exception->getTraceAsString()), '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(),
], ],
]); ]);
} }
@ -223,7 +233,7 @@ class Handler extends ExceptionHandler
/** /**
* Return an array of exceptions that should not be reported. * 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); return (new static(Container::getInstance()))->shouldReport($exception);
} }
@ -232,26 +242,42 @@ class Handler extends ExceptionHandler
* Convert an authentication exception into an unauthenticated response. * Convert an authentication exception into an unauthenticated response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/ */
protected function unauthenticated($request, AuthenticationException $exception) protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
{ {
if ($request->expectsJson()) { if ($request->expectsJson()) {
return new JsonResponse(self::convertToArray($exception), JsonResponse::HTTP_UNAUTHORIZED); return new JsonResponse($this->convertExceptionToArray($exception), JsonResponse::HTTP_UNAUTHORIZED);
} }
return $this->container->make('redirect')->guest('/auth/login'); return redirect()->guest('/auth/login');
} }
/** /**
* Converts an exception into an array to render in the response. Overrides * Extracts all the previous exceptions that lead to the one passed into this
* Laravel's built-in converter to output as a JSONAPI spec compliant object. * function being thrown.
* *
* @return array * @return \Throwable[]
*/ */
protected function convertExceptionToArray(Throwable $exception) protected function extractPrevious(\Throwable $e): array
{ {
return self::convertToArray($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);
} }
} }

View File

@ -1,11 +1,4 @@
<?php <?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; namespace Pterodactyl\Exceptions\Http\Base;

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