From ba18f7d3c60a163897c00fe888581800f168b978 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 3 Aug 2021 06:04:13 +0300 Subject: [PATCH 01/10] Update Ark Survival Evolved Egg (#3513) Updates Ark Survival Evolved egg to fix some common issues and requests. RCON Password is required for RCON to function and has been changed from nullable to required. The option to disable RCON is removed because RCON is required. Added additional arguments variable to resolve users' issues inserting them in the wrong place due to the complicated startup parameters. Removed deprecated userInteraction and logslocation from the egg. --- .../egg-ark--survival-evolved.json | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json b/database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json index e5b05a6db..172a9824a 100644 --- a/database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json +++ b/database/Seeders/eggs/source-engine/egg-ark--survival-evolved.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-06-10T00:43:46+03:00", + "exported_at": "2021-07-27T14:14:20+03:00", "name": "Ark: Survival Evolved", "author": "dev@shepper.fr", "description": "As a man or woman stranded, naked, freezing, and starving on the unforgiving shores of a mysterious island called ARK, use your skill and cunning to kill or tame and ride the plethora of leviathan dinosaurs and other primeval creatures roaming the land. Hunt, harvest resources, craft items, grow crops, research technologies, and build shelters to withstand the elements and store valuables, all while teaming up with (or preying upon) hundreds of other players to survive, dominate... and escape! \u2014 Gamepedia: ARK", @@ -13,11 +13,11 @@ "quay.io\/parkervcp\/pterodactyl-images:debian_source" ], "file_denylist": [], - "startup": "rmv() { echo -e \"stopping server\"; rcon -t rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD} -c saveworld && rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD} -c DoExit; }; trap rmv 15; cd ShooterGame\/Binaries\/Linux && .\/ShooterGameServer {{SERVER_MAP}}?listen?SessionName=\"{{SESSION_NAME}}\"?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?RCONPort={{RCON_PORT}}?QueryPort={{QUERY_PORT}}?RCONEnabled={{ENABLE_RCON}}$( [ \"$BATTLE_EYE\" == \"0\" ] || printf %s '?-NoBattlEye' ) -server -log & until echo \"waiting for rcon connection...\"; rcon -t rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD}; do sleep 5; done", + "startup": "rmv() { echo -e \"stopping server\"; rcon -t rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD} -c saveworld && rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD} -c DoExit; }; trap rmv 15; cd ShooterGame\/Binaries\/Linux && .\/ShooterGameServer {{SERVER_MAP}}?listen?SessionName=\"{{SESSION_NAME}}\"?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?RCONPort={{RCON_PORT}}?QueryPort={{QUERY_PORT}}?RCONEnabled=True$( [ \"$BATTLE_EYE\" == \"0\" ] || printf %s '?-NoBattlEye' ) -server {{ARGS}} -log & until echo \"waiting for rcon connection...\"; rcon -t rcon -a 127.0.0.1:${RCON_PORT} -p ${ARK_ADMIN_PASSWORD}; do sleep 5; done", "config": { "files": "{}", - "startup": "{\r\n \"done\": \"Waiting commands for 127.0.0.1:\",\r\n \"userInteraction\": []\r\n}", - "logs": "{\r\n \"custom\": true,\r\n \"location\": \"logs\/latest.log\"\r\n}", + "startup": "{\r\n \"done\": \"Waiting commands for 127.0.0.1:\"\r\n}", + "logs": "{}", "stop": "^C" }, "scripts": { @@ -44,7 +44,7 @@ "default_value": "PleaseChangeMe", "user_viewable": true, "user_editable": true, - "rules": "nullable|alpha_dash|between:1,100" + "rules": "required|alpha_dash|between:1,100" }, { "name": "Server Map", @@ -55,15 +55,6 @@ "user_editable": true, "rules": "required|string|max:20" }, - { - "name": "App ID", - "description": "ARK steam app id for auto updates. Leave blank to avoid auto update.", - "env_variable": "SRCDS_APPID", - "default_value": "376030", - "user_viewable": true, - "user_editable": false, - "rules": "nullable|numeric" - }, { "name": "Server Name", "description": "ARK server name", @@ -73,15 +64,6 @@ "user_editable": true, "rules": "required|string|max:128" }, - { - "name": "Use Rcon", - "description": "Enable or disable rcon system. (true or false)\r\n\r\nDefault True for the console to work.", - "env_variable": "ENABLE_RCON", - "default_value": "True", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|in:True,False" - }, { "name": "Rcon Port", "description": "ARK rcon port used by rcon tools.", @@ -117,6 +99,24 @@ "user_viewable": true, "user_editable": true, "rules": "required|boolean" + }, + { + "name": "App ID", + "description": "ARK steam app id for auto updates. Leave blank to avoid auto update.", + "env_variable": "SRCDS_APPID", + "default_value": "376030", + "user_viewable": true, + "user_editable": false, + "rules": "nullable|numeric" + }, + { + "name": "Additional Arguments", + "description": "Specify additional launch parameters such as -crossplay. You must include a dash - and separate each parameter with space: -crossplay -exclusivejoin", + "env_variable": "ARGS", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string" } ] -} +} \ No newline at end of file From 556deedcc14c916afdfa490a18248d32a158a00c Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 3 Aug 2021 06:04:23 +0300 Subject: [PATCH 02/10] fix: enable editing paper and spongeforge version variable input (#3509) Changes the paper and spongeforge version variable to be editable by users on the client view. There is no reason to have it as read-only. Other eggs have this value as editable --- database/Seeders/eggs/minecraft/egg-paper.json | 8 ++++---- .../eggs/minecraft/egg-sponge--sponge-vanilla.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/database/Seeders/eggs/minecraft/egg-paper.json b/database/Seeders/eggs/minecraft/egg-paper.json index f7b584b6b..5665b3696 100644 --- a/database/Seeders/eggs/minecraft/egg-paper.json +++ b/database/Seeders/eggs/minecraft/egg-paper.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-07-24T11:38:02+03:00", + "exported_at": "2021-08-01T03:54:45+03:00", "name": "Paper", "author": "parker@pterodactyl.io", "description": "High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.", @@ -38,7 +38,7 @@ "env_variable": "MINECRAFT_VERSION", "default_value": "latest", "user_viewable": true, - "user_editable": false, + "user_editable": true, "rules": "nullable|string|max:20" }, { @@ -65,8 +65,8 @@ "env_variable": "BUILD_NUMBER", "default_value": "latest", "user_viewable": true, - "user_editable": false, + "user_editable": true, "rules": "required|string|max:20" } ] -} \ No newline at end of file +} diff --git a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json index c69ce8cd0..1b5aaf351 100644 --- a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json +++ b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-07-04T19:19:11-04:00", + "exported_at": "2021-08-01T03:55:24+03:00", "name": "Sponge (SpongeVanilla)", "author": "support@pterodactyl.io", "description": "SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.", @@ -21,7 +21,7 @@ "config": { "files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"enable-query\": \"true\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}", "startup": "{\r\n \"done\": \")! For help, type \"\r\n}", - "logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}", + "logs": "{}", "stop": "stop" }, "scripts": { @@ -38,7 +38,7 @@ "env_variable": "SPONGE_VERSION", "default_value": "1.12.2-7.3.0", "user_viewable": true, - "user_editable": false, + "user_editable": true, "rules": "required|regex:\/^([a-zA-Z0-9.\\-_]+)$\/" }, { @@ -51,4 +51,4 @@ "rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/" } ] -} \ No newline at end of file +} From a78404fdbebf100d957d733f56dd615064d8a274 Mon Sep 17 00:00:00 2001 From: Faye Date: Tue, 3 Aug 2021 05:05:27 +0200 Subject: [PATCH 03/10] Update SECURITY.md (#3483) --- SECURITY.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 7b99461de..5b412f853 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -5,8 +5,10 @@ The following versions of Pterodactyl are receiving active support and maintenan | Panel | Daemon | Supported | | ----- | ------------ | ------------------ | -| 1.2.x | wings@1.2.x | :white_check_mark: | -| 1.1.x | wings@1.1.x | :white_check_mark: | +| 1.4.x | wings@1.4.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.6.x | daemon@0.5.x | :x: | From 208a547a2a79ae20f1ad4d3f46da9a734b17fae8 Mon Sep 17 00:00:00 2001 From: VibeGAMESNL <66668585+VibeGAMESNL@users.noreply.github.com> Date: Tue, 3 Aug 2021 05:06:33 +0200 Subject: [PATCH 04/10] Adding VibeGAMES as a sponsor (#3504) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f19eba47a..333a9b226 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ I would like to extend my sincere thanks to the following sponsors for helping f | [**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! | | [**ByteAnia**](https://byteania.com/?utm_source=pterodactyl) | ByteAnia offers the best performing and most affordable **Ryzen 5000 Series hosting** on the market for *unbeatable prices*! | | [**Aussie Server Hosts**](https://aussieserverhosts.com/) | No frills Australian Owned and operated High Performance Server hosting for some of the most demanding games serving Australia and New Zealand. | +| [**VibeGAMES**](https://vibegames.net/) | VibeGAMES is a game server provider that specializes in DDOS protection for the games we offer. We have multiple locations in the US, Brazil, France, Germany, Singapore, Australia and South Africa.| ## Documentation * [Panel Documentation](https://pterodactyl.io/panel/1.0/getting_started.html) @@ -65,7 +66,6 @@ and there are plenty more games available provided by the community. Some of the * San Andreas: MP * Pocketmine MP * Squad -* FiveM * Xonotic * Starmade * Discord ATLBot, and most other Node.js/Python discord bots From e8746feb97d627faf3c94827541b801bfde56c08 Mon Sep 17 00:00:00 2001 From: Triassic <40073455+RealTriassic@users.noreply.github.com> Date: Tue, 3 Aug 2021 06:07:26 +0300 Subject: [PATCH 05/10] Fix a typo in DisableTwoFactorModal.tsx (#3507) --- .../components/dashboard/forms/DisableTwoFactorModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx b/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx index 17af9b7f6..854d0837a 100644 --- a/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx +++ b/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx @@ -43,7 +43,7 @@ const DisableTwoFactorModal = () => { password: '', }} validationSchema={object().shape({ - password: string().required('You must provider your current password in order to continue.'), + password: string().required('You must provide your current password in order to continue.'), })} > {({ isValid }) => ( From 9c64fb29a4a08e9aa328ec7de80f8b78d46168a8 Mon Sep 17 00:00:00 2001 From: Linux123123 Date: Tue, 3 Aug 2021 06:07:39 +0300 Subject: [PATCH 06/10] Fix ScheduleEdit page not working directly by url (#3477) --- .../components/server/schedules/ScheduleContainer.tsx | 2 +- .../server/schedules/ScheduleEditContainer.tsx | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/resources/scripts/components/server/schedules/ScheduleContainer.tsx b/resources/scripts/components/server/schedules/ScheduleContainer.tsx index 85e6db20d..c1609674a 100644 --- a/resources/scripts/components/server/schedules/ScheduleContainer.tsx +++ b/resources/scripts/components/server/schedules/ScheduleContainer.tsx @@ -58,7 +58,7 @@ export default () => { css={tw`cursor-pointer mb-2 flex-wrap`} onClick={(e: any) => { e.preventDefault(); - history.push(`${match.url}/${schedule.id}`, { schedule }); + history.push(`${match.url}/${schedule.id}`); }} > diff --git a/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx b/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx index 720f0c728..fdd602304 100644 --- a/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx +++ b/resources/scripts/components/server/schedules/ScheduleEditContainer.tsx @@ -1,6 +1,5 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { useHistory, useLocation, useParams } from 'react-router-dom'; -import { Schedule } from '@/api/server/schedules/getServerSchedules'; +import { useHistory, useParams } from 'react-router-dom'; import getServerSchedule from '@/api/server/schedules/getServerSchedule'; import Spinner from '@/components/elements/Spinner'; import FlashMessageRender from '@/components/FlashMessageRender'; @@ -23,10 +22,6 @@ interface Params { id: string; } -interface State { - schedule?: Schedule; -} - const CronBox = ({ title, value }: { title: string; value: string }) => (

{title}

@@ -47,7 +42,6 @@ const ActivePill = ({ active }: { active: boolean }) => ( export default () => { const history = useHistory(); - const { state } = useLocation(); const { id: scheduleId } = useParams(); const id = ServerContext.useStoreState(state => state.server.data!.id); @@ -57,7 +51,7 @@ export default () => { const [ isLoading, setIsLoading ] = useState(true); const [ showEditModal, setShowEditModal ] = useState(false); - const schedule = ServerContext.useStoreState(st => st.schedules.data.find(s => s.id === state.schedule?.id), isEqual); + const schedule = ServerContext.useStoreState(st => st.schedules.data.find(s => s.id === Number(scheduleId)), isEqual); const appendSchedule = ServerContext.useStoreActions(actions => actions.schedules.appendSchedule); useEffect(() => { From 924f00ac9aa20a0b100996655a5b61b00aa15d55 Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Mon, 2 Aug 2021 23:32:10 -0400 Subject: [PATCH 07/10] Java Docker image updater feature (#3430) Co-Authored-By: Lance Pioch --- .../components/server/ServerConsole.tsx | 3 +- .../features/JavaVersionModalFeature.tsx | 105 ++++++++++++++++++ .../server/features/eula/EulaModalFeature.tsx | 43 ++++--- .../components/server/features/index.ts | 3 +- 4 files changed, 129 insertions(+), 25 deletions(-) create mode 100644 resources/scripts/components/server/features/JavaVersionModalFeature.tsx diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx index 48385d7c0..95d595add 100644 --- a/resources/scripts/components/server/ServerConsole.tsx +++ b/resources/scripts/components/server/ServerConsole.tsx @@ -7,7 +7,7 @@ import ServerContentBlock from '@/components/elements/ServerContentBlock'; import ServerDetailsBlock from '@/components/server/ServerDetailsBlock'; import isEqual from 'react-fast-compare'; import PowerControls from '@/components/server/PowerControls'; -import { EulaModalFeature } from '@feature/index'; +import { EulaModalFeature, JavaVersionModalFeature } from '@feature/index'; import ErrorBoundary from '@/components/elements/ErrorBoundary'; import Spinner from '@/components/elements/Spinner'; @@ -60,6 +60,7 @@ const ServerConsole = () => { {eggFeatures.includes('eula') && + }
diff --git a/resources/scripts/components/server/features/JavaVersionModalFeature.tsx b/resources/scripts/components/server/features/JavaVersionModalFeature.tsx new file mode 100644 index 000000000..fb81c07a4 --- /dev/null +++ b/resources/scripts/components/server/features/JavaVersionModalFeature.tsx @@ -0,0 +1,105 @@ +import React, { useEffect, useState } from 'react'; +import { ServerContext } from '@/state/server'; +import Modal from '@/components/elements/Modal'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; +import setSelectedDockerImage from '@/api/server/setSelectedDockerImage'; +import FlashMessageRender from '@/components/FlashMessageRender'; +import useFlash from '@/plugins/useFlash'; +import { SocketEvent, SocketRequest } from '@/components/server/events'; +import Select from '@/components/elements/Select'; + +const dockerImageList = [ + { name: 'Java 8', image: 'ghcr.io/pterodactyl/yolks:java_8' }, + { name: 'Java 11', image: 'ghcr.io/pterodactyl/yolks:java_11' }, + { name: 'Java 16', image: 'ghcr.io/pterodactyl/yolks:java_16' }, +]; + +const JavaVersionModalFeature = () => { + const [ visible, setVisible ] = useState(false); + const [ loading, setLoading ] = useState(false); + const [ selectedVersion, setSelectedVersion ] = useState('ghcr.io/pterodactyl/yolks:java_16'); + + const uuid = ServerContext.useStoreState(state => state.server.data!.uuid); + const status = ServerContext.useStoreState(state => state.status.value); + const { clearFlashes, clearAndAddHttpError } = useFlash(); + const { connected, instance } = ServerContext.useStoreState(state => state.socket); + + useEffect(() => { + if (!connected || !instance || status === 'running') return; + + const errors = [ + 'minecraft 1.17 requires running the server with java 16 or above', + 'java.lang.unsupportedclassversionerror', + 'unsupported major.minor version', + 'has been compiled by a more recent version of the java runtime', + ]; + + const listener = (line: string) => { + if (errors.some(p => line.toLowerCase().includes(p))) { + setVisible(true); + } + }; + + instance.addListener(SocketEvent.CONSOLE_OUTPUT, listener); + + return () => { + instance.removeListener(SocketEvent.CONSOLE_OUTPUT, listener); + }; + }, [ connected, instance, status ]); + + const updateJava = () => { + setLoading(true); + clearFlashes('feature:javaVersion'); + + setSelectedDockerImage(uuid, selectedVersion) + .then(() => { + if (status === 'offline' && instance) { + instance.send(SocketRequest.SET_STATE, 'restart'); + } + + setLoading(false); + setVisible(false); + }) + .catch(error => { + console.error(error); + clearAndAddHttpError({ key: 'feature:javaVersion', error }); + }) + .then(() => setLoading(false)); + }; + + useEffect(() => { + clearFlashes('feature:javaVersion'); + }, []); + + return ( + setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}> + +

Invalid Java Version, Update Docker Image?

+

This server is unable to start due to the required java version not being met.

+

By pressing {'"Update Docker Image"'} below you are acknowledging that the docker image this server uses will be changed to a image below that has the Java version you are requesting.

+
+

Please select a Java version from the list below.

+ +
+
+ + +
+
+ ); +}; + +export default JavaVersionModalFeature; diff --git a/resources/scripts/components/server/features/eula/EulaModalFeature.tsx b/resources/scripts/components/server/features/eula/EulaModalFeature.tsx index 586b472db..b1f26f22e 100644 --- a/resources/scripts/components/server/features/eula/EulaModalFeature.tsx +++ b/resources/scripts/components/server/features/eula/EulaModalFeature.tsx @@ -53,37 +53,34 @@ const EulaModalFeature = () => { .then(() => setLoading(false)); }; - useEffect(() => () => { + useEffect(() => { clearFlashes('feature:eula'); }, []); return ( - !visible ? - null - : - setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}> - -

Accept Minecraft® EULA

-

+ setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}> + +

Accept Minecraft® EULA

+

By pressing {'"I Accept"'} below you are indicating your agreement to the  - + Minecraft® EULA - . -

-
- - + -
-
+ + + ); }; diff --git a/resources/scripts/components/server/features/index.ts b/resources/scripts/components/server/features/index.ts index 2c285feb6..9ffe01188 100644 --- a/resources/scripts/components/server/features/index.ts +++ b/resources/scripts/components/server/features/index.ts @@ -7,5 +7,6 @@ import { lazy } from 'react'; * on the feature and the egg). */ const EulaModalFeature = lazy(() => import(/* webpackChunkName: "feature.eula" */'@feature/eula/EulaModalFeature')); +const JavaVersionModalFeature = lazy(() => import(/* webpackChunkName: "feature.javaVersion" */'@feature/JavaVersionModalFeature')); -export { EulaModalFeature }; +export { EulaModalFeature, JavaVersionModalFeature }; From bda1ff50ab71cc1bd7ed0e9bcaf3637fb18897b1 Mon Sep 17 00:00:00 2001 From: Mia Date: Tue, 3 Aug 2021 05:39:12 +0200 Subject: [PATCH 08/10] [UI] Display the 2FA token, show spinner on load (#3367) Co-authored-by: Dane Everitt --- .../Api/Client/TwoFactorController.php | 4 +-- app/Services/Users/TwoFactorSetupService.php | 17 +++++----- .../api/account/getTwoFactorTokenData.ts | 15 +++++++++ .../api/account/getTwoFactorTokenUrl.ts | 9 ------ .../dashboard/forms/SetupTwoFactorModal.tsx | 31 ++++++++++++++----- 5 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 resources/scripts/api/account/getTwoFactorTokenData.ts delete mode 100644 resources/scripts/api/account/getTwoFactorTokenUrl.ts diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index 07eeb2972..b14f9d4bc 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -61,9 +61,7 @@ class TwoFactorController extends ClientApiController } return new JsonResponse([ - 'data' => [ - 'image_url_data' => $this->setupService->handle($request->user()), - ], + 'data' => $this->setupService->handle($request->user()), ]); } diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index e3649634f..be234d467 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -49,7 +49,7 @@ class TwoFactorSetupService * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function handle(User $user): string + public function handle(User $user): array { $secret = ''; try { @@ -66,11 +66,14 @@ class TwoFactorSetupService $company = urlencode(preg_replace('/\s/', '', $this->config->get('app.name'))); - return sprintf( - 'otpauth://totp/%1$s:%2$s?secret=%3$s&issuer=%1$s', - rawurlencode($company), - rawurlencode($user->email), - rawurlencode($secret) - ); + return [ + 'image_url_data' => sprintf( + 'otpauth://totp/%1$s:%2$s?secret=%3$s&issuer=%1$s', + rawurlencode($company), + rawurlencode($user->email), + rawurlencode($secret), + ), + 'secret' => $secret, + ]; } } diff --git a/resources/scripts/api/account/getTwoFactorTokenData.ts b/resources/scripts/api/account/getTwoFactorTokenData.ts new file mode 100644 index 000000000..b3669d2d6 --- /dev/null +++ b/resources/scripts/api/account/getTwoFactorTokenData.ts @@ -0,0 +1,15 @@ +import http from '@/api/http'; + +export interface TwoFactorTokenData { + // eslint-disable-next-line camelcase + image_url_data: string; + secret: string; +} + +export default (): Promise => { + return new Promise((resolve, reject) => { + http.get('/api/client/account/two-factor') + .then(({ data }) => resolve(data.data)) + .catch(reject); + }); +}; diff --git a/resources/scripts/api/account/getTwoFactorTokenUrl.ts b/resources/scripts/api/account/getTwoFactorTokenUrl.ts deleted file mode 100644 index 6d9a2aa94..000000000 --- a/resources/scripts/api/account/getTwoFactorTokenUrl.ts +++ /dev/null @@ -1,9 +0,0 @@ -import http from '@/api/http'; - -export default (): Promise => { - return new Promise((resolve, reject) => { - http.get('/api/client/account/two-factor') - .then(({ data }) => resolve(data.data.image_url_data)) - .catch(reject); - }); -}; diff --git a/resources/scripts/components/dashboard/forms/SetupTwoFactorModal.tsx b/resources/scripts/components/dashboard/forms/SetupTwoFactorModal.tsx index 727094782..4bb73f368 100644 --- a/resources/scripts/components/dashboard/forms/SetupTwoFactorModal.tsx +++ b/resources/scripts/components/dashboard/forms/SetupTwoFactorModal.tsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useState } from 'react'; import { Form, Formik, FormikHelpers } from 'formik'; import { object, string } from 'yup'; -import getTwoFactorTokenUrl from '@/api/account/getTwoFactorTokenUrl'; +import getTwoFactorTokenData, { TwoFactorTokenData } from '@/api/account/getTwoFactorTokenData'; import enableAccountTwoFactor from '@/api/account/enableAccountTwoFactor'; import { Actions, useStoreActions } from 'easy-peasy'; import { ApplicationStore } from '@/state'; @@ -12,13 +12,14 @@ import Button from '@/components/elements/Button'; import asModal from '@/hoc/asModal'; import ModalContext from '@/context/ModalContext'; import QRCode from 'qrcode.react'; +import CopyOnClick from '@/components/elements/CopyOnClick'; interface Values { code: string; } const SetupTwoFactorModal = () => { - const [ token, setToken ] = useState(''); + const [ token, setToken ] = useState(null); const [ recoveryTokens, setRecoveryTokens ] = useState([]); const { dismiss, setPropOverrides } = useContext(ModalContext); @@ -26,7 +27,7 @@ const SetupTwoFactorModal = () => { const { clearAndAddHttpError } = useStoreActions((actions: Actions) => actions.flashes); useEffect(() => { - getTwoFactorTokenUrl() + getTwoFactorTokenData() .then(setToken) .catch(error => { console.error(error); @@ -102,13 +103,17 @@ const SetupTwoFactorModal = () => {
- {!token || !token.length ? + {!token ? : - + }
@@ -121,11 +126,21 @@ const SetupTwoFactorModal = () => { title={'Code From Authenticator'} description={'Enter the code from your authenticator device after scanning the QR image.'} /> + {token && +
+ Alternatively, enter the following token into your authenticator application: + +
+ + {token.secret} + +
+
+
+ }
- +
From cfb5b8c2444ded89b4a7147be89fea3a2e494f9e Mon Sep 17 00:00:00 2001 From: Matthew Hugley <73258263+mhmatthewhugley@users.noreply.github.com> Date: Sun, 4 Jul 2021 17:21:49 -0500 Subject: [PATCH 09/10] Updated formatting for the docker compose file to fix a error. (#3421) This fixes the error message "There is an error in the yaml syntax: YAMLSemanticError: Map keys must be unique; "<<" is repeated" which is received if trying to deploy the docker compose using portainer it will not even allow you to click the button because of the formatting error. This is a page showing a example of what I did "http://yaml.org/type/merge.html" Instead of 2 merge requests docker/portainer only allows 1 merge request in this situation so they had to be combined into 1 line instead of 2. --- docker-compose.example.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.example.yml b/docker-compose.example.yml index ee2f875ea..42b02dbad 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -61,8 +61,7 @@ services: - "/srv/pterodactyl/certs/:/etc/letsencrypt/" - "/srv/pterodactyl/logs/:/app/storage/logs" environment: - <<: *panel-environment - <<: *mail-environment + <<: [*panel-environment, *mail-environment] DB_PASSWORD: *db-password APP_ENV: "production" APP_ENVIRONMENT_ONLY: "false" From b19a1640f02e334e991f7c58322003a4d6567d8f Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 2 Aug 2021 20:48:16 -0700 Subject: [PATCH 10/10] Update CHANGELOG.md --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab554582..2320dcdd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v1.5.0 +### Fixed +* Fixes deleting a locked backup that has also been marked as failed to allow deletion rather than returning an error about being locked. +* Fixes server creation process not correctly sending `start_on_completion` to Wings instance. +* Fixes `z-index` on file mass delete modal so it is displayed on top of all elements, rather than hidden under some. +* Supports re-sending requests to the Panel API for backups that are currently marked as failed, allowing a previously failed backup to be marked as successful. +* Minor updates to multiple default eggs for improved error handling and more accurate field-level validation. + +### Updated +* Updates help text for CPU limiting when creating a new server to properly indicate virtual threads are included, rather than only physical threads. +* Updates all of the default eggs shipped with the Panel to reference new [`ghcr.io` yolks repository](https://github.com/pterodactyl/yolks). +* When adding 2FA to an account the key used to generate the token is now displayed to the user allowing them to manually input into their app if necessary. + +### Added +* Adds SSL/TLS options for MySQL and Redis in line with most recent Laravel updates. +* New users created for server MySQL instances will now have the correct permissions for creating foreign keys on tables. +* Adds new automatic popup feature to allow users to quickly update their Minecraft servers to the latest Java® eggs as necessary if unsupported versions are detected. + +### Removed +* Removes legacy `userInteraction` key from eggs which was unused. + ## v1.4.2 ### Fixed * Fixes logic to disallow creating a backup schedule if the server's backup limit is set to 0.