Skip to content

Commit b7a6543

Browse files
committed
Merge branch '1.0-develop' into develop
2 parents 16c2b60 + 1b78030 commit b7a6543

File tree

10 files changed

+46
-34
lines changed

10 files changed

+46
-34
lines changed

app/Http/Controllers/Api/Client/Servers/SettingsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function rename(RenameServerRequest $request, Server $server): JsonRespon
3636
{
3737
$this->repository->update($server->id, [
3838
'name' => $request->input('name'),
39+
'description' => $request->input('description') ?? '',
3940
]);
4041

4142
if ($server->name !== $request->input('name')) {

app/Http/Requests/Api/Client/Servers/Settings/RenameServerRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR
1111
{
1212
/**
1313
* Returns the permissions string indicating which permission should be used to
14-
* validate that the authenticated user has permission to perform this action aganist
14+
* validate that the authenticated user has permission to perform this action against
1515
* the given resource (server).
1616
*/
1717
public function permission(): string
@@ -26,6 +26,7 @@ public function rules(): array
2626
{
2727
return [
2828
'name' => Server::getRules()['name'],
29+
'description' => 'string|nullable',
2930
];
3031
}
3132
}

app/Models/Permission.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class Permission extends Model
195195
'settings' => [
196196
'description' => 'Permissions that control a user\'s access to the settings for this server.',
197197
'keys' => [
198-
'rename' => 'Allows a user to rename this server.',
198+
'rename' => 'Allows a user to rename this server and change the description of it.',
199199
'reinstall' => 'Allows a user to trigger a reinstall of this server.',
200200
],
201201
],

config/mail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
*/
9292

9393
'from' => [
94-
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
95-
'name' => env('MAIL_FROM_NAME', 'Example'),
94+
'address' => env('MAIL_FROM_ADDRESS', env('MAIL_FROM')),
95+
'name' => env('MAIL_FROM_NAME', 'Pterodactyl Panel'),
9696
],
9797

9898
/*

config/queue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'database' => [
3434
'driver' => 'database',
3535
'table' => 'jobs',
36-
'queue' => 'default',
36+
'queue' => env('QUEUE_STANDARD', 'default'),
3737
'retry_after' => 90,
3838
'after_commit' => false,
3939
],
@@ -43,7 +43,7 @@
4343
'key' => env('AWS_ACCESS_KEY_ID'),
4444
'secret' => env('AWS_SECRET_ACCESS_KEY'),
4545
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
46-
'queue' => env('SQS_QUEUE', 'default'),
46+
'queue' => env('SQS_QUEUE', env('QUEUE_STANDARD', 'default')),
4747
'suffix' => env('SQS_SUFFIX'),
4848
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
4949
'after_commit' => false,
@@ -52,7 +52,7 @@
5252
'redis' => [
5353
'driver' => 'redis',
5454
'connection' => 'default',
55-
'queue' => env('REDIS_QUEUE', 'default'),
55+
'queue' => env('REDIS_QUEUE', env('QUEUE_STANDARD', 'default')),
5656
'retry_after' => 90,
5757
'block_for' => null,
5858
'after_commit' => false,
Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
33
"meta": {
4-
"version": "PTDL_v1",
4+
"version": "PTDL_v2",
55
"update_url": null
66
},
7-
"exported_at": "2021-06-15T16:54:54-04:00",
7+
"exported_at": "2022-10-15T12:38:18+02:00",
88
"name": "Mumble Server",
99
"author": "support@pterodactyl.io",
1010
"description": "Mumble is an open source, low-latency, high quality voice chat software primarily intended for use while gaming.",
1111
"features": null,
12-
"images": [
13-
"ghcr.io\/pterodactyl\/yolks:alpine"
14-
],
12+
"docker_images": {
13+
"Mumble": "ghcr.io\/parkervcp\/yolks:voice_mumble"
14+
},
1515
"file_denylist": [],
16-
"startup": ".\/murmur.x86 -fg",
16+
"startup": "mumble-server -fg -ini murmur.ini",
1717
"config": {
18-
"files": "{\r\n \"murmur.ini\": {\r\n \"parser\": \"ini\",\r\n \"find\": {\r\n \"logfile\": \"murmur.log\",\r\n \"port\": \"{{server.build.default.port}}\",\r\n \"host\": \"0.0.0.0\",\r\n \"users\": \"{{server.build.env.MAX_USERS}}\"\r\n }\r\n }\r\n}",
18+
"files": "{\r\n \"murmur.ini\": {\r\n \"parser\": \"ini\",\r\n \"find\": {\r\n \"database\": \"\/home\/container\/murmur.sqlite\",\r\n \"logfile\": \"\/home\/container\/murmur.log\",\r\n \"port\": \"{{server.build.default.port}}\",\r\n \"host\": \"0.0.0.0\",\r\n \"users\": \"{{server.build.env.MAX_USERS}}\"\r\n }\r\n }\r\n}",
1919
"startup": "{\r\n \"done\": \"Server listening on\"\r\n}",
20-
"logs": "{\r\n \"custom\": true,\r\n \"location\": \"logs\/murmur.log\"\r\n}",
20+
"logs": "{}",
2121
"stop": "^C"
2222
},
2323
"scripts": {
2424
"installation": {
25-
"script": "#!\/bin\/ash\r\n# Mumble Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\nGITHUB_PACKAGE=mumble-voip\/mumble\r\nMATCH=murmur-static\r\n\r\nif [ ! -d \/mnt\/server\/ ]; then\r\n mkdir \/mnt\/server\/\r\nfi\r\n\r\ncd \/mnt\/server\r\n\r\nif [ -z \"${GITHUB_USER}\" ] && [ -z \"${GITHUB_OAUTH_TOKEN}\" ] ; then\r\n echo -e \"using anon api call\"\r\nelse\r\n echo -e \"user and oauth token set\"\r\n alias curl='curl -u ${GITHUB_USER}:${GITHUB_OAUTH_TOKEN} '\r\nfi\r\n\r\n## get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\/latest\")\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\")\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -m 1 -i ${MATCH})\r\nelse\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_LINK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -m 1 -i ${MATCH})\r\n else\r\n echo -e \"defaulting to latest release\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\nfi\r\n\r\ncurl -L ${DOWNLOAD_LINK} | tar xjv --strip-components=1",
25+
"script": "#!\/bin\/ash\r\n\r\nif [ ! -d \/mnt\/server\/ ]; then\r\n mkdir \/mnt\/server\/\r\nfi\r\n\r\ncd \/mnt\/server\r\n\r\nFILE=\/mnt\/server\/murmur.ini\r\nif [ -f \"$FILE\" ]; then\r\n echo \"Config file already exists.\"\r\nelse \r\n echo \"Downloading the config file.\"\r\n apk add --no-cache murmur\r\n cp \/etc\/murmur.ini \/mnt\/server\/murmur.ini\r\n apk del murmur\r\nfi\r\necho \"done\"",
2626
"container": "ghcr.io\/pterodactyl\/installers:alpine",
2727
"entrypoint": "ash"
2828
}
@@ -35,16 +35,8 @@
3535
"default_value": "100",
3636
"user_viewable": true,
3737
"user_editable": false,
38-
"rules": "required|numeric|digits_between:1,5"
39-
},
40-
{
41-
"name": "Server Version",
42-
"description": "Version of Mumble Server to download and use.",
43-
"env_variable": "MUMBLE_VERSION",
44-
"default_value": "latest",
45-
"user_viewable": true,
46-
"user_editable": true,
47-
"rules": "required|string"
38+
"rules": "required|numeric|digits_between:1,5",
39+
"field_type": "text"
4840
}
4941
]
50-
}
42+
}

resources/lang/en/activity.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
],
116116
'settings' => [
117117
'rename' => 'Renamed the server from :old to :new',
118+
'description' => 'Changed the server description from :old to :new',
118119
],
119120
'startup' => [
120121
'edit' => 'Changed the :variable variable from ":old" to ":new"',

resources/scripts/api/server/renameServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import http from '@/api/http';
22

3-
export default (uuid: string, name: string): Promise<void> => {
3+
export default (uuid: string, name: string, description?: string): Promise<void> => {
44
return new Promise((resolve, reject) => {
5-
http.post(`/api/client/servers/${uuid}/settings/rename`, { name })
5+
http.post(`/api/client/servers/${uuid}/settings/rename`, { name, description })
66
.then(() => resolve())
77
.catch(reject);
88
});

resources/scripts/components/server/settings/RenameServerBox.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { ServerContext } from '@/state/server';
33
import TitledGreyBox from '@/components/elements/TitledGreyBox';
4-
import { Form, Formik, FormikHelpers, useFormikContext } from 'formik';
4+
import { Field as FormikField, Form, Formik, FormikHelpers, useFormikContext } from 'formik';
55
import { Actions, useStoreActions } from 'easy-peasy';
66
import renameServer from '@/api/server/renameServer';
77
import Field from '@/components/elements/Field';
@@ -11,19 +11,29 @@ import { ApplicationStore } from '@/state';
1111
import { httpErrorToHuman } from '@/api/http';
1212
import { Button } from '@/components/elements/button/index';
1313
import tw from 'twin.macro';
14+
import Label from '@/components/elements/Label';
15+
import FormikFieldWrapper from '@/components/elements/FormikFieldWrapper';
16+
import { Textarea } from '@/components/elements/Input';
1417

1518
interface Values {
1619
name: string;
20+
description: string;
1721
}
1822

1923
const RenameServerBox = () => {
2024
const { isSubmitting } = useFormikContext<Values>();
2125

2226
return (
23-
<TitledGreyBox title={'Change Server Name'} css={tw`relative`}>
27+
<TitledGreyBox title={'Change Server Details'} css={tw`relative`}>
2428
<SpinnerOverlay visible={isSubmitting} />
2529
<Form css={tw`mb-0`}>
2630
<Field id={'name'} name={'name'} label={'Server Name'} type={'text'} />
31+
<div css={tw`mt-6`}>
32+
<Label>Server Description</Label>
33+
<FormikFieldWrapper name={'description'}>
34+
<FormikField as={Textarea} name={'description'} rows={3} />
35+
</FormikFieldWrapper>
36+
</div>
2737
<div css={tw`mt-6 text-right`}>
2838
<Button type={'submit'}>Save</Button>
2939
</div>
@@ -37,10 +47,10 @@ export default () => {
3747
const setServer = ServerContext.useStoreActions((actions) => actions.server.setServer);
3848
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
3949

40-
const submit = ({ name }: Values, { setSubmitting }: FormikHelpers<Values>) => {
50+
const submit = ({ name, description }: Values, { setSubmitting }: FormikHelpers<Values>) => {
4151
clearFlashes('settings');
42-
renameServer(server.uuid, name)
43-
.then(() => setServer({ ...server, name }))
52+
renameServer(server.uuid, name, description)
53+
.then(() => setServer({ ...server, name, description }))
4454
.catch((error) => {
4555
console.error(error);
4656
addError({ key: 'settings', message: httpErrorToHuman(error) });
@@ -53,9 +63,11 @@ export default () => {
5363
onSubmit={submit}
5464
initialValues={{
5565
name: server.name,
66+
description: server.description,
5667
}}
5768
validationSchema={object().shape({
5869
name: string().required().min(1),
70+
description: string().nullable(),
5971
})}
6072
>
6173
<RenameServerBox />

tests/Integration/Api/Client/Server/SettingsControllerTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,30 @@ public function testServerNameCanBeChanged(array $permissions)
2121
/** @var \Pterodactyl\Models\Server $server */
2222
[$user, $server] = $this->generateTestAccount($permissions);
2323
$originalName = $server->name;
24+
$originalDescription = $server->description;
2425

2526
$response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/settings/rename", [
2627
'name' => '',
28+
'description' => '',
2729
]);
2830

2931
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
3032
$response->assertJsonPath('errors.0.meta.rule', 'required');
3133

3234
$server = $server->refresh();
3335
$this->assertSame($originalName, $server->name);
36+
$this->assertSame($originalDescription, $server->description);
3437

3538
$this->actingAs($user)
3639
->postJson("/api/client/servers/$server->uuid/settings/rename", [
3740
'name' => 'Test Server Name',
41+
'description' => 'This is a test server.',
3842
])
3943
->assertStatus(Response::HTTP_NO_CONTENT);
4044

4145
$server = $server->refresh();
4246
$this->assertSame('Test Server Name', $server->name);
47+
$this->assertSame('This is a test server.', $server->description);
4348
}
4449

4550
/**

0 commit comments

Comments
 (0)