mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-27 15:41:39 +01:00
Added site files
This commit is contained in:
61
conf/site/app/Http/Controllers/UpdateController.php
Normal file
61
conf/site/app/Http/Controllers/UpdateController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Updater;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateController extends Controller
|
||||
{
|
||||
public function checkForUpdate()
|
||||
{
|
||||
return response()->json([
|
||||
'method' => 'check for updates',
|
||||
'update' => Updater::check(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function downloadUpdate()
|
||||
{
|
||||
$dl = Updater::downloadLatest();
|
||||
|
||||
if($dl) {
|
||||
return response()->json([
|
||||
'method' => 'download latest version',
|
||||
'success' => true,
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'method' => 'download latest version',
|
||||
'success' => false,
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function extractUpdate()
|
||||
{
|
||||
$ex = Updater::extractFiles();
|
||||
|
||||
if($ex) {
|
||||
return response()->json([
|
||||
'method' => 'extract latest version',
|
||||
'success' => true,
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'method' => 'extract latest version',
|
||||
'success' => false,
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function moveUpdate()
|
||||
{
|
||||
$cp = Updater::updateFiles();
|
||||
|
||||
return response()->json([
|
||||
'method' => 'copy latest version',
|
||||
'success' => $cp,
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user