Merge branch 'develop' into feature/PTDL-472

This commit is contained in:
Dane Everitt 2017-06-25 15:36:39 -05:00
commit b7b046c044
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
24 changed files with 672 additions and 82 deletions

39
.dev/vagrant/.env.vagrant Normal file
View file

@ -0,0 +1,39 @@
APP_ENV=develop
APP_DEBUG=true
APP_KEY=SomeRandomString3232RandomString
APP_THEME=pterodactyl
APP_TIMEZONE=UTC
APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_URL=http://192.168.50.2/
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=panel
DB_USERNAME=pterodactyl
DB_PASSWORD=pterodactyl
CACHE_DRIVER=memcached
MEMCACHED_HOST=127.0.0.1
SESSION_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM=support@pterodactyl.io
API_PREFIX=api
API_VERSION=v1
API_DEBUG=true
QUEUE_DRIVER=database
QUEUE_HIGH=high
QUEUE_STANDARD=standard
QUEUE_LOW=low
SQS_KEY=aws-public
SQS_SECRET=aws-secret
SQS_QUEUE_PREFIX=aws-queue-prefix

View file

@ -0,0 +1,13 @@
[Unit]
Description=Mailhog
[Service]
# On some systems the user and group might be different.
# Some systems use `apache` as the user and group.
User=www-data
Group=www-data
Restart=on-failure
ExecStart=/usr/bin/mailhog
[Install]
WantedBy=multi-user.target

189
.dev/vagrant/mariadb.cnf Normal file
View file

@ -0,0 +1,189 @@
# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
max_connections = 100
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit = 128K
query_cache_size = 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit = 1000
log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog = 1
expire_logs_days = 10
max_binlog_size = 100M
# slaves
#relay_log = /var/log/mysql/relay-bin
#relay_log_index = /var/log/mysql/relay-bin.index
#relay_log_info_file = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

17
.dev/vagrant/motd.txt Normal file
View file

@ -0,0 +1,17 @@
#####################################################
Pterodactyl Panel Vagrant VM
Install: /var/www/html/pterodactyl
Ports:
Panel: 80 (50080 on host)
MailHog: 8025 (58025 on host)
MySQL: 3306 (53306 on host)
Default panel users:
user: admin passwd: Ptero123 (admin user)
user: user passwd: Ptero123 (standard user)
MySQL is accessible using root/pterodactyl or pterodactyl/pterodactyl
Services for pteroq and mailhog are running
#####################################################

84
.dev/vagrant/provision.sh Normal file
View file

