Migracia a male opravy

- csrf ocharana, vypnutie pre /log
- oprava loggovania pamate
- pridanie vue skriptov
This commit is contained in:
Jaroslav Drzik
2020-03-26 07:52:02 +01:00
parent 575b55bdc2
commit a4b7483048
50 changed files with 23176 additions and 4 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers;
use App\User;
use Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
class DataController extends Controller
{
/**
* Show the profile for the given user.
*
* @param int $computer_id
*/
public function get($id=null)
{
$where = [];
$computer_id = Request::input('computer_id');
$from = Request::input('from');
$to = Request::input('to');
$where[] = ["computer_id", '=', $computer_id];
if ($from) $where[] = ["created_at", '>=', $from];
if ($to) $where[] = ["created_at", '<=', $to];
$queries = DB::table('values')->where($where)->get();
return response()->json($queries);
}
}

View File

@@ -8,7 +8,7 @@ use Illuminate\Support\Facades\DB;
class Logging extends Controller
{
public static $_items = [ 'netstat_sent' => 'i', 'netstat_recv' => 'i', 'memory_free' => 'f', 'memory_total' => 'f', 'memory_used' => 'f', 'disk_free' => 'B', 'disk_percent' => 'f', 'disk_used' => 'B', 'disk_total' => 'B', 'processes' => 'i', 'temp' => 'i', 'load' => 'f', 'username' =>'s', 'computer' => 's'];
public static $_items = [ 'netstat_sent' => 'i', 'netstat_recv' => 'i', 'memory_free' => 'B', 'memory_total' => 'B', 'memory_used' => 'B', 'disk_free' => 'B', 'disk_percent' => 'f', 'disk_used' => 'B', 'disk_total' => 'B', 'processes' => 'i', 'temp' => 'i', 'load' => 'f', 'username' =>'s', 'computer' => 's'];
private $_values = [];
private $_ucache = [];
@@ -32,7 +32,7 @@ class Logging extends Controller
if ($ret == false ) {
$q = DB::table('computers')->select('id', 'computer')->get();
foreach ($q as $v) {
$this->_ucache[$v->computer] = $v->id;
$this->_ccache[$v->computer] = $v->id;
}
\apcu_store('computers',$this->_ccache);
}
@@ -67,9 +67,9 @@ class Logging extends Controller
$units = explode(' ', ' K M G T P E Z Y');
preg_match('/([0-9]+)([GKMTgkmT])?B/',$v,$vu);
preg_match('/([0-9\.]+)([GKMTgkmT])?B/',$v,$vu);
$v1 = $vu[1];
$v1 = $vu[1];
if (count($vu) == 3)
$v2 = $vu[2];
else