Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Update to latest upstream commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFallenSpirit committed Jan 18, 2022
2 parents 0125935 + 0ff2f28 commit 9061099
Show file tree
Hide file tree
Showing 21 changed files with 258 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can provide additional settings using a custom `.env` file or by setting the

## 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.
If you are running the docker container without docker-compose, use:
Expand Down
5 changes: 5 additions & 0 deletions .github/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ else
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

## check for DB up before starting the panel
echo "Checking database status."
until nc -z -v -w30 $DB_HOST $DB_PORT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Create release archive
run: |
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile
tar -czf panel.tar.gz * .env.example .babel-plugin-macrosrc.js
tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.yml .babel-plugin-macrosrc.js
- name: Extract changelog
id: extract_changelog
Expand Down
6 changes: 3 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
system in place to generate these compiled assets. To get your environment setup you'll need at minimum:

* Node.js 12
* [Yarn](https://classic.yarnpkg.com/lang/en/) v1
* [Go](https://golang.org/) 1.15.
* [Node.js](https://nodejs.org/en/) v14.x.x
* [Yarn](https://classic.yarnpkg.com/lang/en/) v1.x.x
* [Go](https://golang.org/) 1.17.x

### Install Dependencies
```bash
Expand Down
3 changes: 2 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# The MIT License (MIT)

```
Copyright (c) 2015 - 2021 Dane Everitt <[email protected]> and Contributors
Pterodactyl®
Copyright © Dane Everitt <[email protected]> and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[![Logo Image](https://i.imgur.com/jdD4dLG.png)](https://jexactyl.xyz)
![Tests](https://img.shields.io/github/workflow/status/pterodactyl/panel/tests?label=Tests&style=for-the-badge)
![Maintained](https://img.shields.io/maintenance/yes/2021?style=for-the-badge)
![Maintained](https://img.shields.io/maintenance/yes/2022?style=for-the-badge)
![Discord](https://img.shields.io/discord/922284031129825280?style=for-the-badge)
![Downloads](https://img.shields.io/github/downloads/jexactyl/panel/total?style=for-the-badge)
![Version](https://img.shields.io/github/v/release/jexactyl/panel?style=for-the-badge)

# Jexactyl
Jexactyl is an all-in-one server management panel
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function viewStore(User $user): View
public function delete(Request $request, User $user)
{
if ($request->user()->id === $user->id) {
throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers'));
throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers'));
}

$this->deletionService->handle($user);
Expand Down
5 changes: 3 additions & 2 deletions app/Models/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Pterodactyl\Models;

use Illuminate\Support\Str;
use Symfony\Component\Yaml\Yaml;
use Illuminate\Container\Container;
use Illuminate\Notifications\Notifiable;
Expand Down Expand Up @@ -155,8 +156,8 @@ public function getConfiguration()
'port' => $this->daemonListen,
'ssl' => [
'enabled' => (!$this->behind_proxy && $this->scheme === 'https'),
'cert' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem',
'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem',
'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem',
'key' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/privkey.pem',
],
'upload_limit' => $this->upload_size,
],
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Nodes/NodeDeletionService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
Expand Down Expand Up @@ -62,7 +63,7 @@ public function handle($node)

$servers = $this->serverRepository->setColumns('id')->findCountWhere([['node_id', '=', $node]]);
if ($servers > 0) {
throw new HasActiveServersException($this->translator->trans('exceptions.node.servers_attached'));
throw new HasActiveServersException($this->translator->get('exceptions.node.servers_attached'));
}

return $this->repository->delete($node);
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Users/UserDeletionService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
Expand Down Expand Up @@ -62,7 +63,7 @@ public function handle($user)

$servers = $this->serverRepository->setColumns('id')->findCountWhere([['owner_id', '=', $user]]);
if ($servers > 0) {
throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers'));
throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers'));
}

return $this->repository->delete($user);
Expand Down
1 change: 1 addition & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ services:
QUEUE_DRIVER: "redis"
REDIS_HOST: "cache"
DB_HOST: "database"
DB_PORT: "3306"
networks:
default:
ipam:
Expand Down
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
User-agent: *
Disallow:
Disallow: /
2 changes: 1 addition & 1 deletion resources/scripts/components/elements/PageContentBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const PageContentBlock: React.FC<PageContentBlockProps> = ({ title, showFlashKey
href={'https://jexactyl.xyz'}
css={tw`no-underline text-neutral-500 hover:text-neutral-300`}
>
Jexactyl
Jexactyl, built with <a href="https://pterodactyl.io">Pterodactyl</a>.
</a>
</p>
</ContentContainer>
Expand Down
4 changes: 3 additions & 1 deletion resources/scripts/components/elements/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ export interface SwitchProps {
label?: string;
description?: string;
defaultChecked?: boolean;
readOnly?: boolean;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
children?: React.ReactNode;
}

const Switch = ({ name, label, description, defaultChecked, onChange, children }: SwitchProps) => {
const Switch = ({ name, label, description, defaultChecked, readOnly, onChange, children }: SwitchProps) => {
const uuid = useMemo(() => v4(), []);

return (
Expand All @@ -58,6 +59,7 @@ const Switch = ({ name, label, description, defaultChecked, onChange, children }
type={'checkbox'}
onChange={e => onChange && onChange(e)}
defaultChecked={defaultChecked}
disabled={readOnly}
/>
}
<Label htmlFor={uuid}/>
Expand Down
9 changes: 8 additions & 1 deletion resources/scripts/components/server/ServerConsole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, JavaVersionModalFeature } from '@feature/index';
import { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature, SteamDiskSpaceFeature } from '@feature/index';
import ErrorBoundary from '@/components/elements/ErrorBoundary';
import Spinner from '@/components/elements/Spinner';

Expand Down Expand Up @@ -66,6 +66,13 @@ const ServerConsole = () => {
<Spinner.Suspense>
<ChunkedStatGraphs/>
</Spinner.Suspense>
<React.Suspense fallback={null}>
{eggFeatures.includes('eula') && <EulaModalFeature/>}
{eggFeatures.includes('java_version') && <JavaVersionModalFeature/>}
{eggFeatures.includes('gsl_token') && <GSLTokenModalFeature/>}
{eggFeatures.includes('pid_limit') && <PIDLimitModalFeature/>}
{eggFeatures.includes('steam_disk_space') && <SteamDiskSpaceFeature/>}
</React.Suspense>
</div>
</ServerContentBlock>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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 FlashMessageRender from '@/components/FlashMessageRender';
import useFlash from '@/plugins/useFlash';
import { SocketEvent } from '@/components/server/events';
import { useStoreState } from 'easy-peasy';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';

const PIDLimitModalFeature = () => {
const [ visible, setVisible ] = useState(false);
const [ loading ] = useState(false);

const status = ServerContext.useStoreState(state => state.status.value);
const { clearFlashes } = useFlash();
const { connected, instance } = ServerContext.useStoreState(state => state.socket);
const isAdmin = useStoreState(state => state.user.data!.rootAdmin);

useEffect(() => {
if (!connected || !instance || status === 'running') return;

const errors = [
'pthread_create failed',
'exception in thread "craft async scheduler management thread"',
'unable to create new native thread',
'unable to create native thread',
];

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 ]);

useEffect(() => {
clearFlashes('feature:pidLimit');
}, []);

return (
<Modal visible={visible} onDismissed={() => setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}>
<FlashMessageRender key={'feature:pidLimit'} css={tw`mb-4`} />
{isAdmin ?
<>
<div css={tw`mt-4 sm:flex items-center`}>
<FontAwesomeIcon css={tw`pr-4`} icon={faExclamationTriangle} color={'orange'} size={'4x'}/>
<h2 css={tw`text-2xl mb-4 text-neutral-100 `}>Memory or process limit reached...</h2>
</div>
<p css={tw`mt-4`}>This server has reached the maximum process or memory limit.</p>
<p css={tw`mt-4`}>Increasing <code css={tw`font-mono bg-neutral-900`}>container_pid_limit</code> in the wings configuration, <code css={tw`font-mono bg-neutral-900`}>config.yml</code>, might help resolve this issue.</p>
<p css={tw`mt-4`}><b>Note: Wings must be restarted for the configuration file changes to take effect</b></p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
:
<>
<div css={tw`mt-4 sm:flex items-center`}>
<FontAwesomeIcon css={tw`pr-4`} icon={faExclamationTriangle} color={'orange'} size={'4x'}/>
<h2 css={tw`text-2xl mb-4 text-neutral-100`}>Possible resource limit reached...</h2>
</div>
<p css={tw`mt-4`}>This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.</p>
<p css={tw`mt-4`}><code css={tw`font-mono bg-neutral-900`}>pthread_create failed, Possibly out of memory or process/resource limits reached</code></p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
}
</Modal>
);
};

export default PIDLimitModalFeature;
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
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 FlashMessageRender from '@/components/FlashMessageRender';
import useFlash from '@/plugins/useFlash';
import { SocketEvent } from '@/components/server/events';
import { useStoreState } from 'easy-peasy';

const SteamDiskSpaceFeature = () => {
const [ visible, setVisible ] = useState(false);
const [ loading ] = useState(false);

const status = ServerContext.useStoreState(state => state.status.value);
const { clearFlashes } = useFlash();
const { connected, instance } = ServerContext.useStoreState(state => state.socket);
const isAdmin = useStoreState(state => state.user.data!.rootAdmin);

useEffect(() => {
if (!connected || !instance || status === 'running') return;

const errors = [
'steamcmd needs 250mb of free disk space to update',
'0x202 after update job',
];

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 ]);

useEffect(() => {
clearFlashes('feature:steamDiskSpace');
}, []);

return (
<Modal visible={visible} onDismissed={() => setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}>
<FlashMessageRender key={'feature:steamDiskSpace'} css={tw`mb-4`} />
{isAdmin ?
<>
<div css={tw`mt-4 sm:flex items-center`}>
<h2 css={tw`text-2xl mb-4 text-neutral-100 `}>Out of available disk space...</h2>
</div>
<p css={tw`mt-4`}>This server has run out of available disk space and cannot complete the install or update process.</p>
<p css={tw`mt-4`}>Ensure the machine has enough disk space by typing <code css={tw`font-mono bg-neutral-900 rounded py-1 px-2`}>df -h</code> on the machine hosting this server. Delete files or increase the available disk space to resolve the issue.</p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
:
<>
<div css={tw`mt-4 sm:flex items-center`}>
<h2 css={tw`text-2xl mb-4 text-neutral-100`}>Out of available disk space...</h2>
</div>
<p css={tw`mt-4`}>This server has run out of available disk space and cannot complete the install or update process. Please get in touch with the administrator(s) and inform them of disk space issues.</p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
}
</Modal>
);
};

export default SteamDiskSpaceFeature;
4 changes: 3 additions & 1 deletion resources/scripts/components/server/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ import { lazy } from 'react';
const EulaModalFeature = lazy(() => import(/* webpackChunkName: "feature.eula" */'@feature/eula/EulaModalFeature'));
const JavaVersionModalFeature = lazy(() => import(/* webpackChunkName: "feature.java_version" */'@feature/JavaVersionModalFeature'));
const GSLTokenModalFeature = lazy(() => import(/* webpackChunkName: "feature.gsl_token" */'@feature/GSLTokenModalFeature'));
const PIDLimitModalFeature = lazy(() => import(/* webpackChunkName: "feature.pid_limit" */'@feature/PIDLimitModalFeature'));
const SteamDiskSpaceFeature = lazy(() => import(/* webpackChunkName: "feature.steam_disk_space" */'@feature/SteamDiskSpaceFeature'));

export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature };
export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature, SteamDiskSpaceFeature };
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { FileActionCheckbox } from '@/components/server/files/SelectFileCheckbox
import { hashToPath } from '@/helpers';

const sortFiles = (files: FileObject[]): FileObject[] => {
return files.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
const sortedFiles: FileObject[] = files.sort((a, b) => a.name.localeCompare(b.name)).sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
return sortedFiles.filter((file, index) => index === 0 || file.name !== sortedFiles[index - 1].name);
};

export default () => {
Expand Down
Loading

0 comments on commit 9061099

Please sign in to comment.