Compare commits
183 Commits
replace-da
...
release/v1
Author | SHA1 | Date |
---|---|---|
Angelillo15 | c332151c9a | |
Angelillo15 | 235e1007f7 | |
Pterodactyl CI | 62b8a53165 | |
Matthew Penner | 3a0b7d13a9 | |
Matthew Penner | a96d87cf23 | |
Daniel Barton | 049ad838e3 | |
Daniel Barton | dbd7f31c41 | |
Daniel Barton | 2ffe019675 | |
Matthew Penner | 7bfc265a7e | |
Matthew Penner | b7b2413f3d | |
Matthew Penner | 96e6c66040 | |
Matthew Penner | 6dc85c731e | |
Matthew Penner | 0dad4c5a48 | |
Matthew Penner | b1fa3927c1 | |
Matthew Penner | f671046947 | |
Matthew Penner | 319ca683f8 | |
Matthew Penner | 1172d71d31 | |
Matthew Penner | 2497819ca7 | |
Matthew Penner | 787bf34a59 | |
Angelillo15 | 6592e8e1cb | |
Angelillo15 | a5c52e1af5 | |
Matthew Penner | f0489f677b | |
Matthew Penner | 8abf2d8106 | |
Matthew Penner | 341eda7855 | |
Angelillo15 | 9678ae0037 | |
Angelillo15 | d4ac089be8 | |
Angelillo15 | 7dcfb4426a | |
Angelillo15 | 7d58952a9b | |
Angelillo15 | 5cea017833 | |
Angelillo15 | 9979521c3a | |
Angelillo15 | 6b9dd72815 | |
Angelillo15 | fae1ac5ae8 | |
Angelillo15 | 9c054b7af3 | |
Angelillo15 | 5694e2ae0c | |
Angelillo15 | 7935e9f4a8 | |
Angelillo15 | 91364425ad | |
Angelillo15 | f6cf39fb99 | |
Angelillo15 | 54b1793e2d | |
Angelillo15 | 40dd354b18 | |
Pterodactyl CI | 22629f4ab8 | |
Matthew Penner | 742e352c67 | |
Matthew Penner | a62e8b1a67 | |
Angelillo15 | 6837384c19 | |
Pterodactyl CI | 35d49d3caa | |
Matthew Penner | 35159b3715 | |
Matthew Penner | 7fa0c26d80 | |
Boy132 | 5a417e9adb | |
Boy132 | 51cee7688a | |
Boy132 | 67b2d944a6 | |
Matthew Penner | 57d27293d2 | |
Boy132 | 1af200c464 | |
Matthew Penner | 97049f48c3 | |
Vadym | 2d4071ca25 | |
Matthew Penner | 5cd2697be3 | |
Robert Nisipeanu | 85f1259709 | |
Matthew Penner | bf1768406b | |
Boy132 | a83058668f | |
Matthew Penner | 987440c8ca | |
Matthew Penner | 341fa0a52d | |
Michael Parker | aa2f797f6f | |
Matthew Penner | 04d83edd36 | |
Matthew Penner | 15860613b6 | |
Angelillo15 | a3b81929ab | |
Angelillo15 | 6169663f16 | |
Angelillo15 | da6f027324 | |
Angelillo15 | f173a5e496 | |
Angelillo15 | 9b00a38d3c | |
Angelillo15 | 883bb53c5c | |
Angelillo15 | 34a559f3e8 | |
Angelillo15 | a6db4e2382 | |
Angelillo15 | f5fda554fa | |
Angelillo15 | bab2b21098 | |
Angelillo15 | f92af06eda | |
Angelillo15 | 6c624fd31b | |
Angelillo15 | 36ea087179 | |
Angelillo15 | 64dc2500a1 | |
Angelillo15 | d68c63c401 | |
Angelillo15 | 7601e3fe76 | |
Angelillo15 | 4ac857da5b | |
Angelillo15 | 8595f2a09a | |
Angelillo15 | d2984af12c | |
Angelillo15 | f8312b1cb2 | |
Angelillo15 | d777b3b55e | |
Angelillo15 | 6c04718c35 | |
Angelillo15 | 099cda8ebb | |
Angelillo15 | 72d086d292 | |
Angelillo15 | 860b337b1f | |
Angelillo15 | 638bf4cb59 | |
Angelillo15 | aa13ce4698 | |
Angelillo15 | da0be11d29 | |
Angelillo15 | dc6b5e704f | |
Angelillo15 | cc4c5eac21 | |
Angelillo15 | ae53bd8034 | |
Matthew Penner | 3cd15d6f21 | |
Matthew Penner | 29783ed240 | |
Angelillo15 | 37b9ef5585 | |
Angelillo15 | 6d8f76dec5 | |
Angelillo15 | 80f51e0af2 | |
Matthew Penner | 7c8bdfc4d8 | |
Matthew Penner | b23f3114e4 | |
Matthew Penner | 8bfcffc477 | |
Matthew Penner | 1d38b4f0e2 | |
Matthew Penner | ad4ddc6300 | |
Devonte W | b746c3ead1 | |
Devonte W | aea5c474db | |
Matthew Penner | 2a7833ca17 | |
Alex | 9b47403e00 | |
Pterodactyl CI | a99941eb2b | |
Matthew Penner | 43f7c10617 | |
Matthew Penner | 866b6df4b0 | |
Matthew Penner | 2b14e46eec | |
Matthew Penner | 20f23a0b27 | |
Matthew Penner | a27ea3d1bc | |
Matthew Penner | fbdac5b63f | |
Jelco | c74314d2ab | |
Matthew Penner | dd595437e6 | |
Boy132 | 2ed7f1c912 | |
Matthew Penner | a2fb319ff5 | |
Omar Kamel | e43da311fe | |
Matthew Penner | ac53e7b061 | |
Matthew Penner | 8978da335e | |
VibeGAMESNL | 680bce6d94 | |
Matthew Penner | 428311e854 | |
Matthew Penner | 6df31e1923 | |
Matthew Penner | c8c648f0e5 | |
Matthew Penner | 0751eeec97 | |
Matthew Penner | 24e1c56378 | |
Matthew Penner | 4626118d77 | |
Matthew Penner | 6377e3309a | |
Matthew Penner | c14fc1ccb0 | |
Matthew Penner | 63a179d7f3 | |
Matthew Penner | 3432cadd4a | |
Matthew Penner | 411017198e | |
Matthew Penner | e763c72d63 | |
Matthew Penner | a2970cd784 | |
Matthew Penner | ca4aa795be | |
Matthew Penner | c802b49b7a | |
Matthew Penner | 7d93f1566c | |
Matthew Penner | 598c956e4e | |
Matthew Penner | 158facd534 | |
Matthew Penner | dd69652942 | |
Matthew Penner | 73b27aea8e | |
Matthew Penner | fa7503816a | |
Matthew Penner | 250c557e23 | |
Matthew Penner | 6272bb6710 | |
Matthew Penner | 3c278a8c51 | |
Matthew Penner | 794248d4d7 | |
Wunderharke | c8f7bdf9cb | |
TaktischerSpeck | 75f36839df | |
Charles Morgan | a4e547dc67 | |
Matthew Penner | 1bb1b13f6d | |
Matthew Penner | 5b36313c57 | |
Matthew Penner | ee033d6d08 | |
Dane Everitt | df9a7f71f9 | |
Lance Pioch | a4f6870518 | |
Matthew Penner | 039ad4abf0 | |
Devonte W | 634c9353e3 | |
Matthew Penner | c3521e0221 | |
Matthew Penner | 2f4a60c961 | |
Matthew Penner | c1584d9a5b | |
Matthew Penner | 897ca48ded | |
Matthew Penner | df2402b54f | |
Boy132 | 032e4f2e31 | |
Lance Pioch | 4032481a4f | |
Lance Pioch | 9b218f2190 | |
Alex | c068f57e4e | |
Matthew Penner | f8ec8b4d5a | |
Matthew Penner | d466934103 | |
Matthew Penner | 846ff7644f | |
Matthew Penner | b7a65436fa | |
Matthew Penner | 1b78030291 | |
Quinten | e21aab2537 | |
Lance Pioch | 16c2b606b4 | |
Boy132 | f2095e815e | |
Matthew Penner | b1abae8106 | |
Lance Pioch | 548affba84 | |
Matthew Penner | 5f57e63fe4 | |
Matthew Penner | 6f0bb43314 | |
Jelco | 5c78b380c5 | |
Matthew Penner | d31ece1c75 | |
Lance Pioch | e49ba65709 | |
Matthew Penner | 7266c66ebf | |
Pterodactyl CI | d0974b0066 |
|
@ -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
|
||||||
|
|
2
.env.ci
2
.env.ci
|
@ -8,7 +8,7 @@ APP_ENVIRONMENT_ONLY=true
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
DB_DATABASE=panel_test
|
DB_DATABASE=testing
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
QUEUE_CONNECTION=sync
|
QUEUE_CONNECTION=redis
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
|
|
||||||
HASHIDS_SALT=
|
HASHIDS_SALT=
|
||||||
|
@ -41,4 +41,4 @@ MAIL_FROM_NAME="Pterodactyl Panel"
|
||||||
# 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.example.com
|
# MAIL_EHLO_DOMAIN=panel.example.com
|
||||||
|
|
17
.eslintrc.js
17
.eslintrc.js
|
@ -1,9 +1,3 @@
|
||||||
const prettier = {
|
|
||||||
singleQuote: true,
|
|
||||||
jsxSingleQuote: true,
|
|
||||||
printWidth: 120,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @type {import('eslint').Linter.Config} */
|
/** @type {import('eslint').Linter.Config} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
|
@ -29,12 +23,7 @@ module.exports = {
|
||||||
browser: true,
|
browser: true,
|
||||||
es6: true,
|
es6: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: ['react', 'react-hooks', 'prettier', '@typescript-eslint'],
|
||||||
'react',
|
|
||||||
'react-hooks',
|
|
||||||
'prettier',
|
|
||||||
'@typescript-eslint',
|
|
||||||
],
|
|
||||||
extends: [
|
extends: [
|
||||||
// 'standard',
|
// 'standard',
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
|
@ -44,7 +33,7 @@ module.exports = {
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
eqeqeq: 'error',
|
eqeqeq: 'error',
|
||||||
'prettier/prettier': ['error', prettier],
|
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
|
||||||
// TypeScript can infer this significantly better than eslint ever can.
|
// TypeScript can infer this significantly better than eslint ever can.
|
||||||
'react/prop-types': 0,
|
'react/prop-types': 0,
|
||||||
'react/display-name': 0,
|
'react/display-name': 0,
|
||||||
|
@ -58,5 +47,5 @@ module.exports = {
|
||||||
'@typescript-eslint/no-use-before-define': 'warn',
|
'@typescript-eslint/no-use-before-define': 'warn',
|
||||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
||||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
|
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,8 +68,8 @@ 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -3,16 +3,19 @@ name: Build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'develop'
|
- "develop"
|
||||||
- 'v2'
|
- "1.0-develop"
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "develop"
|
||||||
|
- "1.0-develop"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ui:
|
ui:
|
||||||
name: UI
|
name: UI
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16]
|
node-version: [16]
|
||||||
steps:
|
steps:
|
||||||
|
@ -23,7 +26,7 @@ jobs:
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'yarn'
|
cache: "yarn"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
|
@ -3,26 +3,28 @@ name: Tests
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'develop'
|
- "develop"
|
||||||
- 'v2'
|
- "1.0-develop"
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "develop"
|
||||||
|
- "1.0-develop"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php: [8.0, 8.1]
|
php: [8.1, 8.2]
|
||||||
database: ['mariadb:10.2', 'mysql:8']
|
database: ["mariadb:10.2", "mysql:8"]
|
||||||
services:
|
services:
|
||||||
database:
|
database:
|
||||||
image: ${{ matrix.database }}
|
image: ${{ matrix.database }}
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_DATABASE: panel_test
|
MYSQL_DATABASE: testing
|
||||||
ports:
|
ports:
|
||||||
- 3306
|
- 3306
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
@ -33,15 +35,15 @@ jobs:
|
||||||
- name: Get cache directory
|
- name: Get cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
~/.php_cs.cache
|
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
||||||
${{ steps.composer-cache.outputs.dir }}
|
restore-keys: |
|
||||||
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
|
${{ runner.os }}-composer-${{ matrix.php }}-
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
|
@ -57,10 +59,6 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
|
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
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
|
@ -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
|
|
@ -1,61 +0,0 @@
|
||||||
name: Publish Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'develop'
|
|
||||||
- 'release/v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
push:
|
|
||||||
name: Push Image to GitHub Packages
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
# Always run against a tag, even if the commit into the tag has [docker skip]
|
|
||||||
# within the commit message.
|
|
||||||
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
|
|
||||||
steps:
|
|
||||||
- name: Code Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Docker Metadata
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
id: docker_meta
|
|
||||||
with:
|
|
||||||
images: ghcr.io/pterodactyl/panel
|
|
||||||
|
|
||||||
- name: Setup QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Docker Login
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Release production build
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
if: "contains(github.ref, 'release/v')"
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
||||||
|
|
||||||
- name: Release development build
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
if: "contains(github.ref, 'develop')"
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
|
@ -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
|
|
@ -3,21 +3,21 @@ name: Release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Code Checkout
|
- name: Code checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
cache: 'yarn'
|
cache: "yarn"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
@ -36,21 +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: Create release archive
|
- name: Create release archive
|
||||||
run: |
|
run: |
|
||||||
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md 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 .eslintignore .eslintrc.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: |
|
||||||
|
@ -58,17 +56,15 @@ 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 release archive
|
- name: Upload release archive
|
||||||
id: upload-release-archive
|
id: upload-release-archive
|
|
@ -8,6 +8,7 @@
|
||||||
storage/framework/*
|
storage/framework/*
|
||||||
/.idea
|
/.idea
|
||||||
/nbproject
|
/nbproject
|
||||||
|
/.direnv
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
*.log
|
*.log
|
||||||
|
@ -28,3 +29,9 @@ misc
|
||||||
coverage.xml
|
coverage.xml
|
||||||
resources/lang/locales.js
|
resources/lang/locales.js
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
result
|
||||||
|
docker-compose.yaml
|
||||||
|
release
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"endOfLine": "lf"
|
||||||
|
}
|
120
CHANGELOG.md
120
CHANGELOG.md
|
@ -3,10 +3,126 @@ 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.
|
||||||
|
|
||||||
## [Unreleased]
|
## v1.11.7
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Java 21 to Minecraft eggs
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Changed minimum PHP version is now 8.0 instead of `7.4`.
|
|
||||||
|
* 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.
|
* 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
|
## v1.10.4
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -23,6 +23,7 @@ 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 \
|
||||||
|
|
|
@ -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>.
|
179
README.md
179
README.md
|
@ -1,72 +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 a free, open-source game server management panel built with PHP, 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
|
||||||
|
|
||||||
|
This will update your panel to the latest version of NookTheme panel is based. <br>
|
||||||
|
You can see the version in the current branch name.
|
||||||
|
### Enter Maintenance Mode
|
||||||
|
|
||||||
|
Whenever you are performing an update you should be sure to place your Panel into maintenance mode. This will prevent
|
||||||
|
users from encountering unexpected errors and ensure everything can be updated before users encounter
|
||||||
|
potentially new features.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /var/www/pterodactyl
|
||||||
|
|
||||||
|
php artisan down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Download the theme
|
||||||
|
|
||||||
|
The first step in the update process is to download the new panel files from GitHub. The command below will download
|
||||||
|
the release archive for the most recent version of Pterodactyl, save it in the current directory and will automatically
|
||||||
|
unpack the archive into your current folder.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -L https://github.com/Nookure/NookTheme/releases/latest/download/panel.tar.gz | tar -xzv
|
||||||
|
```
|
||||||
|
|
||||||
|
Once all of the files are downloaded we need to set the correct permissions on the cache and storage directories to avoid
|
||||||
|
any webserver related errors.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod -R 755 storage/* bootstrap/cache
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update Dependencies
|
||||||
|
|
||||||
|
After you've downloaded all of the new files you will need to upgrade the core components of the panel. To do this,
|
||||||
|
simply run the commands below and follow any prompts.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer install --no-dev --optimize-autoloader
|
||||||
|
```
|
||||||
|
|
||||||
|
### Clear Compiled Template Cache
|
||||||
|
|
||||||
|
You'll also want to clear the compiled template cache to ensure that new and modified templates show up correctly for
|
||||||
|
users.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan view:clear
|
||||||
|
php artisan config:clear
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database Updates
|
||||||
|
|
||||||
|
You'll also need to update your database schema for the newest version of Pterodactyl. Running the command below
|
||||||
|
will update the schema and ensure the default eggs we ship are up to date (and add any new ones we might have). Just
|
||||||
|
remember, _never edit core eggs we ship_! They will be overwritten by this update process.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan migrate --seed --force
|
||||||
|
```
|
||||||
|
|
||||||
|
### Set Permissions
|
||||||
|
|
||||||
|
The last step is to set the proper owner of the files to be the user that runs your webserver. In most cases this
|
||||||
|
is `www-data` but can vary from system to system — 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/)
|
||||||
|
|
||||||
## Sponsors
|
## Star History
|
||||||
I would like to extend my sincere thanks to the following sponsors for helping fund Pterodactyl's developement.
|
|
||||||
[Interested in becoming a sponsor?](https://github.com/sponsors/matthewpi)
|
|
||||||
|
|
||||||
| Company | About |
|
<a href="https://star-history.com/#Nookure/NookTheme&Timeline">
|
||||||
| ------- | ----- |
|
<picture>
|
||||||
| [**WISP**](https://wisp.gg) | Extra features. |
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline&theme=dark" />
|
||||||
| [**BisectHosting**](https://www.bisecthosting.com/) | BisectHosting provides Minecraft, Valheim and other server hosting services with the highest reliability and lightning fast support since 2012. |
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
|
||||||
| [**Fragnet**](https://fragnet.net) | Providing low latency, high-end game hosting solutions to gamers, game studios and eSports platforms. |
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Nookure/NookTheme&type=Timeline" />
|
||||||
| [**Tempest**](https://tempest.net/) | Tempest Hosting is a subsidiary of Path Network, Inc. offering unmetered DDoS protected 10Gbps dedicated servers, starting at just $80/month. Full anycast, tons of filters. |
|
</picture>
|
||||||
| [**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. |
|
</a>
|
||||||
| [**MineStrator**](https://minestrator.com/) | Looking for the most highend French hosting company for your minecraft server? More than 24,000 members on our discord trust us. Give us a try! |
|
|
||||||
| [**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! |
|
|
||||||
| [**DeinServerHost**](https://deinserverhost.de/) | DeinServerHost offers Dedicated, vps and Gameservers for many popular Games like Minecraft and Rust in Germany since 2013. |
|
|
||||||
| [**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.|
|
|
||||||
| [**Gamenodes**](https://gamenodes.nl) | Gamenodes love quality. For Minecraft, Discord Bots and other services, among others. With our own programmers, we provide just that little bit of extra service! |
|
|
||||||
|
|
||||||
### Supported Games
|
|
||||||
Pterodactyl supports a wide variety of games by utilizing Docker containers to isolate each instance. This gives
|
|
||||||
you the power to run game servers without bloating machines with a host of additional dependencies.
|
|
||||||
|
|
||||||
Some of our core supported games include:
|
|
||||||
|
|
||||||
* Minecraft — including Paper, Sponge, Bungeecord, Waterfall, and more
|
|
||||||
* Rust
|
|
||||||
* Terraria
|
|
||||||
* Teamspeak
|
|
||||||
* Mumble
|
|
||||||
* Team Fortress 2
|
|
||||||
* Counter Strike: Global Offensive
|
|
||||||
* Garry's Mod
|
|
||||||
* ARK: Survival Evolved
|
|
||||||
|
|
||||||
In addition to our standard nest of supported games, our community is constantly pushing the limits of this software
|
|
||||||
and there are plenty more games available provided by the community. Some of these games include:
|
|
||||||
|
|
||||||
* Factorio
|
|
||||||
* San Andreas: MP
|
|
||||||
* Pocketmine MP
|
|
||||||
* Squad
|
|
||||||
* Xonotic
|
|
||||||
* Starmade
|
|
||||||
* Discord ATLBot, and most other Node.js/Python discord bots
|
|
||||||
* [and many more...](https://github.com/parkervcp/eggs)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Pterodactyl® Copyright © 2015 - 2022 Dane Everitt and contributors.
|
|
||||||
|
|
||||||
Code released under the [MIT License](./LICENSE.md).
|
Pterodactyl® Copyright © 2015 - 2023 Dane Everitt and contributors.
|
||||||
|
|
||||||
|
> Nookure is not affiliated with Pterodactyl® Panel or its contributors.
|
||||||
|
|
||||||
|
Pterodactyl code released under the [MIT License](./LICENSE.md).
|
||||||
|
|
||||||
|
NookTheme code edits released under the [GNU GPLv3 License](./NookLicense.md).
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# 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.10.x | wings@1.7.x | :white_check_mark: |
|
| 1.11.x | wings@1.11.x | :white_check_mark: |
|
||||||
| 0.7.x | daemon@0.6.x | :x: |
|
| 0.7.x | daemon@0.6.x | :x: |
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
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;
|
||||||
|
@ -44,7 +43,8 @@ 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 = [];
|
protected array $variables = [];
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class AppSettingsCommand extends Command
|
||||||
$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.');
|
$this->output->comment('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(
|
||||||
'Application Timezone',
|
'Application Timezone',
|
||||||
DateTimeZone::listIdentifiers(),
|
\DateTimeZone::listIdentifiers(),
|
||||||
config('app.timezone')
|
config('app.timezone')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -119,6 +119,12 @@ class AppSettingsCommand extends Command
|
||||||
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm('Enable UI based settings editor?', 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 (str_starts_with($this->variables['APP_URL'], 'https://')) {
|
if (str_starts_with($this->variables['APP_URL'], 'https://')) {
|
||||||
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
|
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
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;
|
||||||
|
@ -72,7 +71,7 @@ class DatabaseSettingsCommand extends Command
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->testMySQLConnection();
|
$this->testMySQLConnection();
|
||||||
} catch (PDOException $exception) {
|
} catch (\PDOException $exception) {
|
||||||
$this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage()));
|
$this->output->error(sprintf('Unable to connect to the MySQL server using the provided credentials. The error returned was "%s".', $exception->getMessage()));
|
||||||
$this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');
|
$this->output->error('Your connection credentials have NOT been saved. You will need to provide valid connection information before proceeding.');
|
||||||
|
|
||||||
|
|
|
@ -44,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' => 'Postmark 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';
|
||||||
|
@ -57,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')
|
||||||
);
|
);
|
||||||
|
@ -67,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.');
|
||||||
|
@ -86,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')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,15 +58,16 @@ class InfoCommand extends Command
|
||||||
['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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
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\Filesystem;
|
||||||
|
@ -35,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());
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
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;
|
||||||
|
|
||||||
|
@ -11,7 +10,7 @@ class PruneOrphanedBackupsCommand extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'p:maintenance:prune-backups {--prune-age=}';
|
protected $signature = 'p:maintenance:prune-backups {--prune-age=}';
|
||||||
|
|
||||||
protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.';
|
protected $description = 'Marks all backups older than "n" minutes that have not yet completed as being failed.';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PruneOrphanedBackupsCommand constructor.
|
* PruneOrphanedBackupsCommand constructor.
|
||||||
|
@ -25,7 +24,7 @@ class PruneOrphanedBackupsCommand extends Command
|
||||||
{
|
{
|
||||||
$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 = $this->backupRepository->getBuilder()
|
$query = $this->backupRepository->getBuilder()
|
||||||
|
@ -39,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,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
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;
|
||||||
|
@ -68,7 +67,7 @@ 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());
|
||||||
|
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
@ -177,7 +176,7 @@ class UpgradeCommand extends Command
|
||||||
$this->info('Panel has been successfully upgraded. Please ensure you also update any Wings instances: https://pterodactyl.io/wings/1.0/upgrading.html');
|
$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();
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Console;
|
namespace Pterodactyl\Console;
|
||||||
|
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
use Pterodactyl\Models\ActivityLog;
|
use Pterodactyl\Models\ActivityLog;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Database\Console\PruneCommand;
|
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\Schedule\ProcessRunnableCommand;
|
||||||
use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
|
use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
|
||||||
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
|
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
|
||||||
|
@ -15,7 +18,7 @@ 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');
|
||||||
}
|
}
|
||||||
|
@ -23,8 +26,11 @@ 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(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
|
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
|
||||||
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
|
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
|
||||||
|
@ -37,5 +43,34 @@ class Kernel extends ConsoleKernel
|
||||||
if (config('activity.prune_days')) {
|
if (config('activity.prune_days')) {
|
||||||
$schedule->command(PruneCommand::class, ['--model' => [ActivityLog::class]])->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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Contracts\Repository;
|
||||||
|
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
interface DatabaseHostRepositoryInterface extends RepositoryInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Return database hosts with a count of databases and the node
|
||||||
|
* information for which it is attached.
|
||||||
|
*/
|
||||||
|
public function getWithViewDetails(): Collection;
|
||||||
|
}
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions;
|
namespace Pterodactyl\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
class AccountNotFoundException extends \Exception
|
||||||
|
|
||||||
class AccountNotFoundException extends Exception
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions;
|
namespace Pterodactyl\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
class AutoDeploymentException extends \Exception
|
||||||
|
|
||||||
class AutoDeploymentException extends Exception
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Pterodactyl\Exceptions;
|
namespace Pterodactyl\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Throwable;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
@ -23,7 +22,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
|
||||||
/**
|
/**
|
||||||
* DisplayException constructor.
|
* DisplayException constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $message, ?Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0)
|
public function __construct(string $message, ?\Throwable $previous = null, protected string $level = self::LEVEL_ERROR, int $code = 0)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +66,7 @@ class DisplayException extends PterodactylException implements HttpExceptionInte
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
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 Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
@ -75,13 +73,13 @@ 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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,7 +88,7 @@ class Handler extends ExceptionHandler
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -123,7 +121,7 @@ class Handler extends ExceptionHandler
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function render($request, Throwable $e): Response
|
public function render($request, \Throwable $e): Response
|
||||||
{
|
{
|
||||||
$connections = $this->container->make(Connection::class);
|
$connections = $this->container->make(Connection::class);
|
||||||
|
|
||||||
|
@ -189,7 +187,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
protected function convertExceptionToArray(Throwable $e, array $override = []): array
|
protected function convertExceptionToArray(\Throwable $e, array $override = []): array
|
||||||
{
|
{
|
||||||
$match = self::$exceptionResponseCodes[get_class($e)] ?? null;
|
$match = self::$exceptionResponseCodes[get_class($e)] ?? null;
|
||||||
|
|
||||||
|
@ -235,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);
|
||||||
}
|
}
|
||||||
|
@ -260,11 +258,11 @@ class Handler extends ExceptionHandler
|
||||||
*
|
*
|
||||||
* @return \Throwable[]
|
* @return \Throwable[]
|
||||||
*/
|
*/
|
||||||
protected function extractPrevious(Throwable $e): array
|
protected function extractPrevious(\Throwable $e): array
|
||||||
{
|
{
|
||||||
$previous = [];
|
$previous = [];
|
||||||
while ($value = $e->getPrevious()) {
|
while ($value = $e->getPrevious()) {
|
||||||
if (!$value instanceof Throwable) {
|
if (!$value instanceof \Throwable) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$previous[] = $value;
|
$previous[] = $value;
|
||||||
|
@ -278,7 +276,7 @@ class Handler extends ExceptionHandler
|
||||||
* Helper method to allow reaching into the handler to convert an exception
|
* Helper method to allow reaching into the handler to convert an exception
|
||||||
* into the expected array response type.
|
* into the expected array response type.
|
||||||
*/
|
*/
|
||||||
public static function toArray(Throwable $e): array
|
public static function toArray(\Throwable $e): array
|
||||||
{
|
{
|
||||||
return (new self(app()))->convertExceptionToArray($e);
|
return (new self(app()))->convertExceptionToArray($e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions\Http\Server;
|
namespace Pterodactyl\Exceptions\Http\Server;
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||||
|
|
||||||
|
@ -12,11 +11,13 @@ class ServerStateConflictException extends ConflictHttpException
|
||||||
* Exception thrown when the server is in an unsupported state for API access or
|
* Exception thrown when the server is in an unsupported state for API access or
|
||||||
* certain operations within the codebase.
|
* certain operations within the codebase.
|
||||||
*/
|
*/
|
||||||
public function __construct(Server $server, Throwable $previous = null)
|
public function __construct(Server $server, \Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$message = 'This server is currently in an unsupported state, please try again later.';
|
$message = 'This server is currently in an unsupported state, please try again later.';
|
||||||
if ($server->isSuspended()) {
|
if ($server->isSuspended()) {
|
||||||
$message = 'This server is currently suspended and the functionality requested is unavailable.';
|
$message = 'This server is currently suspended and the functionality requested is unavailable.';
|
||||||
|
} elseif ($server->node->isUnderMaintenance()) {
|
||||||
|
$message = 'The node of this server is currently under maintenance and the functionality requested is unavailable.';
|
||||||
} elseif (!$server->isInstalled()) {
|
} elseif (!$server->isInstalled()) {
|
||||||
$message = 'This server has not yet completed its installation process, please try again later.';
|
$message = 'This server has not yet completed its installation process, please try again later.';
|
||||||
} elseif ($server->status === Server::STATUS_RESTORING_BACKUP) {
|
} elseif ($server->status === Server::STATUS_RESTORING_BACKUP) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions\Http;
|
namespace Pterodactyl\Exceptions\Http;
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||||
|
@ -12,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
|
||||||
/**
|
/**
|
||||||
* TwoFactorAuthRequiredException constructor.
|
* TwoFactorAuthRequiredException constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(Throwable $previous = null)
|
public function __construct(\Throwable $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous);
|
parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Exceptions;
|
||||||
|
|
||||||
|
use Spatie\Ignition\Contracts\Solution;
|
||||||
|
use Spatie\Ignition\Contracts\ProvidesSolution;
|
||||||
|
|
||||||
|
class ManifestDoesNotExistException extends \Exception implements ProvidesSolution
|
||||||
|
{
|
||||||
|
public function getSolution(): Solution
|
||||||
|
{
|
||||||
|
return new Solutions\ManifestDoesNotExistSolution();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions;
|
namespace Pterodactyl\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
class PterodactylException extends \Exception
|
||||||
|
|
||||||
class PterodactylException extends Exception
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions\Service\Helper;
|
namespace Pterodactyl\Exceptions\Service\Helper;
|
||||||
|
|
||||||
use Exception;
|
class CdnVersionFetchingException extends \Exception
|
||||||
|
|
||||||
class CdnVersionFetchingException extends Exception
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Exceptions\Service;
|
namespace Pterodactyl\Exceptions\Service;
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
|
|
||||||
class ServiceLimitExceededException extends DisplayException
|
class ServiceLimitExceededException extends DisplayException
|
||||||
|
@ -11,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException
|
||||||
* Exception thrown when something goes over a defined limit, such as allocated
|
* Exception thrown when something goes over a defined limit, such as allocated
|
||||||
* ports, tasks, databases, etc.
|
* ports, tasks, databases, etc.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $message, Throwable $previous = null)
|
public function __construct(string $message, \Throwable $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $previous, self::LEVEL_WARNING);
|
parent::__construct($message, $previous, self::LEVEL_WARNING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Exceptions\Solutions;
|
||||||
|
|
||||||
|
use Spatie\Ignition\Contracts\Solution;
|
||||||
|
|
||||||
|
class ManifestDoesNotExistSolution implements Solution
|
||||||
|
{
|
||||||
|
public function getSolutionTitle(): string
|
||||||
|
{
|
||||||
|
return "The manifest.json file hasn't been generated yet";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSolutionDescription(): string
|
||||||
|
{
|
||||||
|
return 'Run yarn run build:production to build the frontend first.';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDocumentationLinks(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Docs' => 'https://github.com/pterodactyl/panel/blob/develop/package.json',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ use Aws\S3\S3Client;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use League\Flysystem\FilesystemAdapter;
|
use League\Flysystem\FilesystemAdapter;
|
||||||
use Pterodactyl\Extensions\Filesystem\S3Filesystem;
|
use Pterodactyl\Extensions\Filesystem\S3Filesystem;
|
||||||
|
@ -70,7 +69,7 @@ class BackupManager
|
||||||
$config = $this->getConfig($name);
|
$config = $this->getConfig($name);
|
||||||
|
|
||||||
if (empty($config['adapter'])) {
|
if (empty($config['adapter'])) {
|
||||||
throw new InvalidArgumentException("Backup disk [$name] does not have a configured adapter.");
|
throw new \InvalidArgumentException("Backup disk [$name] does not have a configured adapter.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$adapter = $config['adapter'];
|
$adapter = $config['adapter'];
|
||||||
|
@ -88,7 +87,7 @@ class BackupManager
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException("Adapter [$adapter] is not supported.");
|
throw new \InvalidArgumentException("Adapter [$adapter] is not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,7 +103,7 @@ class BackupManager
|
||||||
*/
|
*/
|
||||||
public function createWingsAdapter(array $config): FilesystemAdapter
|
public function createWingsAdapter(array $config): FilesystemAdapter
|
||||||
{
|
{
|
||||||
return new InMemoryFilesystemAdapter(null);
|
return new InMemoryFilesystemAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +163,7 @@ class BackupManager
|
||||||
/**
|
/**
|
||||||
* Register a custom adapter creator closure.
|
* Register a custom adapter creator closure.
|
||||||
*/
|
*/
|
||||||
public function extend(string $adapter, Closure $callback): self
|
public function extend(string $adapter, \Closure $callback): self
|
||||||
{
|
{
|
||||||
$this->customCreators[$adapter] = $callback;
|
$this->customCreators[$adapter] = $callback;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Extensions;
|
||||||
use Pterodactyl\Models\DatabaseHost;
|
use Pterodactyl\Models\DatabaseHost;
|
||||||
use Illuminate\Contracts\Encryption\Encrypter;
|
use Illuminate\Contracts\Encryption\Encrypter;
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
||||||
|
|
||||||
class DynamicDatabaseConnection
|
class DynamicDatabaseConnection
|
||||||
{
|
{
|
||||||
|
@ -17,18 +18,20 @@ class DynamicDatabaseConnection
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected ConfigRepository $config,
|
protected ConfigRepository $config,
|
||||||
protected Encrypter $encrypter
|
protected Encrypter $encrypter,
|
||||||
|
protected DatabaseHostRepositoryInterface $repository
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a dynamic database connection entry to the runtime config.
|
* Adds a dynamic database connection entry to the runtime config.
|
||||||
*
|
*
|
||||||
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function set(string $connection, DatabaseHost|int $host, string $database = 'mysql'): void
|
public function set(string $connection, DatabaseHost|int $host, string $database = 'mysql'): void
|
||||||
{
|
{
|
||||||
if (!$host instanceof DatabaseHost) {
|
if (!$host instanceof DatabaseHost) {
|
||||||
$host = DatabaseHost::query()->findOrFail($host);
|
$host = $this->repository->find($host);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config->set('database.connections.' . $connection, [
|
$this->config->set('database.connections.' . $connection, [
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Extensions\Lcobucci\JWT\Encoding;
|
namespace Pterodactyl\Extensions\Lcobucci\JWT\Encoding;
|
||||||
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use Lcobucci\JWT\ClaimsFormatter;
|
use Lcobucci\JWT\ClaimsFormatter;
|
||||||
use Lcobucci\JWT\Token\RegisteredClaims;
|
use Lcobucci\JWT\Token\RegisteredClaims;
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ final class TimestampDates implements ClaimsFormatter
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert($claims[$claim] instanceof DateTimeImmutable);
|
assert($claims[$claim] instanceof \DateTimeImmutable);
|
||||||
$claims[$claim] = $claims[$claim]->getTimestamp();
|
$claims[$claim] = $claims[$claim]->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@ final class Time
|
||||||
*/
|
*/
|
||||||
public static function getMySQLTimezoneOffset(string $timezone): string
|
public static function getMySQLTimezoneOffset(string $timezone): string
|
||||||
{
|
{
|
||||||
$offset = round(CarbonImmutable::now($timezone)->getTimezone()->getOffset(CarbonImmutable::now('UTC')) / 3600);
|
return CarbonImmutable::now($timezone)->getTimezone()->toOffsetName();
|
||||||
|
|
||||||
return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad((string) abs($offset), 2, '0', STR_PAD_LEFT));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Helpers;
|
namespace Pterodactyl\Helpers;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Cron\CronExpression;
|
use Cron\CronExpression;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
@ -25,7 +24,7 @@ class Utilities
|
||||||
|
|
||||||
$string = substr_replace($string, $character, random_int(0, $length - 1), 1);
|
$string = substr_replace($string, $character, random_int(0, $length - 1), 1);
|
||||||
}
|
}
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
// Just log the error and hope for the best at this point.
|
// Just log the error and hope for the best at this point.
|
||||||
Log::error($exception);
|
Log::error($exception);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Pterodactyl\Http\Controllers\Admin;
|
namespace Pterodactyl\Http\Controllers\Admin;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use PDOException;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Pterodactyl\Models\DatabaseHost;
|
use Pterodactyl\Models\DatabaseHost;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
@ -12,11 +11,11 @@ use Illuminate\View\Factory as ViewFactory;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\Databases\Hosts\HostUpdateService;
|
use Pterodactyl\Services\Databases\Hosts\HostUpdateService;
|
||||||
use Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest;
|
use Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest;
|
||||||
use Pterodactyl\Exceptions\Service\HasActiveServersException;
|
|
||||||
use Pterodactyl\Services\Databases\Hosts\HostCreationService;
|
use Pterodactyl\Services\Databases\Hosts\HostCreationService;
|
||||||
use Pterodactyl\Services\Databases\Hosts\HostDeletionService;
|
use Pterodactyl\Services\Databases\Hosts\HostDeletionService;
|
||||||
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
||||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||||
|
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
||||||
|
|
||||||
class DatabaseController extends Controller
|
class DatabaseController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -25,6 +24,7 @@ class DatabaseController extends Controller
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private AlertsMessageBag $alert,
|
private AlertsMessageBag $alert,
|
||||||
|
private DatabaseHostRepositoryInterface $repository,
|
||||||
private DatabaseRepositoryInterface $databaseRepository,
|
private DatabaseRepositoryInterface $databaseRepository,
|
||||||
private HostCreationService $creationService,
|
private HostCreationService $creationService,
|
||||||
private HostDeletionService $deletionService,
|
private HostDeletionService $deletionService,
|
||||||
|
@ -39,25 +39,22 @@ class DatabaseController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$hosts = DatabaseHost::query()
|
|
||||||
->withCount('databases')
|
|
||||||
->with('node')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return $this->view->make('admin.databases.index', [
|
return $this->view->make('admin.databases.index', [
|
||||||
'locations' => $this->locationRepository->getAllWithNodes(),
|
'locations' => $this->locationRepository->getAllWithNodes(),
|
||||||
'hosts' => $hosts,
|
'hosts' => $this->repository->getWithViewDetails(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display database host to user.
|
* Display database host to user.
|
||||||
|
*
|
||||||
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function view(int $host): View
|
public function view(int $host): View
|
||||||
{
|
{
|
||||||
return $this->view->make('admin.databases.view', [
|
return $this->view->make('admin.databases.view', [
|
||||||
'locations' => $this->locationRepository->getAllWithNodes(),
|
'locations' => $this->locationRepository->getAllWithNodes(),
|
||||||
'host' => DatabaseHost::query()->findOrFail($host),
|
'host' => $this->repository->find($host),
|
||||||
'databases' => $this->databaseRepository->getDatabasesForHost($host),
|
'databases' => $this->databaseRepository->getDatabasesForHost($host),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -71,8 +68,8 @@ class DatabaseController extends Controller
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$host = $this->creationService->handle($request->normalize());
|
$host = $this->creationService->handle($request->normalize());
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
|
if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
|
||||||
$this->alert->danger(
|
$this->alert->danger(
|
||||||
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
|
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
|
||||||
)->flash();
|
)->flash();
|
||||||
|
@ -100,10 +97,10 @@ class DatabaseController extends Controller
|
||||||
try {
|
try {
|
||||||
$this->updateService->handle($host->id, $request->normalize());
|
$this->updateService->handle($host->id, $request->normalize());
|
||||||
$this->alert->success('Database host was updated successfully.')->flash();
|
$this->alert->success('Database host was updated successfully.')->flash();
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
// Catch any SQL related exceptions and display them back to the user, otherwise just
|
// Catch any SQL related exceptions and display them back to the user, otherwise just
|
||||||
// throw the exception like normal and move on with it.
|
// throw the exception like normal and move on with it.
|
||||||
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
|
if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
|
||||||
$this->alert->danger(
|
$this->alert->danger(
|
||||||
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
|
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
|
||||||
)->flash();
|
)->flash();
|
||||||
|
@ -120,7 +117,7 @@ class DatabaseController extends Controller
|
||||||
/**
|
/**
|
||||||
* Handle request to delete a database host.
|
* Handle request to delete a database host.
|
||||||
*
|
*
|
||||||
* @throws HasActiveServersException
|
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||||
*/
|
*/
|
||||||
public function delete(int $host): RedirectResponse
|
public function delete(int $host): RedirectResponse
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin\Nests;
|
namespace Pterodactyl\Http\Controllers\Admin\Nests;
|
||||||
|
|
||||||
use JavaScript;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Pterodactyl\Models\Egg;
|
use Pterodactyl\Models\Egg;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
@ -40,7 +39,7 @@ class EggController extends Controller
|
||||||
public function create(): View
|
public function create(): View
|
||||||
{
|
{
|
||||||
$nests = $this->nestRepository->getWithEggs();
|
$nests = $this->nestRepository->getWithEggs();
|
||||||
JavaScript::put(['nests' => $nests->keyBy('id')]);
|
\JavaScript::put(['nests' => $nests->keyBy('id')]);
|
||||||
|
|
||||||
return $this->view->make('admin.eggs.new', ['nests' => $nests]);
|
return $this->view->make('admin.eggs.new', ['nests' => $nests]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class EggVariableController extends Controller
|
||||||
{
|
{
|
||||||
$this->updateService->handle($variable, $request->normalize());
|
$this->updateService->handle($variable, $request->normalize());
|
||||||
$this->alert->success(trans('admin/nests.variables.notices.variable_updated', [
|
$this->alert->success(trans('admin/nests.variables.notices.variable_updated', [
|
||||||
'variable' => $variable->name,
|
'variable' => htmlspecialchars($variable->name),
|
||||||
]))->flash();
|
]))->flash();
|
||||||
|
|
||||||
return redirect()->route('admin.nests.egg.variables', $egg->id);
|
return redirect()->route('admin.nests.egg.variables', $egg->id);
|
||||||
|
@ -82,7 +82,7 @@ class EggVariableController extends Controller
|
||||||
{
|
{
|
||||||
$this->variableRepository->delete($variable->id);
|
$this->variableRepository->delete($variable->id);
|
||||||
$this->alert->success(trans('admin/nests.variables.notices.variable_deleted', [
|
$this->alert->success(trans('admin/nests.variables.notices.variable_deleted', [
|
||||||
'variable' => $variable->name,
|
'variable' => htmlspecialchars($variable->name),
|
||||||
]))->flash();
|
]))->flash();
|
||||||
|
|
||||||
return redirect()->route('admin.nests.egg.variables', $egg);
|
return redirect()->route('admin.nests.egg.variables', $egg);
|
||||||
|
|
|
@ -56,7 +56,7 @@ class NestController extends Controller
|
||||||
public function store(StoreNestFormRequest $request): RedirectResponse
|
public function store(StoreNestFormRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
$nest = $this->nestCreationService->handle($request->normalize());
|
$nest = $this->nestCreationService->handle($request->normalize());
|
||||||
$this->alert->success(trans('admin/nests.notices.created', ['name' => $nest->name]))->flash();
|
$this->alert->success(trans('admin/nests.notices.created', ['name' => htmlspecialchars($nest->name)]))->flash();
|
||||||
|
|
||||||
return redirect()->route('admin.nests.view', $nest->id);
|
return redirect()->route('admin.nests.view', $nest->id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class NodesController extends Controller
|
||||||
['ip', '=', $request->input('ip')],
|
['ip', '=', $request->input('ip')],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->alert->success(trans('admin/node.notices.unallocated_deleted', ['ip' => $request->input('ip')]))
|
$this->alert->success(trans('admin/node.notices.unallocated_deleted', ['ip' => htmlspecialchars($request->input('ip'))]))
|
||||||
->flash();
|
->flash();
|
||||||
|
|
||||||
return redirect()->route('admin.nodes.view.allocation', $node);
|
return redirect()->route('admin.nodes.view.allocation', $node);
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
||||||
|
|
||||||
use JavaScript;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Pterodactyl\Models\Node;
|
use Pterodactyl\Models\Node;
|
||||||
use Pterodactyl\Models\Location;
|
use Pterodactyl\Models\Location;
|
||||||
|
@ -45,7 +44,7 @@ class CreateServerController extends Controller
|
||||||
|
|
||||||
$nests = $this->nestRepository->getWithEggs();
|
$nests = $this->nestRepository->getWithEggs();
|
||||||
|
|
||||||
JavaScript::put([
|
\JavaScript::put([
|
||||||
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
|
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
|
||||||
'nests' => $nests->map(function ($item) {
|
'nests' => $nests->map(function ($item) {
|
||||||
return array_merge($item->toArray(), [
|
return array_merge($item->toArray(), [
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
||||||
|
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Prologue\Alerts\AlertsMessageBag;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Prologue\Alerts\AlertsMessageBag;
|
||||||
use Pterodactyl\Models\ServerTransfer;
|
use Pterodactyl\Models\ServerTransfer;
|
||||||
|
use Illuminate\Database\ConnectionInterface;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\Servers\TransferService;
|
use Pterodactyl\Services\Nodes\NodeJWTService;
|
||||||
use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
||||||
use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository;
|
use Pterodactyl\Repositories\Wings\DaemonTransferRepository;
|
||||||
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
|
||||||
|
|
||||||
class ServerTransferController extends Controller
|
class ServerTransferController extends Controller
|
||||||
|
@ -21,9 +23,10 @@ class ServerTransferController extends Controller
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private AlertsMessageBag $alert,
|
private AlertsMessageBag $alert,
|
||||||
private AllocationRepositoryInterface $allocationRepository,
|
private AllocationRepositoryInterface $allocationRepository,
|
||||||
private NodeRepository $nodeRepository,
|
private ConnectionInterface $connection,
|
||||||
private TransferService $transferService,
|
private DaemonTransferRepository $daemonTransferRepository,
|
||||||
private DaemonConfigurationRepository $daemonConfigurationRepository
|
private NodeJWTService $nodeJWTService,
|
||||||
|
private NodeRepository $nodeRepository
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,12 +49,15 @@ class ServerTransferController extends Controller
|
||||||
|
|
||||||
// Check if the node is viable for the transfer.
|
// Check if the node is viable for the transfer.
|
||||||
$node = $this->nodeRepository->getNodeWithResourceUsage($node_id);
|
$node = $this->nodeRepository->getNodeWithResourceUsage($node_id);
|
||||||
if ($node->isViable($server->memory, $server->disk)) {
|
if (!$node->isViable($server->memory, $server->disk)) {
|
||||||
// Check if the selected daemon is online.
|
$this->alert->danger(trans('admin/server.alerts.transfer_not_viable'))->flash();
|
||||||
$this->daemonConfigurationRepository->setNode($node)->getSystemInformation();
|
|
||||||
|
return redirect()->route('admin.servers.view.manage', $server->id);
|
||||||
|
}
|
||||||
|
|
||||||
$server->validateTransferState();
|
$server->validateTransferState();
|
||||||
|
|
||||||
|
$this->connection->transaction(function () use ($server, $node_id, $allocation_id, $additional_allocations) {
|
||||||
// Create a new ServerTransfer entry.
|
// Create a new ServerTransfer entry.
|
||||||
$transfer = new ServerTransfer();
|
$transfer = new ServerTransfer();
|
||||||
|
|
||||||
|
@ -68,13 +74,19 @@ class ServerTransferController extends Controller
|
||||||
// Add the allocations to the server, so they cannot be automatically assigned while the transfer is in progress.
|
// Add the allocations to the server, so they cannot be automatically assigned while the transfer is in progress.
|
||||||
$this->assignAllocationsToServer($server, $node_id, $allocation_id, $additional_allocations);
|
$this->assignAllocationsToServer($server, $node_id, $allocation_id, $additional_allocations);
|
||||||
|
|
||||||
// Request an archive from the server's current daemon. (this also checks if the daemon is online)
|
// Generate a token for the destination node that the source node can use to authenticate with.
|
||||||
$this->transferService->requestArchive($server);
|
$token = $this->nodeJWTService
|
||||||
|
->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
|
||||||
|
->setSubject($server->uuid)
|
||||||
|
->handle($transfer->newNode, $server->uuid, 'sha256');
|
||||||
|
|
||||||
|
// Notify the source node of the pending outgoing transfer.
|
||||||
|
$this->daemonTransferRepository->setServer($server)->notify($transfer->newNode, $token);
|
||||||
|
|
||||||
|
return $transfer;
|
||||||
|
});
|
||||||
|
|
||||||
$this->alert->success(trans('admin/server.alerts.transfer_started'))->flash();
|
$this->alert->success(trans('admin/server.alerts.transfer_started'))->flash();
|
||||||
} else {
|
|
||||||
$this->alert->danger(trans('admin/server.alerts.transfer_not_viable'))->flash();
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route('admin.servers.view.manage', $server->id);
|
return redirect()->route('admin.servers.view.manage', $server->id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
namespace Pterodactyl\Http\Controllers\Admin\Servers;
|
||||||
|
|
||||||
use JavaScript;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Nest;
|
use Pterodactyl\Models\Nest;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Models\DatabaseHost;
|
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\Servers\EnvironmentService;
|
use Pterodactyl\Services\Servers\EnvironmentService;
|
||||||
|
@ -18,6 +16,7 @@ use Pterodactyl\Repositories\Eloquent\MountRepository;
|
||||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||||
use Pterodactyl\Traits\Controllers\JavascriptInjection;
|
use Pterodactyl\Traits\Controllers\JavascriptInjection;
|
||||||
use Pterodactyl\Repositories\Eloquent\LocationRepository;
|
use Pterodactyl\Repositories\Eloquent\LocationRepository;
|
||||||
|
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
|
||||||
|
|
||||||
class ServerViewController extends Controller
|
class ServerViewController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -27,6 +26,7 @@ class ServerViewController extends Controller
|
||||||
* ServerViewController constructor.
|
* ServerViewController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
private DatabaseHostRepository $databaseHostRepository,
|
||||||
private LocationRepository $locationRepository,
|
private LocationRepository $locationRepository,
|
||||||
private MountRepository $mountRepository,
|
private MountRepository $mountRepository,
|
||||||
private NestRepository $nestRepository,
|
private NestRepository $nestRepository,
|
||||||
|
@ -96,7 +96,7 @@ class ServerViewController extends Controller
|
||||||
public function database(Request $request, Server $server): View
|
public function database(Request $request, Server $server): View
|
||||||
{
|
{
|
||||||
return $this->view->make('admin.servers.view.database', [
|
return $this->view->make('admin.servers.view.database', [
|
||||||
'hosts' => DatabaseHost::all(),
|
'hosts' => $this->databaseHostRepository->all(),
|
||||||
'server' => $server,
|
'server' => $server,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ class ServerViewController extends Controller
|
||||||
$canTransfer = true;
|
$canTransfer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JavaScript::put([
|
\JavaScript::put([
|
||||||
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
|
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Pterodactyl\Services\Databases\DatabasePasswordService;
|
||||||
use Pterodactyl\Services\Servers\DetailsModificationService;
|
use Pterodactyl\Services\Servers\DetailsModificationService;
|
||||||
use Pterodactyl\Services\Servers\StartupModificationService;
|
use Pterodactyl\Services\Servers\StartupModificationService;
|
||||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||||
|
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
|
||||||
use Pterodactyl\Services\Databases\DatabaseManagementService;
|
use Pterodactyl\Services\Databases\DatabaseManagementService;
|
||||||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||||
|
@ -47,6 +48,7 @@ class ServersController extends Controller
|
||||||
protected DatabaseManagementService $databaseManagementService,
|
protected DatabaseManagementService $databaseManagementService,
|
||||||
protected DatabasePasswordService $databasePasswordService,
|
protected DatabasePasswordService $databasePasswordService,
|
||||||
protected DatabaseRepositoryInterface $databaseRepository,
|
protected DatabaseRepositoryInterface $databaseRepository,
|
||||||
|
protected DatabaseHostRepository $databaseHostRepository,
|
||||||
protected ServerDeletionService $deletionService,
|
protected ServerDeletionService $deletionService,
|
||||||
protected DetailsModificationService $detailsModificationService,
|
protected DetailsModificationService $detailsModificationService,
|
||||||
protected ReinstallServerService $reinstallService,
|
protected ReinstallServerService $reinstallService,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Admin\Settings;
|
namespace Pterodactyl\Http\Controllers\Admin\Settings;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
@ -39,7 +38,7 @@ class MailController extends Controller
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
return $this->view->make('admin.settings.mail', [
|
return $this->view->make('admin.settings.mail', [
|
||||||
'disabled' => $this->config->get('mail.driver') !== 'smtp',
|
'disabled' => $this->config->get('mail.default') !== 'smtp',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,13 +51,13 @@ class MailController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update(MailSettingsFormRequest $request): Response
|
public function update(MailSettingsFormRequest $request): Response
|
||||||
{
|
{
|
||||||
if ($this->config->get('mail.driver') !== 'smtp') {
|
if ($this->config->get('mail.default') !== 'smtp') {
|
||||||
throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.');
|
throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = $request->normalize();
|
$values = $request->normalize();
|
||||||
if (array_get($values, 'mail:password') === '!e') {
|
if (array_get($values, 'mail:mailers:smtp:password') === '!e') {
|
||||||
$values['mail:password'] = '';
|
$values['mail:mailers:smtp:password'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($values as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
|
@ -82,7 +81,7 @@ class MailController extends Controller
|
||||||
try {
|
try {
|
||||||
Notification::route('mail', $request->user()->email)
|
Notification::route('mail', $request->user()->email)
|
||||||
->notify(new MailTested($request->user()));
|
->notify(new MailTested($request->user()));
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
return response($exception->getMessage(), 500);
|
return response($exception->getMessage(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ use Pterodactyl\Traits\Helpers\AvailableLanguages;
|
||||||
use Pterodactyl\Services\Users\UserCreationService;
|
use Pterodactyl\Services\Users\UserCreationService;
|
||||||
use Pterodactyl\Services\Users\UserDeletionService;
|
use Pterodactyl\Services\Users\UserDeletionService;
|
||||||
use Pterodactyl\Http\Requests\Admin\UserFormRequest;
|
use Pterodactyl\Http\Requests\Admin\UserFormRequest;
|
||||||
|
use Pterodactyl\Http\Requests\Admin\NewUserFormRequest;
|
||||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
|
@ -103,7 +104,7 @@ class UserController extends Controller
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function store(UserFormRequest $request): RedirectResponse
|
public function store(NewUserFormRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
$user = $this->creationService->handle($request->normalize());
|
$user = $this->creationService->handle($request->normalize());
|
||||||
$this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash();
|
$this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash();
|
||||||
|
|
|
@ -18,6 +18,7 @@ use Pterodactyl\Transformers\Api\Client\BackupTransformer;
|
||||||
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
|
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest;
|
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest;
|
||||||
|
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\RestoreBackupRequest;
|
||||||
|
|
||||||
class BackupController extends ClientApiController
|
class BackupController extends ClientApiController
|
||||||
{
|
{
|
||||||
|
@ -188,12 +189,8 @@ class BackupController extends ClientApiController
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function restore(Request $request, Server $server, Backup $backup): JsonResponse
|
public function restore(RestoreBackupRequest $request, Server $server, Backup $backup): JsonResponse
|
||||||
{
|
{
|
||||||
if (!$request->user()->can(Permission::ACTION_BACKUP_RESTORE, $server)) {
|
|
||||||
throw new AuthorizationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cannot restore a backup unless a server is fully installed and not currently
|
// Cannot restore a backup unless a server is fully installed and not currently
|
||||||
// processing a different backup restoration request.
|
// processing a different backup restoration request.
|
||||||
if (!is_null($server->status)) {
|
if (!is_null($server->status)) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
|
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
@ -178,7 +177,7 @@ class ScheduleController extends ClientApiController
|
||||||
$request->input('month'),
|
$request->input('month'),
|
||||||
$request->input('day_of_week')
|
$request->input('day_of_week')
|
||||||
);
|
);
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
throw new DisplayException('The cron data provided does not evaluate to a valid expression.');
|
throw new DisplayException('The cron data provided does not evaluate to a valid expression.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Pterodactyl\Models\Schedule;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Pterodactyl\Facades\Activity;
|
use Pterodactyl\Facades\Activity;
|
||||||
use Pterodactyl\Models\Permission;
|
use Pterodactyl\Models\Permission;
|
||||||
|
use Illuminate\Database\ConnectionInterface;
|
||||||
use Pterodactyl\Repositories\Eloquent\TaskRepository;
|
use Pterodactyl\Repositories\Eloquent\TaskRepository;
|
||||||
use Pterodactyl\Exceptions\Http\HttpForbiddenException;
|
use Pterodactyl\Exceptions\Http\HttpForbiddenException;
|
||||||
use Pterodactyl\Transformers\Api\Client\TaskTransformer;
|
use Pterodactyl\Transformers\Api\Client\TaskTransformer;
|
||||||
|
@ -23,8 +24,10 @@ class ScheduleTaskController extends ClientApiController
|
||||||
/**
|
/**
|
||||||
* ScheduleTaskController constructor.
|
* ScheduleTaskController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(private TaskRepository $repository)
|
public function __construct(
|
||||||
{
|
private ConnectionInterface $connection,
|
||||||
|
private TaskRepository $repository
|
||||||
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +52,35 @@ class ScheduleTaskController extends ClientApiController
|
||||||
$lastTask = $schedule->tasks()->orderByDesc('sequence_id')->first();
|
$lastTask = $schedule->tasks()->orderByDesc('sequence_id')->first();
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Task $task */
|
/** @var \Pterodactyl\Models\Task $task */
|
||||||
$task = $this->repository->create([
|
$task = $this->connection->transaction(function () use ($request, $schedule, $lastTask) {
|
||||||
|
$sequenceId = ($lastTask->sequence_id ?? 0) + 1;
|
||||||
|
$requestSequenceId = $request->integer('sequence_id', $sequenceId);
|
||||||
|
|
||||||
|
// Ensure that the sequence id is at least 1.
|
||||||
|
if ($requestSequenceId < 1) {
|
||||||
|
$requestSequenceId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the sequence id from the request is greater than or equal to the next available
|
||||||
|
// sequence id, we don't need to do anything special. Otherwise, we need to update
|
||||||
|
// the sequence id of all tasks that are greater than or equal to the request sequence
|
||||||
|
// id to be one greater than the current value.
|
||||||
|
if ($requestSequenceId < $sequenceId) {
|
||||||
|
$schedule->tasks()
|
||||||
|
->where('sequence_id', '>=', $requestSequenceId)
|
||||||
|
->increment('sequence_id');
|
||||||
|
$sequenceId = $requestSequenceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->repository->create([
|
||||||
'schedule_id' => $schedule->id,
|
'schedule_id' => $schedule->id,
|
||||||
'sequence_id' => ($lastTask->sequence_id ?? 0) + 1,
|
'sequence_id' => $sequenceId,
|
||||||
'action' => $request->input('action'),
|
'action' => $request->input('action'),
|
||||||
'payload' => $request->input('payload') ?? '',
|
'payload' => $request->input('payload') ?? '',
|
||||||
'time_offset' => $request->input('time_offset'),
|
'time_offset' => $request->input('time_offset'),
|
||||||
'continue_on_failure' => (bool) $request->input('continue_on_failure'),
|
'continue_on_failure' => $request->boolean('continue_on_failure'),
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
Activity::event('server:task.create')
|
Activity::event('server:task.create')
|
||||||
->subject($schedule, $task)
|
->subject($schedule, $task)
|
||||||
|
@ -84,12 +108,34 @@ class ScheduleTaskController extends ClientApiController
|
||||||
throw new HttpForbiddenException("A backup task cannot be created when the server's backup limit is set to 0.");
|
throw new HttpForbiddenException("A backup task cannot be created when the server's backup limit is set to 0.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->connection->transaction(function () use ($request, $schedule, $task) {
|
||||||
|
$sequenceId = $request->integer('sequence_id', $task->sequence_id);
|
||||||
|
// Ensure that the sequence id is at least 1.
|
||||||
|
if ($sequenceId < 1) {
|
||||||
|
$sequenceId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shift all other tasks in the schedule up or down to make room for the new task.
|
||||||
|
if ($sequenceId < $task->sequence_id) {
|
||||||
|
$schedule->tasks()
|
||||||
|
->where('sequence_id', '>=', $sequenceId)
|
||||||
|
->where('sequence_id', '<', $task->sequence_id)
|
||||||
|
->increment('sequence_id');
|
||||||
|
} elseif ($sequenceId > $task->sequence_id) {
|
||||||
|
$schedule->tasks()
|
||||||
|
->where('sequence_id', '>', $task->sequence_id)
|
||||||
|
->where('sequence_id', '<=', $sequenceId)
|
||||||
|
->decrement('sequence_id');
|
||||||
|
}
|
||||||
|
|
||||||
$this->repository->update($task->id, [
|
$this->repository->update($task->id, [
|
||||||
|
'sequence_id' => $sequenceId,
|
||||||
'action' => $request->input('action'),
|
'action' => $request->input('action'),
|
||||||
'payload' => $request->input('payload') ?? '',
|
'payload' => $request->input('payload') ?? '',
|
||||||
'time_offset' => $request->input('time_offset'),
|
'time_offset' => $request->input('time_offset'),
|
||||||
'continue_on_failure' => (bool) $request->input('continue_on_failure'),
|
'continue_on_failure' => $request->boolean('continue_on_failure'),
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
Activity::event('server:task.update')
|
Activity::event('server:task.update')
|
||||||
->subject($schedule, $task)
|
->subject($schedule, $task)
|
||||||
|
@ -117,10 +163,9 @@ class ScheduleTaskController extends ClientApiController
|
||||||
throw new HttpForbiddenException('You do not have permission to perform this action.');
|
throw new HttpForbiddenException('You do not have permission to perform this action.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$schedule->tasks()->where('sequence_id', '>', $task->sequence_id)->update([
|
$schedule->tasks()
|
||||||
'sequence_id' => $schedule->tasks()->getConnection()->raw('(sequence_id - 1)'),
|
->where('sequence_id', '>', $task->sequence_id)
|
||||||
]);
|
->decrement('sequence_id');
|
||||||
|
|
||||||
$task->delete();
|
$task->delete();
|
||||||
|
|
||||||
Activity::event('server:task.delete')->subject($schedule, $task)->property('name', $schedule->name)->log();
|
Activity::event('server:task.delete')->subject($schedule, $task)->property('name', $schedule->name)->log();
|
||||||
|
|
|
@ -34,13 +34,22 @@ class SettingsController extends ClientApiController
|
||||||
*/
|
*/
|
||||||
public function rename(RenameServerRequest $request, Server $server): JsonResponse
|
public function rename(RenameServerRequest $request, Server $server): JsonResponse
|
||||||
{
|
{
|
||||||
|
$name = $request->input('name');
|
||||||
|
$description = $request->has('description') ? (string) $request->input('description') : $server->description;
|
||||||
$this->repository->update($server->id, [
|
$this->repository->update($server->id, [
|
||||||
'name' => $request->input('name'),
|
'name' => $name,
|
||||||
|
'description' => $description,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($server->name !== $request->input('name')) {
|
if ($server->name !== $name) {
|
||||||
Activity::event('server:settings.rename')
|
Activity::event('server:settings.rename')
|
||||||
->property(['old' => $server->name, 'new' => $request->input('name')])
|
->property(['old' => $server->name, 'new' => $name])
|
||||||
|
->log();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($server->description !== $description) {
|
||||||
|
Activity::event('server:settings.description')
|
||||||
|
->property(['old' => $server->description, 'new' => $description])
|
||||||
->log();
|
->log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DateTimeInterface;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Pterodactyl\Models\User;
|
use Pterodactyl\Models\User;
|
||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
|
@ -37,11 +35,11 @@ class ActivityProcessingController extends Controller
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$when = Carbon::createFromFormat(
|
$when = Carbon::createFromFormat(
|
||||||
DateTimeInterface::RFC3339,
|
\DateTimeInterface::RFC3339,
|
||||||
preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']),
|
preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']),
|
||||||
'UTC'
|
'UTC'
|
||||||
);
|
);
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
Log::warning($exception, ['timestamp' => $datum['timestamp']]);
|
Log::warning($exception, ['timestamp' => $datum['timestamp']]);
|
||||||
|
|
||||||
// If we cannot parse the value for some reason don't blow up this request, just go ahead
|
// If we cannot parse the value for some reason don't blow up this request, just go ahead
|
||||||
|
|
|
@ -32,18 +32,32 @@ class BackupRemoteUploadController extends Controller
|
||||||
*/
|
*/
|
||||||
public function __invoke(Request $request, string $backup): JsonResponse
|
public function __invoke(Request $request, string $backup): JsonResponse
|
||||||
{
|
{
|
||||||
|
// Get the node associated with the request.
|
||||||
|
/** @var \Pterodactyl\Models\Node $node */
|
||||||
|
$node = $request->attributes->get('node');
|
||||||
|
|
||||||
// Get the size query parameter.
|
// Get the size query parameter.
|
||||||
$size = (int) $request->query('size');
|
$size = (int) $request->query('size');
|
||||||
if (empty($size)) {
|
if (empty($size)) {
|
||||||
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
|
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Backup $backup */
|
/** @var \Pterodactyl\Models\Backup $model */
|
||||||
$backup = Backup::query()->where('uuid', $backup)->firstOrFail();
|
$model = Backup::query()
|
||||||
|
->where('uuid', $backup)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
// Check that the backup is "owned" by the node making the request. This avoids other nodes
|
||||||
|
// from messing with backups that they don't own.
|
||||||
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
|
$server = $model->server;
|
||||||
|
if ($server->node_id !== $node->id) {
|
||||||
|
throw new HttpForbiddenException('You do not have permission to access that backup.');
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent backups that have already been completed from trying to
|
// Prevent backups that have already been completed from trying to
|
||||||
// be uploaded again.
|
// be uploaded again.
|
||||||
if (!is_null($backup->completed_at)) {
|
if (!is_null($model->completed_at)) {
|
||||||
throw new ConflictHttpException('This backup is already in a completed state.');
|
throw new ConflictHttpException('This backup is already in a completed state.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +68,7 @@ class BackupRemoteUploadController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// The path where backup will be uploaded to
|
// The path where backup will be uploaded to
|
||||||
$path = sprintf('%s/%s.tar.gz', $backup->server->uuid, $backup->uuid);
|
$path = sprintf('%s/%s.tar.gz', $model->server->uuid, $model->uuid);
|
||||||
|
|
||||||
// Get the S3 client
|
// Get the S3 client
|
||||||
$client = $adapter->getClient();
|
$client = $adapter->getClient();
|
||||||
|
@ -92,7 +106,7 @@ class BackupRemoteUploadController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the upload_id on the backup in the database.
|
// Set the upload_id on the backup in the database.
|
||||||
$backup->update(['upload_id' => $params['UploadId']]);
|
$model->update(['upload_id' => $params['UploadId']]);
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
'parts' => $parts,
|
'parts' => $parts,
|
||||||
|
|
|
@ -30,8 +30,22 @@ class BackupStatusController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(ReportBackupCompleteRequest $request, string $backup): JsonResponse
|
public function index(ReportBackupCompleteRequest $request, string $backup): JsonResponse
|
||||||
{
|
{
|
||||||
|
// Get the node associated with the request.
|
||||||
|
/** @var \Pterodactyl\Models\Node $node */
|
||||||
|
$node = $request->attributes->get('node');
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Backup $model */
|
/** @var \Pterodactyl\Models\Backup $model */
|
||||||
$model = Backup::query()->where('uuid', $backup)->firstOrFail();
|
$model = Backup::query()
|
||||||
|
->where('uuid', $backup)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
// Check that the backup is "owned" by the node making the request. This avoids other nodes
|
||||||
|
// from messing with backups that they don't own.
|
||||||
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
|
$server = $model->server;
|
||||||
|
if ($server->node_id !== $node->id) {
|
||||||
|
throw new HttpForbiddenException('You do not have permission to access that backup.');
|
||||||
|
}
|
||||||
|
|
||||||
if ($model->is_successful) {
|
if ($model->is_successful) {
|
||||||
throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.');
|
throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.');
|
||||||
|
|
|
@ -48,8 +48,18 @@ class ServerInstallController extends Controller
|
||||||
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
|
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
|
||||||
{
|
{
|
||||||
$server = $this->repository->getByUuid($uuid);
|
$server = $this->repository->getByUuid($uuid);
|
||||||
|
$status = null;
|
||||||
|
|
||||||
$status = $request->boolean('successful') ? null : Server::STATUS_INSTALL_FAILED;
|
// Make sure the type of failure is accurate
|
||||||
|
if (!$request->boolean('successful')) {
|
||||||
|
$status = Server::STATUS_INSTALL_FAILED;
|
||||||
|
|
||||||
|
if ($request->boolean('reinstall')) {
|
||||||
|
$status = Server::STATUS_REINSTALL_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep the server suspended if it's already suspended
|
||||||
if ($server->status === Server::STATUS_SUSPENDED) {
|
if ($server->status === Server::STATUS_SUSPENDED) {
|
||||||
$status = Server::STATUS_SUSPENDED;
|
$status = Server::STATUS_SUSPENDED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Controllers\Api\Remote\Servers;
|
namespace Pterodactyl\Http\Controllers\Api\Remote\Servers;
|
||||||
|
|
||||||
use Carbon\CarbonImmutable;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Pterodactyl\Models\Allocation;
|
use Pterodactyl\Models\Allocation;
|
||||||
|
@ -11,10 +9,9 @@ use Illuminate\Support\Facades\Log;
|
||||||
use Pterodactyl\Models\ServerTransfer;
|
use Pterodactyl\Models\ServerTransfer;
|
||||||
use Illuminate\Database\ConnectionInterface;
|
use Illuminate\Database\ConnectionInterface;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\Nodes\NodeJWTService;
|
|
||||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||||
use Pterodactyl\Repositories\Wings\DaemonTransferRepository;
|
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||||
|
|
||||||
class ServerTransferController extends Controller
|
class ServerTransferController extends Controller
|
||||||
|
@ -25,52 +22,10 @@ class ServerTransferController extends Controller
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ConnectionInterface $connection,
|
private ConnectionInterface $connection,
|
||||||
private ServerRepository $repository,
|
private ServerRepository $repository,
|
||||||
private DaemonServerRepository $daemonServerRepository,
|
private DaemonServerRepository $daemonServerRepository
|
||||||
private DaemonTransferRepository $daemonTransferRepository,
|
|
||||||
private NodeJWTService $jwtService
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The daemon notifies us about the archive status.
|
|
||||||
*
|
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
|
||||||
public function archive(Request $request, string $uuid): JsonResponse
|
|
||||||
{
|
|
||||||
$server = $this->repository->getByUuid($uuid);
|
|
||||||
|
|
||||||
// Unsuspend the server and don't continue the transfer.
|
|
||||||
if (!$request->input('successful')) {
|
|
||||||
return $this->processFailedTransfer($server->transfer);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->connection->transaction(function () use ($server) {
|
|
||||||
// This token is used by the new node the server is being transferred to. It allows
|
|
||||||
// that node to communicate with the old node during the process to initiate the
|
|
||||||
// actual file transfer.
|
|
||||||
$token = $this->jwtService
|
|
||||||
->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
|
|
||||||
->setSubject($server->uuid)
|
|
||||||
->handle($server->node, $server->uuid, 'sha256');
|
|
||||||
|
|
||||||
// Update the archived field on the transfer to make clients connect to the websocket
|
|
||||||
// on the new node to be able to receive transfer logs.
|
|
||||||
$server->transfer->forceFill(['archived' => true])->saveOrFail();
|
|
||||||
|
|
||||||
// On the daemon transfer repository, make sure to set the node after the server
|
|
||||||
// because setServer() tells the repository to use the server's node and not the one
|
|
||||||
// we want to specify.
|
|
||||||
$this->daemonTransferRepository
|
|
||||||
->setServer($server)
|
|
||||||
->setNode($server->transfer->newNode)
|
|
||||||
->notify($server, $token);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The daemon notifies us about a transfer failure.
|
* The daemon notifies us about a transfer failure.
|
||||||
*
|
*
|
||||||
|
@ -79,8 +34,12 @@ class ServerTransferController extends Controller
|
||||||
public function failure(string $uuid): JsonResponse
|
public function failure(string $uuid): JsonResponse
|
||||||
{
|
{
|
||||||
$server = $this->repository->getByUuid($uuid);
|
$server = $this->repository->getByUuid($uuid);
|
||||||
|
$transfer = $server->transfer;
|
||||||
|
if (is_null($transfer)) {
|
||||||
|
throw new ConflictHttpException('Server is not being transferred.');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->processFailedTransfer($server->transfer);
|
return $this->processFailedTransfer($transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +51,9 @@ class ServerTransferController extends Controller
|
||||||
{
|
{
|
||||||
$server = $this->repository->getByUuid($uuid);
|
$server = $this->repository->getByUuid($uuid);
|
||||||
$transfer = $server->transfer;
|
$transfer = $server->transfer;
|
||||||
|
if (is_null($transfer)) {
|
||||||
|
throw new ConflictHttpException('Server is not being transferred.');
|
||||||
|
}
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
$server = $this->connection->transaction(function () use ($server, $transfer) {
|
$server = $this->connection->transaction(function () use ($server, $transfer) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ class Kernel extends HttpKernel
|
||||||
/**
|
/**
|
||||||
* The application's route middleware.
|
* The application's route middleware.
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [
|
protected $middlewareAliases = [
|
||||||
'auth' => Authenticate::class,
|
'auth' => Authenticate::class,
|
||||||
'auth.basic' => AuthenticateWithBasicAuth::class,
|
'auth.basic' => AuthenticateWithBasicAuth::class,
|
||||||
'auth.session' => AuthenticateSession::class,
|
'auth.session' => AuthenticateSession::class,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Activity;
|
namespace Pterodactyl\Http\Middleware\Activity;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Facades\LogTarget;
|
use Pterodactyl\Facades\LogTarget;
|
||||||
|
|
||||||
|
@ -12,7 +11,7 @@ class AccountSubject
|
||||||
* Sets the actor and default subject for all requests passing through this
|
* Sets the actor and default subject for all requests passing through this
|
||||||
* middleware to be the currently logged in user.
|
* middleware to be the currently logged in user.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, \Closure $next)
|
||||||
{
|
{
|
||||||
LogTarget::setActor($request->user());
|
LogTarget::setActor($request->user());
|
||||||
LogTarget::setSubject($request->user());
|
LogTarget::setSubject($request->user());
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Activity;
|
namespace Pterodactyl\Http\Middleware\Activity;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Facades\LogTarget;
|
use Pterodactyl\Facades\LogTarget;
|
||||||
|
@ -17,7 +16,7 @@ class ServerSubject
|
||||||
* If no server is found this is a no-op as the activity log service can always
|
* If no server is found this is a no-op as the activity log service can always
|
||||||
* set the user based on the authmanager response.
|
* set the user based on the authmanager response.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, \Closure $next)
|
||||||
{
|
{
|
||||||
$server = $request->route()->parameter('server');
|
$server = $request->route()->parameter('server');
|
||||||
if ($server instanceof Server) {
|
if ($server instanceof Server) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Activity;
|
namespace Pterodactyl\Http\Middleware\Activity;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\ApiKey;
|
use Pterodactyl\Models\ApiKey;
|
||||||
use Pterodactyl\Facades\LogTarget;
|
use Pterodactyl\Facades\LogTarget;
|
||||||
|
@ -15,7 +14,7 @@ class TrackAPIKey
|
||||||
* request singleton so that all tracked activity log events are properly associated
|
* request singleton so that all tracked activity log events are properly associated
|
||||||
* with the given API key.
|
* with the given API key.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
if ($request->user()) {
|
if ($request->user()) {
|
||||||
$token = $request->user()->currentAccessToken();
|
$token = $request->user()->currentAccessToken();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Admin\Servers;
|
namespace Pterodactyl\Http\Middleware\Admin\Servers;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
|
@ -14,7 +13,7 @@ class ServerInstalled
|
||||||
/**
|
/**
|
||||||
* Checks that the server is installed before allowing access through the route.
|
* Checks that the server is installed before allowing access through the route.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Server|null $server */
|
/** @var \Pterodactyl\Models\Server|null $server */
|
||||||
$server = $request->route()->parameter('server');
|
$server = $request->route()->parameter('server');
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ class AdminAuthenticate
|
||||||
*
|
*
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
if (!$request->user() || !$request->user()->root_admin) {
|
if (!$request->user() || !$request->user()->root_admin) {
|
||||||
throw new AccessDeniedHttpException();
|
throw new AccessDeniedHttpException();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
|
||||||
|
@ -12,7 +11,7 @@ class AuthenticateApplicationUser
|
||||||
* Authenticate that the currently authenticated user is an administrator
|
* Authenticate that the currently authenticated user is an administrator
|
||||||
* and should be allowed to proceed through the application API.
|
* and should be allowed to proceed through the application API.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\User|null $user */
|
/** @var \Pterodactyl\Models\User|null $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api;
|
namespace Pterodactyl\Http\Middleware\Api;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use IPTools\IP;
|
use IPTools\IP;
|
||||||
use IPTools\Range;
|
use IPTools\Range;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -18,7 +17,7 @@ class AuthenticateIPAccess
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */
|
/** @var \Laravel\Sanctum\TransientToken|\Pterodactyl\Models\ApiKey $token */
|
||||||
$token = $request->user()->currentAccessToken();
|
$token = $request->user()->currentAccessToken();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api\Client\Server;
|
namespace Pterodactyl\Http\Middleware\Api\Client\Server;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
@ -27,7 +26,7 @@ class AuthenticateServerAccess
|
||||||
/**
|
/**
|
||||||
* Authenticate that this server exists and is not suspended or marked as installing.
|
* Authenticate that this server exists and is not suspended or marked as installing.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\User $user */
|
/** @var \Pterodactyl\Models\User $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
@ -53,7 +52,7 @@ class AuthenticateServerAccess
|
||||||
// Still allow users to get information about their server if it is installing or
|
// Still allow users to get information about their server if it is installing or
|
||||||
// being transferred.
|
// being transferred.
|
||||||
if (!$request->routeIs('api:client:server.view')) {
|
if (!$request->routeIs('api:client:server.view')) {
|
||||||
if ($server->isSuspended() && !$request->routeIs('api:client:server.resources')) {
|
if (($server->isSuspended() || $server->node->isUnderMaintenance()) && !$request->routeIs('api:client:server.resources')) {
|
||||||
throw $exception;
|
throw $exception;
|
||||||
}
|
}
|
||||||
if (!$user->root_admin || !$request->routeIs($this->except)) {
|
if (!$user->root_admin || !$request->routeIs($this->except)) {
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api\Client\Server;
|
namespace Pterodactyl\Http\Middleware\Api\Client\Server;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Models\Task;
|
use Pterodactyl\Models\Task;
|
||||||
use Pterodactyl\Models\User;
|
use Pterodactyl\Models\User;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Pterodactyl\Models\Backup;
|
use Pterodactyl\Models\Backup;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Models\Subuser;
|
use Pterodactyl\Models\Subuser;
|
||||||
|
@ -26,11 +24,11 @@ class ResourceBelongsToServer
|
||||||
* server that is expected, and that we're not accessing a resource completely
|
* server that is expected, and that we're not accessing a resource completely
|
||||||
* unrelated to the server provided in the request.
|
* unrelated to the server provided in the request.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
$params = $request->route()->parameters();
|
$params = $request->route()->parameters();
|
||||||
if (is_null($params) || !$params['server'] instanceof Server) {
|
if (is_null($params) || !$params['server'] instanceof Server) {
|
||||||
throw new InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.');
|
throw new \InvalidArgumentException('This middleware cannot be used in a context that is missing a server in the parameters.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
|
@ -79,7 +77,7 @@ class ResourceBelongsToServer
|
||||||
default:
|
default:
|
||||||
// Don't return a 404 here since we want to make sure no one relies
|
// Don't return a 404 here since we want to make sure no one relies
|
||||||
// on this middleware in a context in which it will not work. Fail safe.
|
// on this middleware in a context in which it will not work. Fail safe.
|
||||||
throw new InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model));
|
throw new \InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api\Client;
|
namespace Pterodactyl\Http\Middleware\Api\Client;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
|
|
||||||
|
@ -11,7 +10,7 @@ class SubstituteClientBindings extends SubstituteBindings
|
||||||
/**
|
/**
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next): mixed
|
public function handle($request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
// Override default behavior of the model binding to use a specific table
|
// Override default behavior of the model binding to use a specific table
|
||||||
// column rather than the default 'id'.
|
// column rather than the default 'id'.
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api\Daemon;
|
namespace Pterodactyl\Http\Middleware\Api\Daemon;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Contracts\Encryption\Encrypter;
|
use Illuminate\Contracts\Encryption\Encrypter;
|
||||||
use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
use Pterodactyl\Repositories\Eloquent\NodeRepository;
|
||||||
|
@ -32,7 +31,7 @@ class DaemonAuthenticate
|
||||||
*
|
*
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
|
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
if (in_array($request->route()->getName(), $this->except)) {
|
if (in_array($request->route()->getName(), $this->except)) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware\Api;
|
namespace Pterodactyl\Http\Middleware\Api;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use JsonException;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
|
|
||||||
|
@ -14,12 +12,12 @@ class IsValidJson
|
||||||
* parsing the data. This avoids confusing validation errors where every field is flagged and
|
* parsing the data. This avoids confusing validation errors where every field is flagged and
|
||||||
* it is not immediately clear that there is an issue with the JSON being passed.
|
* it is not immediately clear that there is an issue with the JSON being passed.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
if ($request->isJson() && !empty($request->getContent())) {
|
if ($request->isJson() && !empty($request->getContent())) {
|
||||||
try {
|
try {
|
||||||
json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||||
} catch (JsonException $exception) {
|
} catch (\JsonException $exception) {
|
||||||
throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: ' . $exception->getMessage());
|
throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: ' . $exception->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ class LanguageMiddleware
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request and set the user's preferred language.
|
* Handle an incoming request and set the user's preferred language.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
$this->app->setLocale($request->user()->language ?? config('app.locale', 'en'));
|
$this->app->setLocale($request->user()->language ?? config('app.locale', 'en'));
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ class MaintenanceMiddleware
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\Server $server */
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
$server = $request->attributes->get('server');
|
$server = $request->attributes->get('server');
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Auth\AuthManager;
|
use Illuminate\Auth\AuthManager;
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ class RedirectIfAuthenticated
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, string $guard = null): mixed
|
public function handle(Request $request, \Closure $next, string $guard = null): mixed
|
||||||
{
|
{
|
||||||
if ($this->authManager->guard($guard)->check()) {
|
if ($this->authManager->guard($guard)->check()) {
|
||||||
return redirect()->route('index');
|
return redirect()->route('index');
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Prologue\Alerts\AlertsMessageBag;
|
use Prologue\Alerts\AlertsMessageBag;
|
||||||
|
@ -34,7 +33,7 @@ class RequireTwoFactorAuthentication
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException
|
* @throws \Pterodactyl\Exceptions\Http\TwoFactorAuthRequiredException
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\User $user */
|
/** @var \Pterodactyl\Models\User $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Middleware;
|
namespace Pterodactyl\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use stdClass;
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
@ -24,7 +22,7 @@ class VerifyReCaptcha
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): mixed
|
public function handle(Request $request, \Closure $next): mixed
|
||||||
{
|
{
|
||||||
if (!$this->config->get('recaptcha.enabled')) {
|
if (!$this->config->get('recaptcha.enabled')) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
@ -61,7 +59,7 @@ class VerifyReCaptcha
|
||||||
/**
|
/**
|
||||||
* Determine if the response from the recaptcha servers was valid.
|
* Determine if the response from the recaptcha servers was valid.
|
||||||
*/
|
*/
|
||||||
private function isResponseVerified(stdClass $result, Request $request): bool
|
private function isResponseVerified(\stdClass $result, Request $request): bool
|
||||||
{
|
{
|
||||||
if (!$this->config->get('recaptcha.verify_domain')) {
|
if (!$this->config->get('recaptcha.verify_domain')) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,7 +11,7 @@ class EggFormRequest extends AdminFormRequest
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'docker_images' => 'required|string',
|
'docker_images' => ['required', 'string', 'regex:/^[\w#\.\/\- ]*\|*[\w\.\/\-:@ ]*$/im'],
|
||||||
'force_outgoing_ip' => 'sometimes|boolean',
|
'force_outgoing_ip' => 'sometimes|boolean',
|
||||||
'file_denylist' => 'array',
|
'file_denylist' => 'array',
|
||||||
'startup' => 'required|string',
|
'startup' => 'required|string',
|
||||||
|
|
|
@ -9,7 +9,7 @@ class StoreNestFormRequest extends AdminFormRequest
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|min:1|max:191',
|
'name' => 'required|string|min:1|max:191|regex:/^[\w\- ]+$/',
|
||||||
'description' => 'string|nullable',
|
'description' => 'string|nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Pterodactyl\Models\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
class NewUserFormRequest extends AdminFormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Rules to apply to requests for updating or creating a user
|
||||||
|
* in the Admin CP.
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return Collection::make(
|
||||||
|
User::getRules()
|
||||||
|
)->only([
|
||||||
|
'email',
|
||||||
|
'username',
|
||||||
|
'name_first',
|
||||||
|
'name_last',
|
||||||
|
'password',
|
||||||
|
'language',
|
||||||
|
'root_admin',
|
||||||
|
])->toArray();
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,11 +13,11 @@ class MailSettingsFormRequest extends AdminFormRequest
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'mail:host' => 'required|string',
|
'mail:mailers:smtp:host' => 'required|string',
|
||||||
'mail:port' => 'required|integer|between:1,65535',
|
'mail:mailers:smtp:port' => 'required|integer|between:1,65535',
|
||||||
'mail:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
|
'mail:mailers:smtp:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
|
||||||
'mail:username' => 'nullable|string|max:191',
|
'mail:mailers:smtp:username' => 'nullable|string|max:191',
|
||||||
'mail:password' => 'nullable|string|max:191',
|
'mail:mailers:smtp:password' => 'nullable|string|max:191',
|
||||||
'mail:from:address' => 'required|string|email',
|
'mail:from:address' => 'required|string|email',
|
||||||
'mail:from:name' => 'nullable|string|max:191',
|
'mail:from:name' => 'nullable|string|max:191',
|
||||||
];
|
];
|
||||||
|
@ -31,8 +31,8 @@ class MailSettingsFormRequest extends AdminFormRequest
|
||||||
{
|
{
|
||||||
$keys = array_flip(array_keys($this->rules()));
|
$keys = array_flip(array_keys($this->rules()));
|
||||||
|
|
||||||
if (empty($this->input('mail:password'))) {
|
if (empty($this->input('mail:mailers:smtp:password'))) {
|
||||||
unset($keys['mail:password']);
|
unset($keys['mail:mailers:smtp:password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->only(array_flip($keys));
|
return $this->only(array_flip($keys));
|
||||||
|
|
|
@ -24,6 +24,7 @@ class StoreNodeRequest extends ApplicationApiRequest
|
||||||
'fqdn',
|
'fqdn',
|
||||||
'scheme',
|
'scheme',
|
||||||
'behind_proxy',
|
'behind_proxy',
|
||||||
|
'maintenance_mode',
|
||||||
'memory',
|
'memory',
|
||||||
'memory_overallocate',
|
'memory_overallocate',
|
||||||
'disk',
|
'disk',
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Requests\Api\Client\Account;
|
namespace Pterodactyl\Http\Requests\Api\Client\Account;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use phpseclib3\Crypt\DSA;
|
use phpseclib3\Crypt\DSA;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use Pterodactyl\Models\UserSSHKey;
|
use Pterodactyl\Models\UserSSHKey;
|
||||||
|
@ -71,7 +70,7 @@ class StoreSSHKeyRequest extends ClientApiRequest
|
||||||
public function getKeyFingerprint(): string
|
public function getKeyFingerprint(): string
|
||||||
{
|
{
|
||||||
if (!$this->key) {
|
if (!$this->key) {
|
||||||
throw new Exception('The public key was not properly loaded for this request.');
|
throw new \Exception('The public key was not properly loaded for this request.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->key->getFingerprint('sha256');
|
return $this->key->getFingerprint('sha256');
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Backups;
|
||||||
|
|
||||||
|
use Pterodactyl\Models\Permission;
|
||||||
|
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||||
|
|
||||||
|
class RestoreBackupRequest extends ClientApiRequest
|
||||||
|
{
|
||||||
|
public function permission(): string
|
||||||
|
{
|
||||||
|
return Permission::ACTION_BACKUP_RESTORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return ['truncate' => 'required|boolean'];
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ class StoreTaskRequest extends ViewScheduleRequest
|
||||||
'payload' => 'required_unless:action,backup|string|nullable',
|
'payload' => 'required_unless:action,backup|string|nullable',
|
||||||
'time_offset' => 'required|numeric|min:0|max:900',
|
'time_offset' => 'required|numeric|min:0|max:900',
|
||||||
'sequence_id' => 'sometimes|required|numeric|min:1',
|
'sequence_id' => 'sometimes|required|numeric|min:1',
|
||||||
|
'continue_on_failure' => 'sometimes|required|boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -26,6 +26,7 @@ class RenameServerRequest extends ClientApiRequest implements ClientPermissionsR
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => Server::getRules()['name'],
|
'name' => Server::getRules()['name'],
|
||||||
|
'description' => 'string|nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission
|
||||||
Assert::isInstanceOf($server, Server::class);
|
Assert::isInstanceOf($server, Server::class);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'docker_image' => ['required', 'string', Rule::in(array_values($server->egg->docker_images))],
|
'docker_image' => ['required', 'string', 'max:191', 'regex:/^[\w#\.\/\- ]*\|*[\w\.\/\-:@ ]*$/', Rule::in(array_values($server->egg->docker_images))],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@ class ActivityEventRequest extends FormRequest
|
||||||
return [
|
return [
|
||||||
'data' => ['required', 'array'],
|
'data' => ['required', 'array'],
|
||||||
'data.*' => ['array'],
|
'data.*' => ['array'],
|
||||||
'data.*.user' => ['present', 'uuid'],
|
'data.*.user' => ['sometimes', 'nullable', 'uuid'],
|
||||||
'data.*.server' => ['required', 'uuid'],
|
'data.*.server' => ['required', 'uuid'],
|
||||||
'data.*.event' => ['required', 'string'],
|
'data.*.event' => ['required', 'string'],
|
||||||
'data.*.metadata' => ['present', 'nullable', 'array'],
|
'data.*.metadata' => ['present', 'nullable', 'array'],
|
||||||
'data.*.ip' => ['present', 'ip'],
|
'data.*.ip' => ['sometimes', 'nullable', 'ip'],
|
||||||
'data.*.timestamp' => ['required', 'string'],
|
'data.*.timestamp' => ['required', 'string'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class InstallationDataRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'successful' => 'present|boolean',
|
'successful' => 'present|boolean',
|
||||||
|
'reinstall' => 'sometimes|boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Exception;
|
||||||
use Pterodactyl\Jobs\Job;
|
use Pterodactyl\Jobs\Job;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
use Pterodactyl\Models\Task;
|
use Pterodactyl\Models\Task;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
@ -72,9 +71,9 @@ class RunTaskJob extends Job implements ShouldQueue
|
||||||
$backupService->setIgnoredFiles(explode(PHP_EOL, $this->task->payload))->handle($server, null, true);
|
$backupService->setIgnoredFiles(explode(PHP_EOL, $this->task->payload))->handle($server, null, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidArgumentException('Invalid task action provided: ' . $this->task->action);
|
throw new \InvalidArgumentException('Invalid task action provided: ' . $this->task->action);
|
||||||
}
|
}
|
||||||
} catch (Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
// If this isn't a DaemonConnectionException on a task that allows for failures
|
// If this isn't a DaemonConnectionException on a task that allows for failures
|
||||||
// throw the exception back up the chain so that the task is stopped.
|
// throw the exception back up the chain so that the task is stopped.
|
||||||
if (!($this->task->continue_on_failure && $exception instanceof DaemonConnectionException)) {
|
if (!($this->task->continue_on_failure && $exception instanceof DaemonConnectionException)) {
|
||||||
|
@ -89,7 +88,7 @@ class RunTaskJob extends Job implements ShouldQueue
|
||||||
/**
|
/**
|
||||||
* Handle a failure while sending the action to the daemon or otherwise processing the job.
|
* Handle a failure while sending the action to the daemon or otherwise processing the job.
|
||||||
*/
|
*/
|
||||||
public function failed(Exception $exception = null)
|
public function failed(\Exception $exception = null)
|
||||||
{
|
{
|
||||||
$this->markTaskNotQueued();
|
$this->markTaskNotQueued();
|
||||||
$this->markScheduleComplete();
|
$this->markScheduleComplete();
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use LogicException;
|
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Pterodactyl\Events\ActivityLogged;
|
use Pterodactyl\Events\ActivityLogged;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
@ -124,7 +123,7 @@ class ActivityLog extends Model
|
||||||
public function prunable()
|
public function prunable()
|
||||||
{
|
{
|
||||||
if (is_null(config('activity.prune_days'))) {
|
if (is_null(config('activity.prune_days'))) {
|
||||||
throw new LogicException('Cannot prune activity logs: no "prune_days" configuration value is set.');
|
throw new \LogicException('Cannot prune activity logs: no "prune_days" configuration value is set.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return static::where('timestamp', '<=', Carbon::now()->subDays(config('activity.prune_days')));
|
return static::where('timestamp', '<=', Carbon::now()->subDays(config('activity.prune_days')));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue