Skip to content

Firefly III: a personal finances manager

Add some stuff for webhooks.

James Colef42bd19c1c59
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 6a7e54cd32..ef272460f9 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -56,12 +56,15 @@ abstract class Controller extends BaseController
{
// is site a demo site?
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false,),);
- $isDemoSite = $isDemoSiteConfig ? $isDemoSiteConfig->data : false;
+ $isDemoSite = $isDemoSiteConfig ? $isDemoSiteConfig->data : false;
app('view')->share('IS_DEMO_SITE', $isDemoSite,);
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
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()) {
diff --git a/database/migrations/2020_11_12_070604_changes_for_v550.php b/database/migrations/2020_11_12_070604_changes_for_v550.php
index 18b1636b63..1f47cf2abb 100644
--- a/database/migrations/2020_11_12_070604_changes_for_v550.php
+++ b/database/migrations/2020_11_12_070604_changes_for_v550.php
@@ -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);
diff --git a/resources/views/v1/partials/menu-sidebar.twig b/resources/views/v1/partials/menu-sidebar.twig
index cd0f1b05d7..37ae19feb4 100644
--- a/resources/views/v1/partials/menu-sidebar.twig
+++ b/resources/views/v1/partials/menu-sidebar.twig
@@ -1,223 +1,232 @@
<ul class="sidebar-menu" data-widget="tree">
- <li class="{{ activeRouteStrict('index') }}">
- <a href="{{ route('index') }}">
- <i class="fa fa-dashboard fa-fw"></i>
- <span>{{ 'dashboard'|_ }}</span>
- </a>
- </li>
-
- <li class="header text-uppercase">{{ 'financial_control'|_ }}</li>
-
- <li class="{{ activeRoutePartial('budgets') }}" id="budget-menu">
- <a href="{{ route('budgets.index') }}">
- <i class="fa fa-pie-chart fa-fw"></i>
- <span>{{ 'budgets'|_ }}</span>
- </a>
- </li>
-
- <li class="{{ activeRoutePartial('bills') }}">
- <a href="{{ route('bills.index') }}">
- <i class="fa fa-calendar-o fa-fw"></i>
- <span>{{ 'bills'|_ }}</span>
- </a>
- </li>
-
- <li class="{{ activeRoutePartial('piggy-banks') }}">
- <a href="{{ route('piggy-banks.index') }}">
- <i class="fa fa-bullseye fa-fw"></i>
- <span>{{ 'piggyBanks'|_ }}</span>
- </a>
- </li>
-
- <li class="header text-uppercase">{{ 'accounting'|_ }}</li>
-
- <li class="{{ activeRoutePartial('transactions') }} treeview" id="transaction-menu">
- <a href="#">
- <i class="fa fa-exchange fa-fw"></i>
- <span>{{ 'transactions'|_ }}</span>
- <span class="pull-right-container">
- <i class="fa fa-angle-left pull-right"></i>
- </span>
- </a>
+ <li class="{{ activeRouteStrict('index') }}">
+ <a href="{{ route('index') }}">
+ <i class="fa fa-dashboard fa-fw"></i>
+ <span>{{ 'dashboard'|_ }}</span>
+ </a>
+ </li>
+
+ <li class="header text-uppercase">{{ 'financial_control'|_ }}</li>
- <ul class="treeview-menu">
- <li class="{{ activeRoutePartialObjectType('transactions', 'withdrawal') }}">
- <a href="{{ route('transactions.index', 'withdrawal') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'expenses'|_ }}</span>
+ <li class="{{ activeRoutePartial('budgets') }}" id="budget-menu">
+ <a href="{{ route('budgets.index') }}">
+ <i class="fa fa-pie-chart fa-fw"></i>
+ <span>{{ 'budgets'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartialObjectType('transactions', 'deposit') }}">
- <a href="{{ route('transactions.index', 'deposit') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'income'|_ }}</span>
+ </li>
+
+ <li class="{{ activeRoutePartial('bills') }}">
+ <a href="{{ route('bills.index') }}">
+ <i class="fa fa-calendar-o fa-fw"></i>
+ <span>{{ 'bills'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartialObjectType('transactions', 'transfers') }}">
- <a href="{{ route('transactions.index', 'transfers') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'transfers'|_ }}</span>
+ </li>
+
+ <li class="{{ activeRoutePartial('piggy-banks') }}">
+ <a href="{{ route('piggy-banks.index') }}">
+ <i class="fa fa-bullseye fa-fw"></i>
+ <span>{{ 'piggyBanks'|_ }}</span>
</a>
- </li>
- </ul>
- </li>
-
- <li class="{{ activeRoutePartial('recurring') }} {{ activeRoutePartial('rules') }} treeview">
- <a href="#">
- <i class="fa fa-microchip fa-fw"></i>
- <span>{{ 'automation'|_ }}</span>
- <span class="pull-right-container">
+ </li>
+
+ <li class="header text-uppercase">{{ 'accounting'|_ }}</li>
+
+ <li class="{{ activeRoutePartial('transactions') }} treeview" id="transaction-menu">
+ <a href="#">
+ <i class="fa fa-exchange fa-fw"></i>
+ <span>{{ 'transactions'|_ }}</span>
+ <span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
- </a>
-
- <ul class="treeview-menu">
- <li class="{{ activeRoutePartial('rules') }}">
- <a href="{{ route('rules.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'rules'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartial('recurring') }}">
- <a href="{{ route('recurring.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'recurrences'|_ }}</span>
- </a>
- </li>
- </ul>
- </li>
- <li class="header text-uppercase">{{ 'others'|_ }}</li>
+ <ul class="treeview-menu">
+ <li class="{{ activeRoutePartialObjectType('transactions', 'withdrawal') }}">
+ <a href="{{ route('transactions.index', 'withdrawal') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'expenses'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartialObjectType('transactions', 'deposit') }}">
+ <a href="{{ route('transactions.index', 'deposit') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'income'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartialObjectType('transactions', 'transfers') }}">
+ <a href="{{ route('transactions.index', 'transfers') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'transfers'|_ }}</span>
+ </a>
+ </li>
+ </ul>
+ </li>
- <li class="{{ activeRoutePartial('accounts') }} treeview" id="account-menu">
- <a href="#">
- <i class="fa fa-credit-card fa-fw"></i>
- <span>{{ 'accounts'|_ }}</span>
- <span class="pull-right-container">
+ <li class="{{ activeRoutePartial('recurring') }} {{ activeRoutePartial('rules') }} treeview">
+ <a href="#">
+ <i class="fa fa-microchip fa-fw"></i>
+ <span>{{ 'automation'|_ }}</span>
+ <span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
- </a>
-
- <ul class="treeview-menu">
- <li class="{{ activeRoutePartialObjectType('accounts', 'asset') }}">
- <a href="{{ route('accounts.index', 'asset') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'asset_accounts'|_ }}</span>
- </a>
- </li>
- <li class="{{ activeRoutePartialObjectType('accounts', 'expense') }}">
- <a href="{{ route('accounts.index', 'expense') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'expense_accounts'|_ }}</span>
- </a>
- </li>
- <li class="{{ activeRoutePartialObjectType('accounts', 'revenue') }}">
- <a href="{{ route('accounts.index', 'revenue') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'revenue_accounts'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartialObjectType('accounts', 'liabilities') }}">
- <a href="{{ route('accounts.index', 'liabilities') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'liabilities_accounts'|_ }}</span>
- </a>
- </li>
- </ul>
- </li>
-
- <li class="{{ activeRoutePartial('categories') }} {{ activeRoutePartial('tags') }} treeview">
- <a href="#">
- <i class="fa fa-tags fa-fw"></i>
- <span>{{ 'classification'|_ }}</span>
- <span class="pull-right-container">
+
+ <ul class="treeview-menu">
+ <li class="{{ activeRoutePartial('rules') }}">
+ <a href="{{ route('rules.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'rules'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartial('recurring') }}">
+ <a href="{{ route('recurring.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'recurrences'|_ }}</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="header text-uppercase">{{ 'others'|_ }}</li>
+
+ <li class="{{ activeRoutePartial('accounts') }} treeview" id="account-menu">
+ <a href="#">
+ <i class="fa fa-credit-card fa-fw"></i>
+ <span>{{ 'accounts'|_ }}</span>
+ <span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
- </a>
-
- <ul class="treeview-menu">
- <li class="{{ activeRoutePartial('categories') }}">
- <a href="{{ route('categories.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'categories'|_ }}</span>
- </a>
- </li>
- <li class="{{ activeRoutePartial('tags') }}">
- <a href="{{ route('tags.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'tags'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartial('object-groups') }}">
- <a href="{{ route('object-groups.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'object_groups_menu_bar'|_ }}</span>
- </a>
- </li>
- </ul>
- </li>
-
- <li class="{{ activeRoutePartial('reports') }}" id="report-menu">
- <a href="{{ route('reports.index') }}">
- <i class="fa fa-bar-chart fa-fw"></i>
- <span>{{ 'reports'|_ }}</span>
- </a>
- </li>
-
-
- {% if config('firefly.feature_flags.export') %}
- <li class="{{ activeRoutePartial('export') }}" id="report-menu">
- <a href="{{ route('export.index') }}">
- <i class="fa fa-upload fa-fw"></i>
- <span>{{ 'export_data_menu'|_ }}</span>
- </a>
+
+ <ul class="treeview-menu">
+ <li class="{{ activeRoutePartialObjectType('accounts', 'asset') }}">
+ <a href="{{ route('accounts.index', 'asset') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'asset_accounts'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartialObjectType('accounts', 'expense') }}">
+ <a href="{{ route('accounts.index', 'expense') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'expense_accounts'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartialObjectType('accounts', 'revenue') }}">
+ <a href="{{ route('accounts.index', 'revenue') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'revenue_accounts'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartialObjectType('accounts', 'liabilities') }}">
+ <a href="{{ route('accounts.index', 'liabilities') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'liabilities_accounts'|_ }}</span>
+ </a>
+ </li>
+ </ul>
</li>
- {% endif %}
- <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>
- <span class="pull-right-container">
+ <li class="{{ activeRoutePartial('categories') }} {{ activeRoutePartial('tags') }} treeview">
+ <a href="#">
+ <i class="fa fa-tags fa-fw"></i>
+ <span>{{ 'classification'|_ }}</span>
+ <span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
- </a>
-
- <ul class="treeview-menu">
- <li class="{{ activeRoutePartial('profile') }}">
- <a class="{{ activeRouteStrict('profile.index') }}" href="{{ route('profile.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'profile'|_ }}</span>
</a>
- </li>
- <li class="{{ activeRoutePartial('preferences') }}">
- <a class="{{ activeRouteStrict('preferences.index') }}" href="{{ route('preferences.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'preferences'|_ }}</span>
- </a>
- </li>
- <li class="{{ activeRoutePartial('currencies') }}">
- <a class="{{ activeRoutePartial('currencies') }}" href="{{ route('currencies.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'currencies'|_ }}</span>
+
+ <ul class="treeview-menu">
+ <li class="{{ activeRoutePartial('categories') }}">
+ <a href="{{ route('categories.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'categories'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartial('tags') }}">
+ <a href="{{ route('tags.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'tags'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartial('object-groups') }}">
+ <a href="{{ route('object-groups.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'object_groups_menu_bar'|_ }}</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="{{ activeRoutePartial('reports') }}" id="report-menu">
+ <a href="{{ route('reports.index') }}">
+ <i class="fa fa-bar-chart fa-fw"></i>
+ <span>{{ 'reports'|_ }}</span>
</a>
- </li>
- {% if hasRole('owner') %}
- <li class="{{ activeRoutePartial('admin') }}">
- <a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}">
- <i class="fa fa-angle-right fa-fw"></i>
- <span>{{ 'administration'|_ }}</span>
- </a>
+ </li>
+
+
+ {% if config('firefly.feature_flags.export') %}
+ <li class="{{ activeRoutePartial('export') }}" id="report-menu">
+ <a href="{{ route('export.index') }}">
+ <i class="fa fa-upload fa-fw"></i>
+ <span>{{ 'export_data_menu'|_ }}</span>
+ </a>
</li>
- {% endif %}
- </ul>
- </li>
- {% if 'remote_user_guard' != authGuard or '' != logoutUri %}
- <li>
- <a href="{{ route('logout') }}">
- <i class="fa fa-sign-out fa-fw"></i>
- <span>{{ 'logout'|_ }}</span>
- </a>
+ {% endif %}
+
+ <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>
+ <span class="pull-right-container">
+ <i class="fa fa-angle-left pull-right"></i>
+ </span>
+ </a>
+
+ <ul class="treeview-menu">
+ <li class="{{ activeRoutePartial('profile') }}">
+ <a class="{{ activeRouteStrict('profile.index') }}" href="{{ route('profile.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'profile'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartial('preferences') }}">
+ <a class="{{ activeRouteStrict('preferences.index') }}" href="{{ route('preferences.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'preferences'|_ }}</span>
+ </a>
+ </li>
+ <li class="{{ activeRoutePartial('currencies') }}">
+ <a class="{{ activeRoutePartial('currencies') }}" href="{{ route('currencies.index') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <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') }}">
+ <i class="fa fa-angle-right fa-fw"></i>
+ <span>{{ 'administration'|_ }}</span>
+ </a>
+ </li>
+ {% endif %}
+ </ul>
</li>
- {% endif %}
+ {% if 'remote_user_guard' != authGuard or '' != logoutUri %}
+ <li>
+ <a href="{{ route('logout') }}">
+ <i class="fa fa-sign-out fa-fw"></i>
+ <span>{{ 'logout'|_ }}</span>
+ </a>
+ </li>
+ {% endif %}
</ul>
diff --git a/resources/views/v2/layout/default.twig b/resources/views/v2/layout/default.twig
index d9bdc2da35..c962e0db5a 100644
--- a/resources/views/v2/layout/default.twig
+++ b/resources/views/v2/layout/default.twig
@@ -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 -->
diff --git a/routes/web.php b/routes/web.php
index fa21c69e2c..3cfd002487 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -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'.
*/