Skip to content

Firefly III: a personal finances manager

Fix NPM issues.

James Colea060d9299914
diff --git a/app/Api/V1/Requests/Generic/FilterRequest.php b/app/Api/V1/Requests/Generic/FilterRequest.php
index 0910cbc528..acb6d997ef 100644
--- a/app/Api/V1/Requests/Generic/FilterRequest.php
+++ b/app/Api/V1/Requests/Generic/FilterRequest.php
@@ -64,22 +64,8 @@ class FilterRequest extends ApiRequest
return;
}
});
-
-
- return;
- $validator->after(function (Validator $validator): void {
- if (count($validator->failed()) > 0) {
- return;
- }
-
- $filter = $this->convertToFilter('');
- $this->attributes->set('filter', $filter);
- });
}
- private function convertToFilter(string $value): array {
- return [];
-// var_dump($value);
-// exit;
+// private function convertToFilter(string $value): array {
// return [];
- }
+// }
}
diff --git a/app/Rules/IsValidFilterInstruction.php b/app/Rules/IsValidFilterInstruction.php
index ed0e409306..316b2287e3 100644
--- a/app/Rules/IsValidFilterInstruction.php
+++ b/app/Rules/IsValidFilterInstruction.php
@@ -1,4 +1,6 @@
<?php
+
+declare(strict_types=1);
/*
* IsValidFilterInstructions.php
* Copyright (c) 2026 [email protected]
@@ -47,7 +49,7 @@ class IsValidFilterInstruction implements ValidationRule
return;
}
foreach($value as $key => $search) {
- if(!in_array($key, $validParameters)) {
+ if(!in_array($key, $validParameters, true)) {
$fail('validation.no_filter_instructions')->translate(['object' => $shortClass]);
return;
}
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index bb154f1b2d..7ba34a360b 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -190,9 +190,6 @@ trait ConvertsDataTypes
{
$parameter = request()->query->all($field);
- if(!is_array($parameter)) {
- return [];
- }
if(0 === count($parameter)) {
return [];
}
@@ -200,7 +197,7 @@ trait ConvertsDataTypes
$validParameters = config(sprintf('firefly.allowed_filter_parameters.%s', $shortClass));
$return = [];
foreach($parameter as $key => $search) {
- if(in_array($key, $validParameters) && strlen((string)$search) <= 50) {
+ if(in_array($key, $validParameters, true) && strlen((string)$search) <= 50) {
$return[$key] = trim((string)$search);
}
}
diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.js
index e2091fc918..fad4c0a893 100644
--- a/resources/assets/v3/js/pages/accounts/index.js
+++ b/resources/assets/v3/js/pages/accounts/index.js
@@ -40,6 +40,7 @@ let index = function () {
accounts: [],
sortDirection: "asc",
page: 1,
+ i18next:null,
anonymous: false,
totalPages: 1,
loadingPage: true,
@@ -57,7 +58,7 @@ let index = function () {
formatMoney: formatMoney,
objectToQueryString(obj, prefix) {
return Object.keys(obj).map(objKey => {
- if (obj.hasOwnProperty(objKey)) {
+ if (Object.hasOwn(obj, objKey)) {
const key = prefix ? `${prefix}[${objKey}]` : objKey;
const value = obj[objKey];
@@ -72,15 +73,14 @@ let index = function () {
updateHistory() {
if (history.pushState) {
-// TODO fix this.
+ // TODO fix this.
let obj = {
page: this.page,
column: this.sortColumn,
direction: this.sortDirection,
filter: this.filter
};
- let string = new URLSearchParams(obj).toString();
- string = this.objectToQueryString(obj);
+ let string = this.objectToQueryString(obj);
let newUrl =
window.location.protocol +
"//" +
@@ -98,6 +98,9 @@ let index = function () {
this.downloadAccounts();
},
init() {
+ this.$watch('filter.name', (value) => this.updateFilterValue('name', value));
+
+ this.i18next = i18next;
this.anonymous = window.store.get("anonymous");
this.handleFunc = this.handlePageClick.bind(this);
const page = window.location.href.split("?")[0].split("/");
diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.js
index e2ba5a1ef6..201cb71b84 100644
--- a/resources/assets/v3/js/pages/dashboard/dashboard.js
+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js
@@ -28,6 +28,7 @@ import formatMoney from "../../util/format-money.js";
import { getVariable } from "../../store/get-variable.js";
import { drawMultiCurrencyChart } from "../../shared/draw-chart.js";
import format from "../../util/format.js";
+import i18next from "i18next";
let index = function () {
return {
diff --git a/resources/assets/v3/js/util/format-money.js b/resources/assets/v3/js/util/format-money.js
index 621ae3a2c5..6299040170 100644
--- a/resources/assets/v3/js/util/format-money.js
+++ b/resources/assets/v3/js/util/format-money.js
@@ -20,7 +20,9 @@
export default function (amount, currencyCode) {
if ((typeof amount !== "number" && typeof amount !== "string") || isNaN(amount)) {
- console.warn("format-money: amount is not a number:", amount);
+ if(null !== amount) {
+ console.warn("format-money: amount is not a number:", amount);
+ }
return "";
}
if (typeof currencyCode !== "string" || currencyCode.length !== 3) {
diff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.php
index 6f635c904a..11fce6ffd4 100644
--- a/resources/views/accounts/index.blade.php
+++ b/resources/views/accounts/index.blade.php
@@ -31,7 +31,7 @@
<span data-column="name" class="title">{{ trans('list.name') }}</span>
<span data-column="name" class="search-spacer">&nbsp;</span><em data-column="name" class="search-button search-button-name bi bi-search"></em>
<div data-column="name" class="search-filter search-filter-name d-none input-group">
- <input type="search" x-model="filter.name" x-init="$watch('filter.name', (value) => updateFilterValue('name', value))" class="filter-input form-control form-control-sm" placeholder="Filter name...">
+ <input type="search" x-model="filter.name" class="filter-input form-control form-control-sm" placeholder="Filter name...">
<button class="btn btn-outline-secondary btn-sm hide-button" data-column="name" type="button"><em class="bi bi-x text-danger"></em></button>
</div>
</th>
@@ -323,7 +323,7 @@
<p class="text-center"><small>
<em>
<span
- x-html="i18next.t('firefly.may_inactive_accounts_link', {url: '{{ route('accounts.inactive.index', $objectType) }}'})"></span>
+ x-text="i18next.t('firefly.may_inactive_accounts_link', {url: '{{ route('accounts.inactive.index', $objectType) }}'})"></span>
</em>
</small>
</p>
@@ -351,7 +351,7 @@
<p class="text-center"><small>
<em>
<span
- x-html="i18next.t('firefly.no_inactive_accounts', {url: '{{ route('accounts.index', $objectType) }}'})"></span>
+ x-text="i18next.t('firefly.no_inactive_accounts', {url: '{{ route('accounts.index', $objectType) }}'})"></span>
</em>
</small>
</p>
diff --git a/resources/views/administrations/edit.blade.php b/resources/views/administrations/edit.blade.php
index 2e0675a6d6..a390906be5 100644
--- a/resources/views/administrations/edit.blade.php
+++ b/resources/views/administrations/edit.blade.php
@@ -19,7 +19,7 @@
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
- <strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>
+ <strong>{{ __("firefly.flash_success") }}</strong> <span x-text="success_message"></span>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button>
</div>
</div>
@@ -61,8 +61,8 @@
{{ __('firefly.submit') }}
</button>
</div>
- <p class="text-success" x-html="success_message"></p>
- <p class="text-danger" x-html="error_message"></p>
+ <p class="text-success" x-text="success_message"></p>
+ <p class="text-danger" x-text="error_message"></p>
</div>
</div>
</div>
diff --git a/resources/views/exchange-rates/rates.blade.php b/resources/views/exchange-rates/rates.blade.php
index 01acf37479..67065582b0 100644
--- a/resources/views/exchange-rates/rates.blade.php
+++ b/resources/views/exchange-rates/rates.blade.php
@@ -56,8 +56,8 @@
<thead>
<tr>
<th>{{ __('form.date') }}</th>
- <th x-html="i18next.t('form.from_currency_to_currency', {from: from.code, to: to.code})"></th>
- <th x-html="i18next.t('form.to_currency_from_currency', {from: from.code, to: to.code})"></th>
+ <th x-text="i18next.t('form.from_currency_to_currency', {from: from.code, to: to.code})"></th>
+ <th x-text="i18next.t('form.to_currency_from_currency', {from: from.code, to: to.code})"></th>
<th>&nbsp;</th>
</tr>
</thead>
diff --git a/resources/views/webhooks/create.blade.php b/resources/views/webhooks/create.blade.php
index 510112dec9..7fd8af8464 100644
--- a/resources/views/webhooks/create.blade.php
+++ b/resources/views/webhooks/create.blade.php
@@ -19,7 +19,7 @@
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
- <strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>
+ <strong>{{ __("firefly.flash_success") }}</strong> <span x-text="success_message"></span>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button>
</div>
</div>
@@ -56,7 +56,7 @@
<p class="text-success" x-text="success_message"></p>
</template>
<template x-if="'' !== error_message">
- <p class="text-danger" x-html="error_message"></p>
+ <p class="text-danger" x-text="error_message"></p>
</template>
</div>
</div>
diff --git a/resources/views/webhooks/edit.blade.php b/resources/views/webhooks/edit.blade.php
index 254dc8f91a..dd98935f39 100644
--- a/resources/views/webhooks/edit.blade.php
+++ b/resources/views/webhooks/edit.blade.php
@@ -19,7 +19,7 @@
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
- <strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>
+ <strong>{{ __("firefly.flash_success") }}</strong> <span x-text="success_message"></span>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button>
</div>
</div>
@@ -54,8 +54,8 @@
{{ __('firefly.submit') }}
</button>
</div>
- <p class="text-success" x-html="success_message"></p>
- <p class="text-danger" x-html="error_message"></p>
+ <p class="text-success" x-text="success_message"></p>
+ <p class="text-danger" x-text="error_message"></p>
</div>
</div>
</div>
diff --git a/resources/views/webhooks/show.blade.php b/resources/views/webhooks/show.blade.php
index 0eb87540a1..ad4be16522 100644
--- a/resources/views/webhooks/show.blade.php
+++ b/resources/views/webhooks/show.blade.php
@@ -5,7 +5,7 @@
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
- <strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>
+ <strong>{{ __("firefly.flash_success") }}</strong> <span x-text="success_message"></span>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button>
</div>
</div>