@ -0,0 +1,84 @@
#!/bin/bash
echo "Provisioning development environment for Pterodactyl Panel."
cp /var/www/html/pterodactyl/.dev/vagrant/motd.txt /etc/motd
chmod -x /etc/update-motd.d/10-help-text /etc/update-motd.d/51-cloudguest
apt-get install -y software-properties-common > /dev/null
echo "Add the ondrej/php ppa repository"
add-apt-repository -y ppa:ondrej/php > /dev/null
echo "Add the mariadb repository"
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash > /dev/null
apt-get update > /dev/null
echo "Install the dependencies"
export DEBIAN_FRONTEND=noninteractive
# set the mariadb root password because mariadb asks for it
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password pterodactyl'
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password pterodactyl'
# actually install
apt-get install -y php7.1 php7.1-cli php7.1-gd php7.1-mysql php7.1-pdo php7.1-mbstring php7.1-tokenizer php7.1-bcmath php7.1-xml php7.1-fpm php7.1-memcached php7.1-curl php7.1-zip php-xdebug mariadb-server nginx curl tar unzip git memcached > /dev/null
echo "Install composer"
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
echo "Install and run mailhog"
curl -sL -o /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
chmod +x /usr/bin/mailhog
cp /var/www/html/pterodactyl/.dev/vagrant/mailhog.service /etc/systemd/system/
systemctl enable mailhog.service
systemctl start mailhog
echo "Configure xDebug"
cp /var/www/html/pterodactyl/.dev/vagrant/xdebug.ini /etc/php/7.1/mods-available/
systemctl restart php7.1-fpm
echo "Configure nginx"
cp /var/www/html/pterodactyl/.dev/vagrant/pterodactyl.conf /etc/nginx/sites-available/
rm /etc/nginx/sites-available/default
ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
systemctl restart nginx
echo "Setup database"
# Replace default config with custom one to bind mysql to 0.0.0.0 to make it accessible from the host
cp /var/www/html/pterodactyl/.dev/vagrant/mariadb.cnf /etc/mysql/my.cnf
systemctl restart mariadb
mysql -u root -ppterodactyl << SQL
CREATE DATABASE panel;
GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'%' IDENTIFIED BY 'pterodactyl' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'pterodactyl' WITH GRANT OPTION;
FLUSH PRIVILEGES;
SQL
echo "Setup pterodactyl queue worker service"
cp /var/www/html/pterodactyl/.dev/vagrant/pteroq.service /etc/systemd/system/
systemctl enable pteroq.service
echo "Setup panel with base settings"
cp /var/www/html/pterodactyl/.dev/vagrant/.env.vagrant /var/www/html/pterodactyl/.env
cd /var/www/html/pterodactyl
chmod -R 755 storage/* bootstrap/cache
composer install --no-progress
php artisan key:generate --force
php artisan migrate
php artisan db:seed
php artisan pterodactyl:user --firstname Test --lastname Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1
php artisan pterodactyl:user --firstname Test --lastname User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0
echo "Add queue cronjob and start queue worker"
(crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab -
systemctl start pteroq
echo " ----------------"
echo "Provisioning is completed."
echo "The panel should be available at http://localhost:50080/"
echo "You may use the default admin user to login: admin/Ptero123"
echo "A normal user has also been created: user/Ptero123"
echo "MailHog is available at http://localhost:58025/"
echo "Connect to the database using root/pterodactyl or pterodactyl/pterodactyl on localhost:53306"
echo "If you want to access the panel using http://pterodactyl.app you can use the vagrant-dns plugin"
echo "Install it with 'vagrant plugin install vagrant-dns', then run 'vagrant dns --install' once"
echo "On first use you'll have to manually start vagrant-dns with 'vagrant dns --start'"

View file

@ -0,0 +1,51 @@
# If using Ubuntu this file should be placed in:
# /etc/nginx/sites-available/
#
# If using CentOS this file should be placed in:
# /etc/nginx/conf.d/
#
server {
listen 80;
server_name 0.0.0.0;
root /var/www/html/pterodactyl/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;
client_body_timeout 120s;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# the fastcgi_pass path needs to be changed accordingly when using CentOS
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY "";
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
}

View file

@ -0,0 +1,20 @@
# Pterodactyl Queue Worker File
# ----------------------------------
# File should be placed in:
# /etc/systemd/system
#
# nano /etc/systemd/system/pteroq.service
[Unit]
Description=Pterodactyl Queue Worker
[Service]
# On some systems the user and group might be different.
# Some systems use `apache` as the user and group.
User=www-data
Group=www-data
Restart=on-failure
ExecStart=/usr/bin/php /var/www/html/pterodactyl/artisan queue:work database --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target

10
.dev/vagrant/xdebug.ini Normal file
View file

@ -0,0 +1,10 @@
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.scream=0
xdebug.show_local_vars=1
xdebug.idekey=PHPSTORM
xdebug.remote_log=/tmp/xdebug.log

View file

@ -3,6 +3,32 @@ 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.
## v0.6.2 (Courageous Carniadactylus)
### Fixed
* Fixes a few typos throughout the panel, there are more don't worry.
* Fixes bug when disabling 2FA due to a misnamed route.
* API now returns a 404 error when deleting a user that doesn't exist, rather than saying it was successful.
* Service variables that allow empty input now allow you to empty out the assigned value and set it back to blank.
* Fixes a bug where changing the default allocation for a server would not actually apply that allocation as the default on the daemon.
* Newly created service variables are now backfilled and assigned to existing servers properly.
### Added
* Added a `Vagrantfile` to the repository to help speed up development and testing for those who don't want to do a full dedicated install.
* Added a confirmation dialog to the logout button for admins to prevent misguided clickers from accidentally logging out when they wanted to switch to Admin or Server views.
### Changed
* Blocked out the `Reinstall` button for servers that have failed installation to avoid confusion and bugs causing the daemon to break.
* Updated dependencies, listed below.
```
aws/aws-sdk-php (3.26.5 => 3.29.7)
laravel/framework (v5.4.21 => v5.4.27)
barryvdh/laravel-debugbar (v2.3.2 => v2.4.0)
fideloper/proxy (3.3.0 => 3.3.3)
igaster/laravel-theme (v1.14 => v1.16)
laravel/tinker (v1.0.0 => v1.0.1)
spatie/laravel-fractal (4.0.0 => 4.0.1)
```
## v0.6.1 (Courageous Carniadactylus) ## v0.6.1 (Courageous Carniadactylus)
### Fixed ### Fixed
* Fixes a bug preventing the use of services that have no variables attached to them. * Fixes a bug preventing the use of services that have no variables attached to them.

74
CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at support@pterodactyl.io. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

21
Vagrantfile vendored Normal file
View file

@ -0,0 +1,21 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.synced_folder "./", "/var/www/html/pterodactyl",
owner: "www-data", group: "www-data"
#config.vm.provision :file, source: ".dev/vagrant/pterdactyl.conf", destination: "/etc/nginx/sites-available/pterodactyl.conf"
#config.vm.provision :file, source: ".dev/vagrant/pteroq.service", destination: "/etc/systemd/system/pteroq.service"
#config.vm.provision :file, source: ".dev/vagrant/mailhog.service", destination: "/etc/systemd/system/mailhog.service"
#config.vm.provision :file, source: ".dev/vagrant/.env", destination: "/var/www/html/pterodactyl/.env"
config.vm.provision :shell, path: ".dev/vagrant/provision.sh"
config.vm.network :private_network, ip: "192.168.50.2"
config.vm.network :forwarded_port, guest: 80, host: 50080
config.vm.network :forwarded_port, guest: 8025, host: 58025
config.vm.network :forwarded_port, guest: 3306, host: 53306
# Config for the vagrant-dns plugin (https://github.com/BerlinVagrant/vagrant-dns)
config.dns.tld = "app"
config.dns.patterns = [/^pterodactyl.app$/]
end

View file

@ -242,10 +242,11 @@ class ServerController extends Controller
public function getStartup(Request $request, $uuid) public function getStartup(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$server->load(['node', 'allocation', 'variables.variable']);
$this->authorize('view-startup', $server); $this->authorize('view-startup', $server);
$server->load(['node', 'allocation', 'variables']);
$variables = Models\ServiceVariable::where('option_id', $server->option_id)->get();
$replacements = [ $replacements = [
'{{SERVER_MEMORY}}' => $server->memory, '{{SERVER_MEMORY}}' => $server->memory,
'{{SERVER_IP}}' => $server->allocation->ip, '{{SERVER_IP}}' => $server->allocation->ip,
@ -253,9 +254,16 @@ class ServerController extends Controller
]; ];
$processed = str_replace(array_keys($replacements), array_values($replacements), $server->startup); $processed = str_replace(array_keys($replacements), array_values($replacements), $server->startup);
foreach ($server->variables as $v) {
$replace = ($v->user_can_view) ? $v->variable_value : '[hidden]'; foreach ($variables as $var) {
$processed = str_replace('{{' . $v->variable->env_variable . '}}', $replace, $processed); if ($var->user_viewable) {
$serverVar = $server->variables->where('variable_id', $var->id)->first();
$var->server_set_value = $serverVar->variable_value ?? $var->default_value;
} else {
$var->server_set_value = '[hidden]';
}
$processed = str_replace('{{' . $var->env_variable . '}}', $var->server_set_value, $processed);
} }
$server->js(); $server->js();
@ -263,7 +271,7 @@ class ServerController extends Controller
return view('server.settings.startup', [ return view('server.settings.startup', [
'server' => $server, 'server' => $server,
'node' => $server->node, 'node' => $server->node,
'variables' => $server->variables->where('user_can_view', true), 'variables' => $variables->where('user_viewable', 1),
'service' => $server->service, 'service' => $server->service,
'processedStartup' => $processed, 'processedStartup' => $processed,
]); ]);

View file

@ -123,12 +123,11 @@ class VariableRepository
$variable = ServiceVariable::findOrFail($id); $variable = ServiceVariable::findOrFail($id);
$validator = Validator::make($data, [ $validator = Validator::make($data, [
'name' => 'sometimes|required|string|min:1|max:255', 'name' => 'required|string|min:1|max:255',
'description' => 'sometimes|nullable|string', 'description' => 'nullable|string',
'env_variable' => 'sometimes|required|regex:/^[\w]{1,255}$/', 'env_variable' => 'required|regex:/^[\w]{1,255}$/',
'default_value' => 'string', 'rules' => 'bail|required|string',
'options' => 'sometimes|required|array', 'options' => 'sometimes|required|array',
'rules' => 'bail|sometimes|required|string|min:1',
]); ]);
// Ensure the default value is allowed by the rules provided. // Ensure the default value is allowed by the rules provided.

View file

@ -535,7 +535,7 @@ class old_ServerRepository
} }
$newPorts = true; $newPorts = true;
$firstNewAllocation = (is_null($firstNewAllocation)) ? $model->id : $firstNewAllocation; $firstNewAllocation = $firstNewAllocation ?? $model;
$model->update([ $model->update([
'server_id' => $server->id, 'server_id' => $server->id,
]); ]);
@ -555,7 +555,8 @@ class old_ServerRepository
} }
// New Allocation, set as the default. // New Allocation, set as the default.
$server->allocation_id = $firstNewAllocation; $server->allocation_id = $firstNewAllocation->id;
$newBuild['default'] = ['ip' => $firstNewAllocation->ip, 'port' => $firstNewAllocation->port];
} }
$newPorts = true; $newPorts = true;

View file

@ -151,6 +151,8 @@ class old_UserRepository
*/ */
public function delete($id) public function delete($id)
{ {
$user = Models\User::findOrFail($id);
if (Models\Server::where('owner_id', $id)->count() > 0) { if (Models\Server::where('owner_id', $id)->count() > 0) {
throw new DisplayException('Cannot delete a user with active servers attached to thier account.'); throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
} }
@ -170,7 +172,7 @@ class old_UserRepository
$subuser->delete(); $subuser->delete();
} }
Models\User::destroy($id); $user->delete();
DB::commit(); DB::commit();
} catch (\Exception $ex) { } catch (\Exception $ex) {
DB::rollBack(); DB::rollBack();

View file

@ -12,20 +12,20 @@
], ],
"require": { "require": {
"php": ">=7.0.0", "php": ">=7.0.0",
"ext-mbstring": "*", "aws/aws-sdk-php": "3.29.7",
"ext-pdo_mysql": "*", "barryvdh/laravel-debugbar": "2.4.0",
"ext-zip": "*",
"aws/aws-sdk-php": "3.26.5",
"barryvdh/laravel-debugbar": "2.3.2",
"daneeveritt/login-notifications": "1.0.0", "daneeveritt/login-notifications": "1.0.0",
"doctrine/dbal": "2.5.12", "doctrine/dbal": "2.5.12",
"edvinaskrucas/settings": "2.0.0", "edvinaskrucas/settings": "2.0.0",
"fideloper/proxy": "3.3.0", "ext-mbstring": "*",
"ext-zip": "*",
"ext-pdo_mysql": "*",
"fideloper/proxy": "3.3.3",
"guzzlehttp/guzzle": "6.2.3", "guzzlehttp/guzzle": "6.2.3",
"igaster/laravel-theme": "1.14.0", "igaster/laravel-theme": "1.16.0",
"laracasts/utilities": "2.1.0", "laracasts/utilities": "2.1.0",
"laravel/framework": "5.4.21", "laravel/framework": "5.4.27",
"laravel/tinker": "1.0.0", "laravel/tinker": "1.0.1",
"lord/laroute": "2.4.4", "lord/laroute": "2.4.4",
"mtdowling/cron-expression": "1.2.0", "mtdowling/cron-expression": "1.2.0",
"nesbot/carbon": "1.22.1", "nesbot/carbon": "1.22.1",
@ -35,7 +35,7 @@
"prologue/alerts": "0.4.1", "prologue/alerts": "0.4.1",
"s1lentium/iptools": "1.1.0", "s1lentium/iptools": "1.1.0",
"sofa/eloquence": "5.4.1", "sofa/eloquence": "5.4.1",
"spatie/laravel-fractal": "4.0.0", "spatie/laravel-fractal": "4.0.1",
"watson/validating": "3.0.1", "watson/validating": "3.0.1",
"webpatser/laravel-uuid": "2.0.1" "webpatser/laravel-uuid": "2.0.1"
}, },

