More model updates.
This commit is contained in:
parent
3b3002b77a
commit
c70d31c08f
2 changed files with 7 additions and 13 deletions
|
@ -118,8 +118,7 @@ class SecurityController extends Controller
|
||||||
|
|
||||||
public function revoke(Request $request, $id)
|
public function revoke(Request $request, $id)
|
||||||
{
|
{
|
||||||
$session = Session::where('id', $id)->where('user_id', $request->user()->id)->firstOrFail();
|
Session::where('user_id', $request->user()->id)->findOrFail($id)->delete();
|
||||||
$session->delete();
|
|
||||||
|
|
||||||
return redirect()->route('account.security');
|
return redirect()->route('account.security');
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ use Carbon\Carbon;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\NotificationService;
|
|
||||||
|
|
||||||
class RemoteController extends Controller
|
class RemoteController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -42,7 +41,7 @@ class RemoteController extends Controller
|
||||||
|
|
||||||
public function postDownload(Request $request)
|
public function postDownload(Request $request)
|
||||||
{
|
{
|
||||||
$download = Models\Download::where('token', $request->input('token', '00'))->first();
|
$download = Models\Download::where('token', $request->input('token'))->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.',
|
||||||
|
@ -59,18 +58,17 @@ class RemoteController extends Controller
|
||||||
|
|
||||||
public function postInstall(Request $request)
|
public function postInstall(Request $request)
|
||||||
{
|
{
|
||||||
$server = Models\Server::where('uuid', $request->input('server'))->first();
|
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
|
||||||
if (! $server) {
|
if (! $server) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'No server by that ID was found on the system.',
|
'error' => 'No server by that ID was found on the system.',
|
||||||
], 422);
|
], 422);
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = Models\Node::findOrFail($server->node_id);
|
|
||||||
$hmac = $request->input('signed');
|
$hmac = $request->input('signed');
|
||||||
$status = $request->input('installed');
|
$status = $request->input('installed');
|
||||||
|
|
||||||
if (base64_decode($hmac) !== hash_hmac('sha256', $server->uuid, $node->daemonSecret, true)) {
|
if (base64_decode($hmac) !== hash_hmac('sha256', $server->uuid, $server->node->daemonSecret, true)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'Signed HMAC was invalid.',
|
'error' => 'Signed HMAC was invalid.',
|
||||||
], 403);
|
], 403);
|
||||||
|
@ -86,17 +84,15 @@ class RemoteController extends Controller
|
||||||
|
|
||||||
public function event(Request $request)
|
public function event(Request $request)
|
||||||
{
|
{
|
||||||
$server = Models\Server::where('uuid', $request->input('server'))->first();
|
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
|
||||||
if (! $server) {
|
if (! $server) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'No server by that ID was found on the system.',
|
'error' => 'No server by that ID was found on the system.',
|
||||||
], 422);
|
], 422);
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = Models\Node::findOrFail($server->node_id);
|
|
||||||
|
|
||||||
$hmac = $request->input('signed');
|
$hmac = $request->input('signed');
|
||||||
if (base64_decode($hmac) !== hash_hmac('sha256', $server->uuid, $node->daemonSecret, true)) {
|
if (base64_decode($hmac) !== hash_hmac('sha256', $server->uuid, $server->node->daemonSecret, true)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => 'Signed HMAC was invalid.',
|
'error' => 'Signed HMAC was invalid.',
|
||||||
], 403);
|
], 403);
|
||||||
|
@ -130,7 +126,6 @@ class RemoteController extends Controller
|
||||||
$token->delete();
|
$token->delete();
|
||||||
|
|
||||||
// Manually as getConfigurationAsJson() returns it in correct format already
|
// Manually as getConfigurationAsJson() returns it in correct format already
|
||||||
return response($node->getConfigurationAsJson(), 200)
|
return response()->json($node->getConfigurationAsJson(), 200);
|
||||||
->header('Content-Type', 'application/json');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue