-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1bcd6e9
Showing
812 changed files
with
132,266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
APP_NAME="VATSIM Germany" | ||
APP_VERSION="2.1" | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL= | ||
|
||
COOKIE_CONSENT_ENABLED=true | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE= | ||
DB_USERNAME= | ||
DB_PASSWORD= | ||
|
||
BROADCAST_DRIVER=redis | ||
CACHE_DRIVER=redis | ||
QUEUE_CONNECTION=redis | ||
SESSION_DRIVER=redis | ||
SESSION_LIFETIME=120 | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS=null | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
VATSIM_OAUTH_BASE=http://auth.vatsim.net | ||
VATSIM_OAUTH_CLIENT= | ||
VATSIM_OAUTH_SECRET= | ||
VATSIM_OAUTH_SCOPES=full_name,email,vatsim_details,country | ||
|
||
VATSIM_API_BASE=https://api.vatsim.net/api | ||
|
||
FORUM_URL=https://board.vatsim-germany.org | ||
FORUM_API_KEY= | ||
FORUM_DEFAULT_GROUP=2 | ||
FORUM_SUSPENDED_GROUP=56 | ||
FORUM_GUEST_GROUP=55 | ||
FORUM_NEWS_THREAD=97 | ||
|
||
FORUM_EXTRA_API_URL=http:// | ||
FORUM_EXTRA_API_KEY= | ||
|
||
TS_HOST=127.0.0.1 | ||
TS_USER=serveradmin | ||
TS_PASS= | ||
TS_PORT=9987 | ||
TS_QUERY_PORT=10011 | ||
TS_NEW_GROUP=Normal | ||
TS_APIKEY= | ||
TS_WEBQUERY_PORT=10080 | ||
TS_SERVER_NR=1 | ||
TS_HP_WEBAPIKEY= | ||
|
||
PASETO_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/.phpintel | ||
/.idea | ||
/.vscode | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.lock | ||
*-lock.json | ||
*.lock | ||
laravel-echo-server.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
php: | ||
preset: laravel | ||
disabled: | ||
- unused_use | ||
finder: | ||
not-name: | ||
- index.php | ||
- server.php | ||
js: | ||
finder: | ||
not-name: | ||
- webpack.mix.js | ||
css: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
### VATSIM Germany Webservice | ||
Dieses Repository enthält den Quellcode der VATSIM Germany Webservices. | ||
|
||
|
||
#### Installation | ||
|
||
1. Klone das Repository | ||
2. Führe die folgenden Konsolenbefehle aus: | ||
|
||
1. `composer update` (Installiert die notwendigen Abhängigkeiten via Composer) | ||
|
||
2. `npm install` (Installiert die notwendigen Abhängigkeiten via NPM) | ||
|
||
3. `npm run dev` (Um .css und .js Dateien zu generieren) | ||
|
||
4. Jetzt muss die `.env` Datei angepasst werden: | ||
|
||
1. `cp .env.example .env` | ||
|
||
2. `nano .env` | ||
|
||
3. Wenn alle Einstellungen in der .env Datei an das lokale System angepasst wurden, die Datei speichern und schließen | ||
|
||
5. `php artisan migrate && php artisan db:seed` | ||
Hiermit wird die Datenbank initialisiert und mit anfänglichen Daten bestückt | ||
6. `sudo crontab -e` | ||
|
||
1. Füge folgenden Crontab hinzu `* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1` | ||
|
||
7. Vorbereiten der "Echtzeit" Mitteilungen | ||
|
||
1. `npm install -g laravel-echo-server` | ||
|
||
2. Nur ausführen, wenn KEINE `laravel-echo-server.json` Datei mitgeliefert wurde: `laravel-echo-server init` | ||
|
||
3. `nano laravel-echo-server.json` und die Datei dem lokalen System anpassen | ||
|
||
8. Datenautomatisierung | ||
|
||
1. `sudo nano /etc/supervisorctl/conf.d/vatsim-germany-worker.conf` | ||
|
||
2. Der Queue-Worker | ||
```lang-bash | ||
[program:vatsim-germany-worker] | ||
process_name=%(program_name)s_%(process_num)02d | ||
command=php /path/to/project/artisan queue:work --sleep=3 --tries=3 | ||
autostart=true | ||
autorestart=true | ||
user=vagrant | ||
numprocs=4 | ||
redirect_stderr=true | ||
stdout_logfile=/path/to/project/storage/logs/worker.log``` | ||
3. `sudo nano /etc/supervisorctl/conf.d/vatsim-germany-echo-worker.conf` | ||
4. Der Echo-Server Worker | ||
```lang-bash | ||
[program:vatsim-germany-echo-worker] | ||
directory=/path/to/project | ||
command=laravel-echo-server start | ||
autostart=true | ||
autorestart=true | ||
user=vagrant | ||
redirect_stderr=true | ||
stdout_logfile=/path/to/project/storage/logs/echo.log``` | ||
5. `sudo supervisorctl reread` | ||
6. `sudo supervisorctl reload` | ||
7. `sudo supervisorctl start vatsim-germany-worker:*` | ||
8. `sudo supervisorctl start vatsim-germany-echo-worker:*` | ||
3. Konfiguriere deinen Webserver so, dass es auf das public Verzeichnis verweist. | ||
```lang-bash | ||
server { | ||
listen 80; | ||
server_name yoururl.com; | ||
root /path/to/project/public; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-Content-Type-Options "nosniff"; | ||
index index.php; | ||
charset utf-8; | ||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
} | ||
location = /favicon.ico { access_log off; log_not_found off; } | ||
location = /robots.txt { access_log off; log_not_found off; } | ||
error_page 404 /index.php; | ||
location ~ \.php$ { | ||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; | ||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
location ~ /\.(?!well-known).* { | ||
deny all; | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace App\Charts\Statistics\Aerodrome; | ||
|
||
use Chartisan\PHP\Chartisan; | ||
use ConsoleTVs\Charts\BaseChart; | ||
use Illuminate\Http\Request; | ||
|
||
class TrafficChart extends BaseChart | ||
{ | ||
|
||
private $_arrivals; | ||
private $_departures; | ||
|
||
private $_start; | ||
private $_end; | ||
|
||
private $_labels = []; | ||
private $_arrivalsPerHour = []; | ||
private $_departuresPerHour = []; | ||
|
||
function __construct(){ | ||
} | ||
|
||
private function renderLabels() | ||
{ | ||
$timespan = $this->_start->diffInDays($this->_end) + 1; | ||
$hourCounter = 0; | ||
$timeframe = $timespan * 24; // Days in hours | ||
$immDate = $this->_start->copy()->toImmutable(); | ||
while ($hourCounter < $timeframe) { | ||
$s = $immDate->addHours($hourCounter); | ||
$e = $immDate->addHours($hourCounter + 1); | ||
if (0 == $hourCounter) { | ||
$labels[0] = $this->_start->format('d.m.Y H:i'); | ||
} elseif ($hourCounter == $timeframe) { | ||
$this->_labels[] = $this->_end->format('d.m.Y H:i'); | ||
} else { | ||
$this->_labels[] = $s->format('d.m.Y H:i'); | ||
} | ||
$hourCounter++; | ||
} | ||
} | ||
|
||
private function calculateMovements() | ||
{ | ||
$timespan = $this->_start->diffInDays($this->_end) + 1; | ||
$hourCounter = 0; | ||
$timeframe = $timespan * 24; // Days in hours | ||
$immDate = $this->_start->copy()->toImmutable(); | ||
while ($hourCounter < $timeframe) { | ||
$s = $immDate->addHours($hourCounter); | ||
$e = $immDate->addHours($hourCounter + 1); | ||
$this->_arrivalsPerHour[] = $this->_arrivals->filter( | ||
function ($arrival) use ($s, $e) { | ||
return $arrival->arrived_at >= $s | ||
&& $arrival->arrived_at < $e; | ||
} | ||
)->count(); | ||
$this->_departuresPerHour[] = $this->_departures->filter( | ||
function ($departure) use ($s, $e) { | ||
return $departure->departed_at >= $s | ||
&& $departure->departed_at < $e; | ||
} | ||
)->count(); | ||
$hourCounter++; | ||
} | ||
} | ||
|
||
/** | ||
* Handles the HTTP request for the given chart. | ||
* It must always return an instance of Chartisan | ||
* and never a string or an array. | ||
*/ | ||
public function handler(Request $request): Chartisan | ||
{ | ||
|
||
set_time_limit(0); // Run as long as needed. Will not effect page load due to ajax implementation | ||
|
||
$from = \Carbon\Carbon::createFromFormat('d.m.Y', $request->from, 'utc'); | ||
$from->setHours(0); | ||
$from->setMinutes(0); | ||
$from->setSeconds(0); | ||
|
||
$till = \Carbon\Carbon::createFromFormat('d.m.Y', $request->till, 'utc'); | ||
$till->setHours(23); | ||
$till->setMinutes(59); | ||
$till->setSeconds(59); | ||
|
||
$this->_start = $from; | ||
$this->_end = $till; | ||
|
||
$this->renderLabels(); | ||
|
||
$aerodrome = \App\Models\Navigation\Aerodrome::icao($request->aerodrome)->firstOrFail(); | ||
|
||
$departure = \App\Models\Network\PilotClient::where('departure_airport', $aerodrome->icao) | ||
->whereBetween('departed_at', [$from, $till]) | ||
->orderBy('departed_at', 'DESC') | ||
->get(); | ||
|
||
$arrival = \App\Models\Network\PilotClient::where('arrival_airport', $aerodrome->icao) | ||
->whereBetween('arrived_at', [$from, $till]) | ||
->orderBy('arrived_at', 'DESC') | ||
->get(); | ||
|
||
$this->_arrivals = \App\Models\Statistic\FlightData::where('arrival_airport', $aerodrome->icao) | ||
->whereBetween('arrived_at', [$from, $till]) | ||
->orderBy('arrived_at', 'DESC') | ||
->get(); | ||
$this->_departures = \App\Models\Statistic\FlightData::where('departure_airport', $aerodrome->icao) | ||
->whereBetween('departed_at', [$from, $till]) | ||
->orderBy('departed_at', 'DESC') | ||
->get(); | ||
|
||
$this->_arrivals = $this->_arrivals->merge($arrival); | ||
$this->_departures = $this->_departures->merge($departure); | ||
|
||
$this->calculateMovements(); | ||
|
||
return Chartisan::build() | ||
->labels($this->_labels) | ||
->dataset('Arrivals', $this->_arrivalsPerHour) | ||
->dataset('Departures', $this->_departuresPerHour); | ||
} | ||
} |
Oops, something went wrong.