96
composer.lock generated
View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5d246e0c5756d5c2d4410c1011db5a14", "content-hash": "d3edf73b6618705ee34a76fa0319f0de",
"packages": [ "packages": [
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.26.5", "version": "3.29.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "5fd52d91aa168134f13a57df7fbf7d1f7b7a85ca" "reference": "76540001ff938c072db5367a7c945296984b999b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5fd52d91aa168134f13a57df7fbf7d1f7b7a85ca", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/76540001ff938c072db5367a7c945296984b999b",
"reference": "5fd52d91aa168134f13a57df7fbf7d1f7b7a85ca", "reference": "76540001ff938c072db5367a7c945296984b999b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -84,24 +84,24 @@
"s3", "s3",
"sdk" "sdk"
], ],
"time": "2017-04-28T23:15:22+00:00" "time": "2017-06-16T17:29:33+00:00"
}, },
{ {
"name": "barryvdh/laravel-debugbar", "name": "barryvdh/laravel-debugbar",
"version": "v2.3.2", "version": "v2.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git", "url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "24e4f0261e352d3fd86d0447791b56ae49398674" "reference": "de15d00a74696db62e1b4782474c27ed0c4fc763"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/24e4f0261e352d3fd86d0447791b56ae49398674", "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/de15d00a74696db62e1b4782474c27ed0c4fc763",
"reference": "24e4f0261e352d3fd86d0447791b56ae49398674", "reference": "de15d00a74696db62e1b4782474c27ed0c4fc763",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*", "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*",
"maximebf/debugbar": "~1.13.0", "maximebf/debugbar": "~1.13.0",
"php": ">=5.5.9", "php": ">=5.5.9",
"symfony/finder": "~2.7|~3.0" "symfony/finder": "~2.7|~3.0"
@ -109,7 +109,15 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.3-dev" "dev-master": "2.4-dev"
},
"laravel": {
"providers": [
"Barryvdh\\Debugbar\\ServiceProvider"
],
"aliases": {
"Debugbar": "Barryvdh\\Debugbar\\Facade"
}
} }
}, },
"autoload": { "autoload": {
@ -138,7 +146,7 @@
"profiler", "profiler",
"webprofiler" "webprofiler"
], ],
"time": "2017-01-19T08:19:49+00:00" "time": "2017-06-01T17:46:08+00:00"
}, },
{ {
"name": "christian-riesen/base32", "name": "christian-riesen/base32",
@ -837,16 +845,16 @@
}, },
{ {
"name": "fideloper/proxy", "name": "fideloper/proxy",
"version": "3.3.0", "version": "3.3.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/fideloper/TrustedProxy.git", "url": "https://github.com/fideloper/TrustedProxy.git",
"reference": "4ac60dbd4bcd6636bf231ea0fd87c40ece4bdce0" "reference": "985eac8f966c03b4d9503cad9b5e5a51d41ce477"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/4ac60dbd4bcd6636bf231ea0fd87c40ece4bdce0", "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/985eac8f966c03b4d9503cad9b5e5a51d41ce477",
"reference": "4ac60dbd4bcd6636bf231ea0fd87c40ece4bdce0", "reference": "985eac8f966c03b4d9503cad9b5e5a51d41ce477",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -855,7 +863,8 @@
}, },
"require-dev": { "require-dev": {
"illuminate/http": "~5.0", "illuminate/http": "~5.0",
"mockery/mockery": "~0.9.3" "mockery/mockery": "~0.9.3",
"phpunit/phpunit": "^5.7"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -884,7 +893,7 @@
"proxy", "proxy",
"trusted proxy" "trusted proxy"
], ],
"time": "2017-03-23T23:17:29+00:00" "time": "2017-05-31T12:50:41+00:00"
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
@ -1066,16 +1075,16 @@
}, },
{ {
"name": "igaster/laravel-theme", "name": "igaster/laravel-theme",
"version": "v1.14", "version": "v1.16",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/igaster/laravel-theme.git", "url": "https://github.com/igaster/laravel-theme.git",
"reference": "2f15e330c6fb3fec3a8ebbe424f4f22933ce3afb" "reference": "7816c4497feb326d11447737e8477779a713fc96"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/igaster/laravel-theme/zipball/2f15e330c6fb3fec3a8ebbe424f4f22933ce3afb", "url": "https://api.github.com/repos/igaster/laravel-theme/zipball/7816c4497feb326d11447737e8477779a713fc96",
"reference": "2f15e330c6fb3fec3a8ebbe424f4f22933ce3afb", "reference": "7816c4497feb326d11447737e8477779a713fc96",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1118,7 +1127,7 @@
"themes", "themes",
"views" "views"
], ],
"time": "2017-03-30T11:50:54+00:00" "time": "2017-06-07T15:24:25+00:00"
}, },
{ {
"name": "jakub-onderka/php-console-color", "name": "jakub-onderka/php-console-color",
@ -1253,16 +1262,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v5.4.21", "version": "v5.4.27",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "2ed668f96d1a6ca42f50d5c87ee9ceecfc0a6eee" "reference": "66f5e1b37cbd66e730ea18850ded6dc0ad570404"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/2ed668f96d1a6ca42f50d5c87ee9ceecfc0a6eee", "url": "https://api.github.com/repos/laravel/framework/zipball/66f5e1b37cbd66e730ea18850ded6dc0ad570404",
"reference": "2ed668f96d1a6ca42f50d5c87ee9ceecfc0a6eee", "reference": "66f5e1b37cbd66e730ea18850ded6dc0ad570404",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1378,20 +1387,20 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2017-04-28T15:40:01+00:00" "time": "2017-06-15T19:08:25+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
"version": "v1.0.0", "version": "v1.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/tinker.git", "url": "https://github.com/laravel/tinker.git",
"reference": "3d5b675b55b24ccbf86395964042dbe061d5a965" "reference": "7eb2e281395131897407285672ef5532e87e17f9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/3d5b675b55b24ccbf86395964042dbe061d5a965", "url": "https://api.github.com/repos/laravel/tinker/zipball/7eb2e281395131897407285672ef5532e87e17f9",
"reference": "3d5b675b55b24ccbf86395964042dbe061d5a965", "reference": "7eb2e281395131897407285672ef5532e87e17f9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1412,6 +1421,11 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Laravel\\Tinker\\TinkerServiceProvider"
]
} }
}, },
"autoload": { "autoload": {
@ -1436,7 +1450,7 @@
"laravel", "laravel",
"psysh" "psysh"
], ],
"time": "2016-12-30T18:13:17+00:00" "time": "2017-06-01T16:31:26+00:00"
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
@ -2690,16 +2704,16 @@
}, },
{ {
"name": "spatie/laravel-fractal", "name": "spatie/laravel-fractal",
"version": "4.0.0", "version": "4.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/spatie/laravel-fractal.git", "url": "https://github.com/spatie/laravel-fractal.git",
"reference": "7ddbb8131f20dd101a1699f3e622954fd73a97e1" "reference": "3b95780f5f3ca79e29d445a5df87eac9f7c7c053"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/7ddbb8131f20dd101a1699f3e622954fd73a97e1", "url": "https://api.github.com/repos/spatie/laravel-fractal/zipball/3b95780f5f3ca79e29d445a5df87eac9f7c7c053",
"reference": "7ddbb8131f20dd101a1699f3e622954fd73a97e1", "reference": "3b95780f5f3ca79e29d445a5df87eac9f7c7c053",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2744,7 +2758,7 @@
"spatie", "spatie",
"transform" "transform"
], ],
"time": "2017-04-26T15:13:38+00:00" "time": "2017-05-05T19:01:43+00:00"
}, },
{ {
"name": "swiftmailer/swiftmailer", "name": "swiftmailer/swiftmailer",
@ -5898,8 +5912,8 @@
"platform": { "platform": {
"php": ">=7.0.0", "php": ">=7.0.0",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-pdo_mysql": "*", "ext-zip": "*",
"ext-zip": "*" "ext-pdo_mysql": "*"
}, },
"platform-dev": [] "platform-dev": []
} }

