Add some stuff for webhooks.

This commit is contained in:
James Cole
2020-11-29 11:36:29 +01:00
parent c68d7c5aad
commit f42bd19c1c
5 changed files with 239 additions and 217 deletions

View File

@@ -62,6 +62,9 @@ abstract class Controller extends BaseController
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
app('view')->share('FF_VERSION', config('firefly.version'));
// is webhooks enabled?
app('view')->share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === config('firefly.allow_webhooks'));
// share custom auth guard info.
$authGuard = config('firefly.authentication_guard');
$logoutUri = config('firefly.custom_logout_uri');
@@ -95,9 +98,9 @@ abstract class Controller extends BaseController
function ($request, $next) {
$locale = app('steam')->getLocale();
// translations for specific strings:
$this->monthFormat = (string) trans('config.month', [], $locale);
$this->monthAndDayFormat = (string) trans('config.month_and_day', [], $locale);
$this->dateTimeFormat = (string) trans('config.date_time', [], $locale);
$this->monthFormat = (string)trans('config.month', [], $locale);
$this->monthAndDayFormat = (string)trans('config.month_and_day', [], $locale);
$this->dateTimeFormat = (string)trans('config.date_time', [], $locale);
// get shown-intro-preference:
if (auth()->check()) {

View File

@@ -116,7 +116,7 @@ class ChangesForV550 extends Migration
Schema::create(
'webhooks',
static function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('user_id', false, true);
$table->softDeletes();
$table->boolean('active')->default(true);
@@ -133,7 +133,7 @@ class ChangesForV550 extends Migration
Schema::create(
'webhook_messages',
static function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('webhook_id', false, true);
$table->softDeletes();
$table->boolean('sent')->default(false);

View File

@@ -174,7 +174,8 @@
</li>
{% endif %}
<li class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currencies') }} treeview" id="option-menu">
<li class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currencies') }} treeview"
id="option-menu">
<a href="#">
<i class="fa fa-sliders fa-fw"></i>
<span>{{ 'options'|_ }}</span>
@@ -202,6 +203,14 @@
<span>{{ 'currencies'|_ }}</span>
</a>
</li>
{% if true == featuringWebhooks %}
<li class="{{ activeRoutePartial('webhooks') }}">
<a class="{{ activeRoutePartial('webhooks') }}" href="{{ route('webhooks.index') }}">
<i class="fa fa-angle-right fa-fw"></i>
<span>{{ 'webhooks'|_ }}</span>
</a>
</li>
{% endif %}
{% if hasRole('owner') %}
<li class="{{ activeRoutePartial('admin') }}">
<a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}">

View File

@@ -27,7 +27,7 @@
<link rel="stylesheet" href="v2/plugins/local-fonts/gf-source.css">
<link rel="stylesheet" href="v2/css/app.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed">
<div class="wrapper">
<!-- Navbar -->

View File

@@ -1077,6 +1077,16 @@ Route::group(
}
);
/*
* Webhooks management
*/
Route::group(
['middleware' => 'user-full-auth', 'namespace' => 'FireflyIII\Http\Controllers\Webhooks', 'prefix' => 'webhooks', 'as' => 'webhooks.'],
static function () {
Route::get('index', ['uses' => 'IndexController@index', 'as' => 'index']);
}
);
/**
* For the admin routes, the user must be logged in and have the role of 'owner'.
*/