Update to match new installer processing.
This commit is contained in:
parent
4719b20a27
commit
be47565c78
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
namespace Pterodactyl\Http\Controllers\Remote;
|
namespace Pterodactyl\Http\Controllers\Remote;
|
||||||
|
|
||||||
use Pterodactyl\Models\Download;
|
use Pterodactyl\Models;
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
|
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
|
@ -41,7 +41,7 @@ class RemoteController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postDownload(Request $request) {
|
public function postDownload(Request $request) {
|
||||||
$download = Download::where('token', $request->input('token', '00'))->first();
|
$download = Models\Download::where('token', $request->input('token', '00'))->first();
|
||||||
if (!$download) {
|
if (!$download) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'An invalid request token was recieved with this request.'
|
'error' => 'An invalid request token was recieved with this request.'
|
||||||
|
@ -55,4 +55,31 @@ class RemoteController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function postInstall(Request $request)
|
||||||
|
{
|
||||||
|
$server = Models\Server::where('uuid', $request->input('server'))->first();
|
||||||
|
if (!$server) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => 'No server by that ID was found on the system.'
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$node = Models\Node::findOrFail($server->node);
|
||||||
|
$hmac = $request->input('signed');
|
||||||
|
$status = $request->input('installed');
|
||||||
|
|
||||||
|
if (base64_decode($hmac) !== hash_hmac('sha256', $server->uuid, $node->daemonSecret, true)) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => 'Signed HMAC was invalid.'
|
||||||
|
], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$server->installed = ($status === 'installed') ? 1 : 2;
|
||||||
|
$server->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Recieved!'
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,11 @@ class RemoteRoutes {
|
||||||
'as' => 'remote.download',
|
'as' => 'remote.download',
|
||||||
'uses' => 'Remote\RemoteController@postDownload'
|
'uses' => 'Remote\RemoteController@postDownload'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$router->post('install', [
|
||||||
|
'as' => 'remote.install',
|
||||||
|
'uses' => 'Remote\RemoteController@postInstall'
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,8 @@
|
||||||
"count": 3
|
"count": 3
|
||||||
},
|
},
|
||||||
"remote": {
|
"remote": {
|
||||||
"download": "{{ url('/remote/download') }}"
|
"download": "{{ route('remote.download') }}",
|
||||||
|
"installed": "{{ route('remote.install') }}"
|
||||||
},
|
},
|
||||||
"uploads": {
|
"uploads": {
|
||||||
"maximumSize": 1000000
|
"maximumSize": 1000000
|
||||||
|
|
|
@ -32,6 +32,15 @@
|
||||||
<li><a href="/admin/servers">Servers</a></li>
|
<li><a href="/admin/servers">Servers</a></li>
|
||||||
<li class="active">{{ $server->name }} ({{ $server->uuidShort}})</li>
|
<li class="active">{{ $server->name }} ({{ $server->uuidShort}})</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@if($server->installed === 0)
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
This server is still running through the install process and is not avaliable for use just yet. This message will disappear once this process is completed.
|
||||||
|
</div>
|
||||||
|
@elseif($server->installed === 2)
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
This server <strong>failed</strong> to install properly. You should delete it and try to create it again or check the daemon logs.
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
<ul class="nav nav-tabs tabs_with_panel" id="config_tabs">
|
<ul class="nav nav-tabs tabs_with_panel" id="config_tabs">
|
||||||
<li class="active"><a href="#tab_about" data-toggle="tab">About</a></li>
|
<li class="active"><a href="#tab_about" data-toggle="tab">About</a></li>
|
||||||
<li><a href="#tab_details" data-toggle="tab">Details</a></li>
|
<li><a href="#tab_details" data-toggle="tab">Details</a></li>
|
||||||
|
|
Loading…
Reference in New Issue