Merge branch 'main' of ssh://code.bengoldsworthy.net:222/Rumperuu/Where-in-the-World-is-Ben
This commit is contained in:
commit
14de96fd59
9 changed files with 452 additions and 34 deletions
34
app/Mail/WeeklyDigest.php
Normal file
34
app/Mail/WeeklyDigest.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class WeeklyDigest extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the message.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->view('emails.weekly-digest')
|
||||||
|
->subject('Weekly Digest');
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "laravel/laravel",
|
"name": "rumperuu/bentracker",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The Laravel Framework.",
|
"description": "A Web app. for tracking my travels.",
|
||||||
"keywords": ["framework", "laravel"],
|
"keywords": ["travel", "laravel"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.0.2",
|
"php": "^8.0.2",
|
||||||
|
@ -10,7 +10,9 @@
|
||||||
"laravel/framework": "^9.19",
|
"laravel/framework": "^9.19",
|
||||||
"laravel/sanctum": "^3.0",
|
"laravel/sanctum": "^3.0",
|
||||||
"laravel/tinker": "^2.7",
|
"laravel/tinker": "^2.7",
|
||||||
"larswiegers/laravel-maps": "^0.12.0"
|
"larswiegers/laravel-maps": "^0.12.0",
|
||||||
|
"mailjet/laravel-mailjet": "^3.0",
|
||||||
|
"symfony/http-client": "^6.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
|
368
composer.lock
generated
368
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "2352b8039a1d97d54047acb2dc1032a0",
|
"content-hash": "44109efc12ef74a29f8aa0c4886fb3d2",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
|
@ -1706,6 +1706,142 @@
|
||||||
],
|
],
|
||||||
"time": "2022-04-17T13:12:02+00:00"
|
"time": "2022-04-17T13:12:02+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "mailjet/laravel-mailjet",
|
||||||
|
"version": "3.0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mailjet/laravel-mailjet.git",
|
||||||
|
"reference": "f1c2ab525c2f99e05b3e811bda9561a9115fd302"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mailjet/laravel-mailjet/zipball/f1c2ab525c2f99e05b3e811bda9561a9115fd302",
|
||||||
|
"reference": "f1c2ab525c2f99e05b3e811bda9561a9115fd302",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"laravel/framework": "~5.1|^6.0|^7.0|^8.0|^9.0",
|
||||||
|
"mailjet/mailjet-apiv3-php": "^1.5.6",
|
||||||
|
"php": "^7.1.3|^8.0",
|
||||||
|
"symfony/mailjet-mailer": "^6.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "~1",
|
||||||
|
"mockery/mockery": "0.9.*|^1.0",
|
||||||
|
"orchestra/testbench": "3.6|^4.0|^5.0|^6.0",
|
||||||
|
"phpunit/phpunit": "~7.0|^8.0|^9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Mailjet\\LaravelMailjet\\MailjetServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Mailjet": "Mailjet\\LaravelMailjet\\Facades\\Mailjet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Mailjet\\LaravelMailjet\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Gaetan DELBART",
|
||||||
|
"email": "gaetan@moltencore.io",
|
||||||
|
"homepage": "https://github.com/gagaXD"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Titouan BENOIT",
|
||||||
|
"email": "titouan.benoit@gmx.fr",
|
||||||
|
"homepage": "https://github.com/Nightbr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mailjet API",
|
||||||
|
"email": "api@mailjet.com",
|
||||||
|
"homepage": "https://dev.mailjet.com/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Laravel package for Mailjet API V3 and Laravel Mailjet Mail Transport",
|
||||||
|
"homepage": "https://github.com/mailjet/laravel-mailjet",
|
||||||
|
"keywords": [
|
||||||
|
"Mailjet",
|
||||||
|
"framework",
|
||||||
|
"laravel",
|
||||||
|
"mailjet API",
|
||||||
|
"mailjet wrapper",
|
||||||
|
"transport"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/mailjet/laravel-mailjet/issues",
|
||||||
|
"source": "https://github.com/mailjet/laravel-mailjet/tree/3.0.3"
|
||||||
|
},
|
||||||
|
"time": "2022-07-06T16:41:42+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mailjet/mailjet-apiv3-php",
|
||||||
|
"version": "v1.5.8",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mailjet/mailjet-apiv3-php.git",
|
||||||
|
"reference": "747518ce0eebf64d27e9903441a255c85472a139"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mailjet/mailjet-apiv3-php/zipball/747518ce0eebf64d27e9903441a255c85472a139",
|
||||||
|
"reference": "747518ce0eebf64d27e9903441a255c85472a139",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"guzzlehttp/guzzle": "^7.4.4",
|
||||||
|
"php": "^7.2|^8.0",
|
||||||
|
"psr/http-client": "^1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.4",
|
||||||
|
"php-coveralls/php-coveralls": "^2.0",
|
||||||
|
"phpunit/phpunit": "^8|^9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Mailjet": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mailjet",
|
||||||
|
"email": "dev@mailjet.com",
|
||||||
|
"homepage": "https://dev.mailjet.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP wrapper for the Mailjet API",
|
||||||
|
"homepage": "https://github.com/mailjet/mailjet-apiv3-php/",
|
||||||
|
"keywords": [
|
||||||
|
"Mailjet",
|
||||||
|
"api",
|
||||||
|
"email",
|
||||||
|
"php",
|
||||||
|
"v3"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/mailjet/mailjet-apiv3-php/issues",
|
||||||
|
"source": "https://github.com/mailjet/mailjet-apiv3-php/tree/v1.5.8"
|
||||||
|
},
|
||||||
|
"time": "2022-10-15T16:24:08+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
"version": "2.8.0",
|
"version": "2.8.0",
|
||||||
|
@ -3455,6 +3591,171 @@
|
||||||
],
|
],
|
||||||
"time": "2022-07-29T07:42:06+00:00"
|
"time": "2022-07-29T07:42:06+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/http-client",
|
||||||
|
"version": "v6.1.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/http-client.git",
|
||||||
|
"reference": "c8c887f4813370550147afd27d9eb8a8523e53b2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/http-client/zipball/c8c887f4813370550147afd27d9eb8a8523e53b2",
|
||||||
|
"reference": "c8c887f4813370550147afd27d9eb8a8523e53b2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/log": "^1|^2|^3",
|
||||||
|
"symfony/http-client-contracts": "^3",
|
||||||
|
"symfony/service-contracts": "^1.0|^2|^3"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"php-http/async-client-implementation": "*",
|
||||||
|
"php-http/client-implementation": "*",
|
||||||
|
"psr/http-client-implementation": "1.0",
|
||||||
|
"symfony/http-client-implementation": "3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"amphp/amp": "^2.5",
|
||||||
|
"amphp/http-client": "^4.2.1",
|
||||||
|
"amphp/http-tunnel": "^1.0",
|
||||||
|
"amphp/socket": "^1.1",
|
||||||
|
"guzzlehttp/promises": "^1.4",
|
||||||
|
"nyholm/psr7": "^1.0",
|
||||||
|
"php-http/httplug": "^1.0|^2.0",
|
||||||
|
"psr/http-client": "^1.0",
|
||||||
|
"symfony/dependency-injection": "^5.4|^6.0",
|
||||||
|
"symfony/http-kernel": "^5.4|^6.0",
|
||||||
|
"symfony/process": "^5.4|^6.0",
|
||||||
|
"symfony/stopwatch": "^5.4|^6.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\HttpClient\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/http-client/tree/v6.1.6"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2022-10-12T05:10:31+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/http-client-contracts",
|
||||||
|
"version": "v3.1.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/http-client-contracts.git",
|
||||||
|
"reference": "fd038f08c623ab5d22b26e9ba35afe8c79071800"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/fd038f08c623ab5d22b26e9ba35afe8c79071800",
|
||||||
|
"reference": "fd038f08c623ab5d22b26e9ba35afe8c79071800",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/http-client-implementation": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.1-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Contracts\\HttpClient\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Test/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generic abstractions related to HTTP clients",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"abstractions",
|
||||||
|
"contracts",
|
||||||
|
"decoupling",
|
||||||
|
"interfaces",
|
||||||
|
"interoperability",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/http-client-contracts/tree/v3.1.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2022-04-22T07:30:54+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-foundation",
|
"name": "symfony/http-foundation",
|
||||||
"version": "v6.1.3",
|
"version": "v6.1.3",
|
||||||
|
@ -3711,6 +4012,71 @@
|
||||||
],
|
],
|
||||||
"time": "2022-07-27T15:50:51+00:00"
|
"time": "2022-07-27T15:50:51+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/mailjet-mailer",
|
||||||
|
"version": "v6.1.5",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/mailjet-mailer.git",
|
||||||
|
"reference": "a538f1d86b71107daaff2691094c877edf54e5ef"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/mailjet-mailer/zipball/a538f1d86b71107daaff2691094c877edf54e5ef",
|
||||||
|
"reference": "a538f1d86b71107daaff2691094c877edf54e5ef",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"symfony/mailer": "^5.4|^6.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/http-client": "^5.4|^6.0"
|
||||||
|
},
|
||||||
|
"type": "symfony-mailer-bridge",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Mailer\\Bridge\\Mailjet\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Mailjet Mailer Bridge",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/mailjet-mailer/tree/v6.1.5"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2022-09-27T10:43:34+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/mime",
|
"name": "symfony/mime",
|
||||||
"version": "v6.1.3",
|
"version": "v6.1.3",
|
||||||
|
|
|
@ -197,6 +197,10 @@ return [
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
App\Providers\RouteServiceProvider::class,
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mail Service Providers...
|
||||||
|
*/
|
||||||
|
Mailjet\LaravelMailjet\MailjetServiceProvider::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -211,7 +215,7 @@ return [
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'aliases' => Facade::defaultAliases()->merge([
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
'Mailjet' => Mailjet\LaravelMailjet\Facades\Mailjet::class,
|
||||||
])->toArray(),
|
])->toArray(),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -62,6 +62,10 @@ return [
|
||||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'mailjet' => [
|
||||||
|
'transport' => 'mailjet',
|
||||||
|
],
|
||||||
|
|
||||||
'log' => [
|
'log' => [
|
||||||
'transport' => 'log',
|
'transport' => 'log',
|
||||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
|
|
@ -14,21 +14,9 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'mailgun' => [
|
'mailjet' => [
|
||||||
'domain' => env('MAILGUN_DOMAIN'),
|
'key' => env('MAILJET_APIKEY'),
|
||||||
'secret' => env('MAILGUN_SECRET'),
|
'secret' => env('MAILJET_APISECRET'),
|
||||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
]
|
||||||
'scheme' => 'https',
|
|
||||||
],
|
|
||||||
|
|
||||||
'postmark' => [
|
|
||||||
'token' => env('POSTMARK_TOKEN'),
|
|
||||||
],
|
|
||||||
|
|
||||||
'ses' => [
|
|
||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
|
||||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
1
resources/views/emails/weekly-digest.blade.php
Normal file
1
resources/views/emails/weekly-digest.blade.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<p>Hello, world</p>
|
|
@ -26,9 +26,10 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main id="pastTripsList">
|
<main id="pastTripsList">
|
||||||
<ul>
|
<ol>
|
||||||
|
<li><a href="/x8gkdo56o7k3eyp3w2ql">Monkey Run Scotland 2022</a></li>
|
||||||
<li><a href="/47xj8go928ql9mq3r20p">Europespedition III: Leds Free or Die Hard</a></li>
|
<li><a href="/47xj8go928ql9mq3r20p">Europespedition III: Leds Free or Die Hard</a></li>
|
||||||
</ul>
|
</ol>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,39 +2,53 @@
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use App\Mail\WeeklyDigest;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
Route::get('/past-trips', function () {
|
Route::get('/past-trips', function () {
|
||||||
return view('past-trips');
|
return view('past-trips');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/{tripId?}', function (Request $request, $tripId = null) {
|
Route::get('/{tripId?}', function (Request $request, $tripId = null) {
|
||||||
|
//Mail::to('me@bengoldsworthy.net')->send(new WeeklyDigest());
|
||||||
|
|
||||||
if (!$tripId && !config('app.current_trip_id')) return view('no-trip');
|
if (!$tripId && !config('app.current_trip_id')) return view('no-trip');
|
||||||
|
|
||||||
$viewMode = $request->input('show', null);
|
$viewMode = $request->input('show', null);
|
||||||
|
|
||||||
/*
|
// If there is a file in the local cache that is less than 1–3 hours old
|
||||||
* If there is a file in the local cache that is less than 1–3 hours old
|
// (depending on whether it was actively tracking at last check), use that.
|
||||||
* (depending on whether it was actively tracking at last check), use that.
|
|
||||||
*/
|
|
||||||
$tripFileName = ( $tripId ?? config('app.current_trip_id') ) . '.json';
|
$tripFileName = ( $tripId ?? config('app.current_trip_id') ) . '.json';
|
||||||
|
|
||||||
if (Storage::disk('local')->exists($tripFileName)) {
|
if (Storage::disk('local')->exists($tripFileName)) {
|
||||||
$cachedData = json_decode(Storage::disk('local')->get($tripFileName));
|
Log::debug("Cached trip file '{$tripFileName}' found...");
|
||||||
if ($cachedData->trip->is_active) {
|
$cachedData = json_decode(Storage::disk('local')->get($tripFileName))->trip;
|
||||||
$cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at);
|
|
||||||
|
if ($cachedData->is_active) {
|
||||||
|
Log::debug("Cached trip file '{$tripFileName}' is for an active trip.");
|
||||||
|
|
||||||
|
$cachedDataUpdatedAt = new DateTime($cachedData->updated_at);
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= ($cachedData->trip->is_tracking) ? 1 : 3) {
|
$cachingTimeout = ($cachedData->is_tracking) ? 1 : 3;
|
||||||
return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($viewMode === 'all')]);
|
$cachedDataAge = intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600);
|
||||||
|
|
||||||
|
if ($cachedDataAge <= $cachingTimeout) {
|
||||||
|
Log::debug("Cached trip file '{$tripFileName}' is younger than {$cachingTimeout} hours, showing from cache...");
|
||||||
|
return view('tracker', ['trip' => $cachedData, 'showAllCheckins' => ($viewMode === 'all')]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($viewMode === 'all')]);
|
Log::debug("Cached trip file '{$tripFileName}' is for an old trip, showing from cache...");
|
||||||
|
return view('tracker', ['trip' => $cachedData, 'showAllCheckins' => ($viewMode === 'all')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Otherwise, download the latest tracking data.
|
* Otherwise, download the latest tracking data.
|
||||||
*/
|
*/
|
||||||
|
Log::debug("No cached trip file found for '{$tripFileName}'.");
|
||||||
$client = new Client([
|
$client = new Client([
|
||||||
'base_uri' => 'https://app.wayward.travel/',
|
'base_uri' => 'https://app.wayward.travel/',
|
||||||
'timeout' => 3.0
|
'timeout' => 3.0
|
||||||
|
@ -46,19 +60,23 @@ Route::get('/{tripId?}', function (Request $request, $tripId = null) {
|
||||||
|
|
||||||
// Cache the downloaded file if it does not exist locally.
|
// Cache the downloaded file if it does not exist locally.
|
||||||
if (Storage::disk('local')->missing($tripFileName)) {
|
if (Storage::disk('local')->missing($tripFileName)) {
|
||||||
|
Log::debug("Caching new trip file '{$tripFileName}'.");
|
||||||
Storage::disk('local')->put($tripFileName, json_encode($data));
|
Storage::disk('local')->put($tripFileName, json_encode($data));
|
||||||
} else {
|
} else {
|
||||||
$cachedData = json_decode(Storage::disk('local')->get($tripFileName));
|
$cachedData = json_decode(Storage::disk('local')->get($tripFileName));
|
||||||
if ($data->trip->updated_at !== $cachedData->trip->updated_at) {
|
if ($data->trip->updated_at !== $cachedData->trip->updated_at) {
|
||||||
|
Log::debug("Cached trip file '{$tripFileName}' has different 'updated_at' time, updating cache...");
|
||||||
Storage::disk('local')->put($tripFileName, json_encode($data));
|
Storage::disk('local')->put($tripFileName, json_encode($data));
|
||||||
// TODO: Cache photos locally
|
// TODO: Cache photos locally
|
||||||
} else {
|
} else {
|
||||||
|
Log::debug("Cached trip file '{$tripFileName}' has same 'updated_at' time, showing from cache...");
|
||||||
$data = $cachedData;
|
$data = $cachedData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($viewMode === 'all')]);
|
return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($viewMode === 'all')]);
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: Return proper error
|
||||||
return 'Something went wrong';
|
return 'Something went wrong';
|
||||||
}
|
}
|
||||||
})->where('tripId', '[0-9a-z]{20}');
|
})->where('tripId', '[0-9a-z]{20}');
|
||||||
|
|
Loading…
Reference in a new issue