1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-10-27 20:32:28 +01:00

Update to match new installer processing.

This commit is contained in:
Dane Everitt 2016-01-22 20:31:47 -05:00
parent 4719b20a27
commit be47565c78
4 changed files with 45 additions and 3 deletions

View File

@ -23,7 +23,7 @@
*/
namespace Pterodactyl\Http\Controllers\Remote;
use Pterodactyl\Models\Download;
use Pterodactyl\Models;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller;
@ -41,7 +41,7 @@ class RemoteController extends Controller
}
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) {
return response()->json([
'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);
}
}

View File

@ -35,6 +35,11 @@ class RemoteRoutes {
'as' => 'remote.download',
'uses' => 'Remote\RemoteController@postDownload'
]);
$router->post('install', [
'as' => 'remote.install',
'uses' => 'Remote\RemoteController@postInstall'
]);
});
}

View File

@ -289,7 +289,8 @@
"count": 3
},
"remote": {
"download": "{{ url('/remote/download') }}"
"download": "{{ route('remote.download') }}",
"installed": "{{ route('remote.install') }}"
},
"uploads": {
"maximumSize": 1000000

View File

@ -32,6 +32,15 @@
<li><a href="/admin/servers">Servers</a></li>
<li class="active">{{ $server->name }} ({{ $server->uuidShort}})</li>
</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">
<li class="active"><a href="#tab_about" data-toggle="tab">About</a></li>
<li><a href="#tab_details" data-toggle="tab">Details</a></li>