2017-09-26 02:43:01 +00:00
{{ -- Pterodactyl - Panel -- }}
2017-03-05 04:45:22 +00:00
{{ -- Copyright ( c ) 2015 - 2017 Dane Everitt < dane @ daneeveritt . com > -- }}
2017-09-26 02:43:01 +00:00
{{ -- This software is licensed under the terms of the MIT license . -- }}
{{ -- https :// opensource . org / licenses / MIT -- }}
2017-03-05 04:45:22 +00:00
@ extends ( 'layouts.admin' )
@ section ( 'title' )
Server — {{ $server -> name }} : Startup
@ endsection
@ section ( 'content-header' )
< h1 > {{ $server -> name }} < small > Control startup command as well as variables .</ small ></ h1 >
< ol class = " breadcrumb " >
< li >< a href = " { { route('admin.index') }} " > Admin </ a ></ li >
< li >< a href = " { { route('admin.servers') }} " > Servers </ a ></ li >
< li >< a href = " { { route('admin.servers.view', $server->id ) }} " > {{ $server -> name }} </ a ></ li >
< li class = " active " > Startup </ li >
</ ol >
@ endsection
@ section ( 'content' )
2019-12-17 05:14:27 +00:00
@ include ( 'admin.servers.partials.navigation' )
2017-03-05 04:45:22 +00:00
< form action = " { { route('admin.servers.view.startup', $server->id ) }} " method = " POST " >
< div class = " row " >
< div class = " col-xs-12 " >
< div class = " box box-primary " >
< div class = " box-header with-border " >
< h3 class = " box-title " > Startup Command Modification </ h3 >
</ div >
< div class = " box-body " >
< label for = " pStartup " class = " form-label " > Startup Command </ label >
2017-03-12 23:34:06 +00:00
< input id = " pStartup " name = " startup " class = " form-control " type = " text " value = " { { old('startup', $server->startup ) }} " />
2017-03-05 04:45:22 +00:00
< p class = " small text-muted " > Edit your server ' s startup command here . The following variables are available by default : < code >@ {{ SERVER_MEMORY }} </ code > , < code >@ {{ SERVER_IP }} </ code > , and < code >@ {{ SERVER_PORT }} </ code >.</ p >
</ div >
2017-04-21 21:52:44 +00:00
< div class = " box-body " >
< label for = " pDefaultStartupCommand " class = " form-label " > Default Service Start Command </ label >
< input id = " pDefaultStartupCommand " class = " form-control " type = " text " readonly />
</ div >
2017-03-05 04:45:22 +00:00
< div class = " box-footer " >
{ !! csrf_field () !! }
< button type = " submit " class = " btn btn-primary btn-sm pull-right " > Save Modifications </ button >
</ div >
</ div >
</ div >
2017-04-21 21:52:44 +00:00
</ div >
< div class = " row " >
< div class = " col-md-6 " >
< div class = " box " >
< div class = " box-header with-border " >
< h3 class = " box-title " > Service Configuration </ h3 >
</ div >
< div class = " box-body row " >
< div class = " col-xs-12 " >
< p class = " small text-danger " >
2018-05-13 14:34:09 +00:00
Changing any of the below values will result in the server processing a re - install command . The server will be stopped and will then proceed .
2020-09-13 18:13:37 +00:00
If you would like the service scripts to not run , ensure the box is checked at the bottom .
2017-04-21 21:52:44 +00:00
</ p >
< p class = " small text-danger " >
2018-05-13 14:34:09 +00:00
< strong > This is a destructive operation in many cases . This server will be stopped immediately in order for this action to proceed .</ strong >
2017-03-05 04:45:22 +00:00
</ p >
</ div >
2017-04-21 21:52:44 +00:00
< div class = " form-group col-xs-12 " >
2017-10-07 22:21:41 +00:00
< label for = " pNestId " > Nest </ label >
< select name = " nest_id " id = " pNestId " class = " form-control " >
@ foreach ( $nests as $nest )
< option value = " { { $nest->id }} "
@ if ( $nest -> id === $server -> nest_id )
2017-07-22 02:17:42 +00:00
selected
2017-04-21 21:52:44 +00:00
@ endif
2017-10-07 22:21:41 +00:00
> {{ $nest -> name }} </ option >
2017-04-21 21:52:44 +00:00
@ endforeach
</ select >
2017-10-07 22:21:41 +00:00
< p class = " small text-muted no-margin " > Select the Nest that this server will be grouped into .</ p >
2017-04-21 21:52:44 +00:00
</ div >
< div class = " form-group col-xs-12 " >
2017-10-07 22:21:41 +00:00
< label for = " pEggId " > Egg </ label >
< select name = " egg_id " id = " pEggId " class = " form-control " ></ select >
< p class = " small text-muted no-margin " > Select the Egg that will provide processing data for this server .</ p >
2017-04-21 21:52:44 +00:00
</ div >
< div class = " form-group col-xs-12 " >
< div class = " checkbox checkbox-primary no-margin-bottom " >
2019-01-18 05:02:09 +00:00
< input id = " pSkipScripting " name = " skip_scripts " type = " checkbox " value = " 1 " @ if ( $server -> skip_scripts ) checked @ endif />
2017-10-07 22:21:41 +00:00
< label for = " pSkipScripting " class = " strong " > Skip Egg Install Script </ label >
2017-04-21 21:52:44 +00:00
</ div >
2020-09-13 18:13:37 +00:00
< p class = " small text-muted no-margin " > If the selected Egg has an install script attached to it , the script will run during install . If you would like to skip this step , check this box .</ p >
2017-04-21 21:52:44 +00:00
</ div >
</ div >
</ div >
2017-11-11 21:07:01 +00:00
< div class = " box " >
< div class = " box-header with-border " >
2020-12-13 17:53:17 +00:00
< h3 class = " box-title " > Docker Image Configuration </ h3 >
2017-11-11 21:07:01 +00:00
</ div >
< div class = " box-body " >
< div class = " form-group " >
2020-12-13 17:53:17 +00:00
< label for = " pDockerImage " > Image </ label >
< select id = " pDockerImage " name = " docker_image " class = " form-control " ></ select >
< input id = " pDockerImageCustom " name = " custom_docker_image " value = " { { old('custom_docker_image') }} " class = " form-control " placeholder = " Or enter a custom image... " style = " margin-top:1rem " />
< p class = " small text-muted no-margin " > This is the Docker image that will be used to run this server . Select an image from the dropdown or enter a custom image in the text field above .</ p >
2017-11-11 21:07:01 +00:00
</ div >
</ div >
</ div >
2017-04-21 21:52:44 +00:00
</ div >
< div class = " col-md-6 " >
2017-07-22 02:17:42 +00:00
< div class = " row " id = " appendVariablesTo " ></ div >
2017-04-21 21:52:44 +00:00
</ div >
2017-03-05 04:45:22 +00:00
</ div >
</ form >
@ endsection
@ section ( 'footer-scripts' )
@ parent
2017-04-21 21:52:44 +00:00
{ !! Theme :: js ( 'vendor/lodash/lodash.js' ) !! }
2017-03-05 04:45:22 +00:00
< script >
2017-04-21 21:52:44 +00:00
$ ( document ) . ready ( function () {
2018-03-07 03:53:05 +00:00
$ ( '#pEggId' ) . select2 ({ placeholder : 'Select a Nest Egg' }) . on ( 'change' , function () {
var selectedEgg = _ . isNull ( $ ( this ) . val ()) ? $ ( this ) . find ( 'option' ) . first () . val () : $ ( this ) . val ();
var parentChain = _ . get ( Pterodactyl . nests , $ ( " #pNestId " ) . val ());
var objectChain = _ . get ( parentChain , 'eggs.' + selectedEgg );
2017-04-21 21:52:44 +00:00
2020-12-13 17:53:17 +00:00
const images = _ . get ( objectChain , 'docker_images' , [])
2020-12-25 23:43:44 +00:00
$ ( '#pDockerImage' ) . html ( '' );
2022-05-14 02:09:20 +00:00
const keys = Object . keys ( images );
for ( let i = 0 ; i < keys . length ; i ++ ) {
2020-12-13 17:53:17 +00:00
let opt = document . createElement ( 'option' );
2022-05-14 02:09:20 +00:00
opt . value = images [ keys [ i ]];
opt . innerHTML = keys [ i ] + " ( " + images [ keys [ i ]] + " ) " ;
2020-12-13 17:53:17 +00:00
if ( objectChain . id === parseInt ( Pterodactyl . server . egg_id ) && Pterodactyl . server . image == opt . value ) {
2022-05-14 02:09:20 +00:00
opt . selected = true
2020-12-13 17:53:17 +00:00
}
$ ( '#pDockerImage' ) . append ( opt );
}
$ ( '#pDockerImage' ) . on ( 'change' , function () {
$ ( '#pDockerImageCustom' ) . val ( '' );
})
2017-11-25 18:27:08 +00:00
if ( objectChain . id === parseInt ( Pterodactyl . server . egg_id )) {
2020-12-13 17:53:17 +00:00
if ( $ ( '#pDockerImage' ) . val () != Pterodactyl . server . image ) {
$ ( '#pDockerImageCustom' ) . val ( Pterodactyl . server . image );
}
2017-11-11 21:07:01 +00:00
}
2017-04-21 21:52:44 +00:00
if ( ! _ . get ( objectChain , 'startup' , false )) {
$ ( '#pDefaultStartupCommand' ) . val ( _ . get ( parentChain , 'startup' , 'ERROR: Startup Not Defined!' ));
} else {
$ ( '#pDefaultStartupCommand' ) . val ( _ . get ( objectChain , 'startup' ));
}
$ ( '#appendVariablesTo' ) . html ( '' );
$ . each ( _ . get ( objectChain , 'variables' , []), function ( i , item ) {
2017-07-22 02:17:42 +00:00
var setValue = _ . get ( Pterodactyl . server_variables , item . env_variable , item . default_value );
2017-04-21 21:52:44 +00:00
var isRequired = ( item . required === 1 ) ? '<span class="label label-danger">Required</span> ' : '' ;
var dataAppend = ' \
< div class = " col-xs-12 " > \
< div class = " box " > \
< div class = " box-header with-border " > \
< h3 class = " box-title " > ' + isRequired + item.name + ' </ h3 > \
</ div > \
< div class = " box-body " > \
2017-11-11 19:56:38 +00:00
< input name = " environment[' + item.env_variable + '] " class = " form-control " type = " text " id = " egg_variable_' + item.env_variable + ' " /> \
2017-04-21 21:52:44 +00:00
< p class = " no-margin small text-muted " > ' + item.description + ' </ p > \
</ div > \
< div class = " box-footer " > \
< p class = " no-margin text-muted small " >< strong > Startup Command Variable :</ strong > < code > ' + item.env_variable + ' </ code ></ p > \
< p class = " no-margin text-muted small " >< strong > Input Rules :</ strong > < code > ' + item.rules + ' </ code ></ p > \
</ div > \
</ div > \
</ div > ' ;
2018-03-07 03:53:05 +00:00
$ ( '#appendVariablesTo' ) . append ( dataAppend ) . find ( '#egg_variable_' + item . env_variable ) . val ( setValue );
2017-04-21 21:52:44 +00:00
});
});
2018-03-09 03:37:30 +00:00
$ ( '#pNestId' ) . select2 ({ placeholder : 'Select a Nest' }) . on ( 'change' , function () {
$ ( '#pEggId' ) . html ( '' ) . select2 ({
data : $ . map ( _ . get ( Pterodactyl . nests , $ ( this ) . val () + '.eggs' , []), function ( item ) {
return {
id : item . id ,
text : item . name ,
};
}),
});
if ( _ . isObject ( _ . get ( Pterodactyl . nests , $ ( this ) . val () + '.eggs.' + Pterodactyl . server . egg_id ))) {
$ ( '#pEggId' ) . val ( Pterodactyl . server . egg_id );
}
$ ( '#pEggId' ) . change ();
}) . change ();
2018-03-07 03:53:05 +00:00
});
2017-04-21 21:52:44 +00:00
</ script >
2017-03-05 04:45:22 +00:00
@ endsection