Merge pull request #438 from allerta-vvf/master

Updates
This commit is contained in:
Matteo Gheza 2022-01-25 22:36:04 +01:00 committed by GitHub
commit 7a259112cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 36 deletions

View File

@ -16,7 +16,7 @@
"spatie/array-to-xml": "3.1.0",
"ezyang/htmlpurifier": "4.14.0",
"brick/phonenumber": "0.4.0",
"sentry/sdk": "3.1.1",
"sentry/sdk": "^3.1",
"azuyalabs/yasumi": "2.4.0",
"ministryofweb/php-osm-tiles": "2.0.0",
"delight-im/db": "1.3.1",

33
backend/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9193956804bd765f7fe3f29d0c61472e",
"content-hash": "e58e898319723a7aa04ce911f357185f",
"packages": [
{
"name": "azuyalabs/yasumi",
@ -385,16 +385,16 @@
},
{
"name": "giggsey/libphonenumber-for-php",
"version": "8.12.40",
"version": "8.12.41",
"source": {
"type": "git",
"url": "https://github.com/giggsey/libphonenumber-for-php.git",
"reference": "cafb3497dce678e9643ec3eba38be251a67d7469"
"reference": "c7b9f89a25e37e8bb650a378c3eabcbdafedeafd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/cafb3497dce678e9643ec3eba38be251a67d7469",
"reference": "cafb3497dce678e9643ec3eba38be251a67d7469",
"url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/c7b9f89a25e37e8bb650a378c3eabcbdafedeafd",
"reference": "c7b9f89a25e37e8bb650a378c3eabcbdafedeafd",
"shasum": ""
},
"require": {
@ -454,7 +454,7 @@
"issues": "https://github.com/giggsey/libphonenumber-for-php/issues",
"source": "https://github.com/giggsey/libphonenumber-for-php"
},
"time": "2021-12-23T11:54:39+00:00"
"time": "2022-01-11T10:10:37+00:00"
},
{
"name": "giggsey/locale",
@ -2214,16 +2214,16 @@
},
{
"name": "sentry/sentry",
"version": "3.3.5",
"version": "3.3.7",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "c186c44c32899ad0cf5b4e942d71035f01b87b64"
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/c186c44c32899ad0cf5b4e942d71035f01b87b64",
"reference": "c186c44c32899ad0cf5b4e942d71035f01b87b64",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/32e5415803ff0349ccb5e5b5e77b016320762786",
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786",
"shasum": ""
},
"require": {
@ -2250,17 +2250,18 @@
"raven/raven": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^2.19|3.4.*",
"http-interop/http-factory-guzzle": "^1.0",
"monolog/monolog": "^1.3|^2.0",
"nikic/php-parser": "^4.10.3",
"php-http/mock-client": "^1.3",
"phpbench/phpbench": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan": "^1.3",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5.14|^9.4",
"symfony/phpunit-bridge": "^5.2|^6.0",
"vimeo/psalm": "^4.2"
"vimeo/psalm": "^4.17"
},
"suggest": {
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler."
@ -2302,7 +2303,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/3.3.5"
"source": "https://github.com/getsentry/sentry-php/tree/3.3.7"
},
"funding": [
{
@ -2314,7 +2315,7 @@
"type": "custom"
}
],
"time": "2021-12-27T12:31:24+00:00"
"time": "2022-01-19T08:46:27+00:00"
},
{
"name": "skrtdev/async",

View File

@ -136,6 +136,17 @@ function requireLogin()
$token = getBearerToken();
if($users->auth->isTokenValid($token)) {
$users->auth->authenticateWithToken($token);
if(SENTRY_LOADED) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($users): void {
$scope->setUser([
'id' => $users->auth->getUserId(),
'username' => $users->auth->getUserName(),
'name' => $users->getName(),
'email' => $users->auth->getEmail(),
'ip_address' => get_ip()
]);
});
}
return true;
}
return false;
@ -172,18 +183,27 @@ if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
exit();
}
switch ($routeInfo[0]) {
case FastRoute\Dispatcher::NOT_FOUND:
notFoundErrorHandler();
break;
case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
$allowedMethods = $routeInfo[1];
http_response_code(405);
apiResponse(["status" => "error", "message" => "Method not allowed", "usedMethod" => $_SERVER['REQUEST_METHOD']]);
break;
case FastRoute\Dispatcher::FOUND:
$handler = $routeInfo[1];
$vars = $routeInfo[2];
$handler($vars);
break;
}
try {
if(SENTRY_LOADED) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($uri): void {
$scope->setTag('page.route', $uri);
});
}
switch ($routeInfo[0]) {
case FastRoute\Dispatcher::NOT_FOUND:
notFoundErrorHandler();
break;
case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
$allowedMethods = $routeInfo[1];
http_response_code(405);
apiResponse(["status" => "error", "message" => "Method not allowed", "usedMethod" => $_SERVER['REQUEST_METHOD']]);
break;
case FastRoute\Dispatcher::FOUND:
$handler = $routeInfo[1];
$vars = $routeInfo[2];
$handler($vars);
break;
}
} catch (\Throwable $exception) {
\Sentry\captureException($exception);
}

View File

@ -7,6 +7,19 @@ use Phpfastcache\Config\ConfigurationOption;
require_once("vendor/autoload.php");
require("config.php");
if(!defined('SENTRY_LOADED')) {
if(!defined(SENTRY_ENABLED)) define(SENTRY_ENABLED, false);
if(SENTRY_ENABLED) {
\Sentry\init([
'dsn' => SENTRY_DSN,
'environment' => SENTRY_ENV,
'integrations' => [
new \Sentry\Integration\ModulesIntegration(),
]
]);
define('SENTRY_LOADED', true);
}
}
$db = \Delight\Db\PdoDatabase::fromDsn(
new \Delight\Db\PdoDsn(

View File

@ -28,7 +28,7 @@
<label>Caposquadra</label>
<br>
<ng-container *ngFor="let user of users">
<div class="form-check" *ngIf="user.chief">
<div class="form-check">
<input formControlName="chief" [class.is-invalid]="!isFieldValid('chief')"
class="form-check-input chief-{{ user.id }}" type="radio" value='{{ user.id }}'>
<label class="form-check-label" for="chief-{{ user.id }}">
@ -54,7 +54,7 @@
<label>Altri membri della squadra</label>
<br>
<ng-container *ngFor="let user of users">
<div class="form-check" *ngIf="!user.chief">
<div class="form-check">
<input class="form-check-input crew-{{ user.id }}" [class.is-invalid]="!isFieldValid('crew')"
(change)="onCrewCheckboxChange($event)" [checked]="isCrewSelected(user.id)" type="checkbox" value='{{ user.id }}'>
<label class="form-check-label" for="crew-{{ user.id }}">

View File

@ -71,8 +71,8 @@
</thead>
<tbody id="table_body">
<tr *ngFor="let row of data">
<td>{{ row.start | date:'dd/MM/YYYY, hh:mm' }}</td>
<td>{{ row.end | date:'dd/MM/YYYY, hh:mm' }}</td>
<td>{{ row.start | date:'dd/MM/YYYY, HH:mm' }}</td>
<td>{{ row.end | date:'dd/MM/YYYY, HH:mm' }}</td>
<td>{{ row.code }}</td>
<td>{{ row.chief }}</td>
<td>{{ row.drivers }}</td>