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('DEMO_PASSWORD', config('firefly.demo_password'));
app('view')->share('FF_VERSION', config('firefly.version')); 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. // share custom auth guard info.
$authGuard = config('firefly.authentication_guard'); $authGuard = config('firefly.authentication_guard');
$logoutUri = config('firefly.custom_logout_uri'); $logoutUri = config('firefly.custom_logout_uri');

View File

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

View File

@@ -174,7 +174,8 @@
</li> </li>
{% endif %} {% 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="#"> <a href="#">
<i class="fa fa-sliders fa-fw"></i> <i class="fa fa-sliders fa-fw"></i>
<span>{{ 'options'|_ }}</span> <span>{{ 'options'|_ }}</span>
@@ -202,6 +203,14 @@
<span>{{ 'currencies'|_ }}</span> <span>{{ 'currencies'|_ }}</span>
</a> </a>
</li> </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') %} {% if hasRole('owner') %}
<li class="{{ activeRoutePartial('admin') }}"> <li class="{{ activeRoutePartial('admin') }}">
<a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}"> <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/plugins/local-fonts/gf-source.css">
<link rel="stylesheet" href="v2/css/app.css"> <link rel="stylesheet" href="v2/css/app.css">
</head> </head>
<body class="hold-transition sidebar-mini layout-fixed"> <body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed">
<div class="wrapper"> <div class="wrapper">
<!-- Navbar --> <!-- 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'. * For the admin routes, the user must be logged in and have the role of 'owner'.
*/ */