File diff suppressed because one or more lines are too long

View file

@ -15,7 +15,7 @@ return [
], ],
'installing' => [ 'installing' => [
'header' => 'Server Installing', 'header' => 'Server Installing',
'desc' => 'The requested server is still completing the install process. Please check back in a few minutes, you should recieve an email as soon as this process is completed.', 'desc' => 'The requested server is still completing the install process. Please check back in a few minutes, you should receive an email as soon as this process is completed.',
], ],
'suspended' => [ 'suspended' => [
'header' => 'Server Suspended', 'header' => 'Server Suspended',

View file

@ -62,13 +62,13 @@
<p>This will reinstall the server with the assigned pack and service scripts. <strong>Danger!</strong> This could overwrite server data.</p> <p>This will reinstall the server with the assigned pack and service scripts. <strong>Danger!</strong> This could overwrite server data.</p>
</div> </div>
<div class="box-footer"> <div class="box-footer">
@if($server->installed) @if($server->installed === 1)
<form action="{{ route('admin.servers.view.manage.reinstall', $server->id) }}" method="POST"> <form action="{{ route('admin.servers.view.manage.reinstall', $server->id) }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<button type="submit" class="btn btn-danger">Reinstall Server</button> <button type="submit" class="btn btn-danger">Reinstall Server</button>
</form> </form>
@else @else
<button class="btn btn-danger disabled">Reinstall Server</button> <button class="btn btn-danger disabled">Server Must Install Properly to Reinstall</button>
@endif @endif
</div> </div>
</div> </div>

View file

@ -79,7 +79,7 @@
<li><a href="{{ route('index') }}" data-toggle="tooltip" data-placement="bottom" title="Exit Admin Control"><i class="fa fa-server"></i></a></li> <li><a href="{{ route('index') }}" data-toggle="tooltip" data-placement="bottom" title="Exit Admin Control"><i class="fa fa-server"></i></a></li>
</li> </li>
<li> <li>
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="Logout"><i class="fa fa-power-off"></i></a></li> <li><a href="{{ route('auth.logout') }}" id="logoutButton" data-toggle="tooltip" data-placement="bottom" title="Logout"><i class="fa fa-power-off"></i></a></li>
</li> </li>
</ul> </ul>
</div> </div>
@ -191,6 +191,17 @@
{!! Theme::js('vendor/select2/select2.full.min.js') !!} {!! Theme::js('vendor/select2/select2.full.min.js') !!}
{!! Theme::js('js/admin/functions.js') !!} {!! Theme::js('js/admin/functions.js') !!}
{!! Theme::js('js/autocomplete.js') !!} {!! Theme::js('js/autocomplete.js') !!}
@if(Auth::user()->isRootAdmin())
<script>
$('#logoutButton').on('click', function (event) {
event.preventDefault();
if (confirm('Are you sure you want to logout?')) {
window.location = $(this).attr('href');
}
});
</script>
@endif
@show @show
</body> </body>
</html> </html>

View file

@ -83,7 +83,7 @@
</li> </li>
@endif @endif
<li> <li>
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off"></i></a></li> <li><a href="{{ route('auth.logout') }}" id="logoutButton" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off"></i></a></li>
</li> </li>
</ul> </ul>
</div> </div>
@ -283,6 +283,17 @@
@if(config('pterodactyl.lang.in_context')) @if(config('pterodactyl.lang.in_context'))
{!! Theme::js('vendor/phraseapp/phraseapp.js') !!} {!! Theme::js('vendor/phraseapp/phraseapp.js') !!}
@endif @endif
@if(Auth::user()->isRootAdmin())
<script>
$('#logoutButton').on('click', function (event) {
event.preventDefault();
if (confirm('Are you sure you want to logout?')) {
window.location = $(this).attr('href');
}
});
</script>
@endif
@show @show
</body> </body>
</html> </html>

View file

@ -59,31 +59,31 @@
<div class="col-xs-12 col-md-4 col-sm-6"> <div class="col-xs-12 col-md-4 col-sm-6">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ $v->variable->name }}</h3> <h3 class="box-title">{{ $v->name }}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<input <input
@if($v->user_can_edit) @if($v->user_editable)
name="env_{{ $v->variable->id }}" name="env_{{ $v->id }}"
@else @else
readonly readonly
@endif @endif
class="form-control" type="text" value="{{ old('env_' . $v->id, $v->variable_value) }}" /> class="form-control" type="text" value="{{ old('env_' . $v->id, $v->server_set_value) }}" />
<p class="small text-muted">{{ $v->variable->description }}</p> <p class="small text-muted">{{ $v->description }}</p>
<p class="no-margin"> <p class="no-margin">
@if($v->required && $v->user_can_edit) @if($v->required && $v->user_editable )
<span class="label label-danger">@lang('strings.required')</span> <span class="label label-danger">@lang('strings.required')</span>
@elseif(! $v->required && $v->user_can_edit) @elseif(! $v->required && $v->user_editable)
<span class="label label-default">@lang('strings.optional')</span> <span class="label label-default">@lang('strings.optional')</span>
@endif @endif
@if(! $v->user_can_edit) @if(! $v->user_editable)
<span class="label label-warning">@lang('strings.read_only')</span> <span class="label label-warning">@lang('strings.read_only')</span>
@endif @endif
</p> </p>
</div> </div>
<div class="box-footer"> <div class="box-footer">
<p class="no-margin text-muted small"><strong>@lang('server.config.startup.startup_var'):</strong> <code>{{ $v->variable->env_variable }}</code></p> <p class="no-margin text-muted small"><strong>@lang('server.config.startup.startup_var'):</strong> <code>{{ $v->env_variable }}</code></p>
<p class="no-margin text-muted small"><strong>@lang('server.config.startup.startup_regex'):</strong> <code>{{ $v->variable->rules }}</code></p> <p class="no-margin text-muted small"><strong>@lang('server.config.startup.startup_regex'):</strong> <code>{{ $v->rules }}</code></p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -75,5 +75,5 @@ Route::group(['prefix' => 'account/security'], function () {
Route::post('/totp', 'SecurityController@setTotp'); Route::post('/totp', 'SecurityController@setTotp');
Route::delete('/api/security/totp', 'SecurityController@disableTotp'); Route::delete('/totp', 'SecurityController@disableTotp');
}); });