Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

feat: frequency is now up to 366

Miguel Ribeirofa99a735cd23
diff --git a/Dockerfile b/Dockerfile
index 2e281b9..f68c8b9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,10 +6,10 @@ WORKDIR /var/www/html
# Update packages and install dependencies
RUN apk upgrade --no-cache && \
- apk add --no-cache sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev nginx dcron tzdata imagemagick imagemagick-dev libzip-dev sqlite && \
+ apk add --no-cache sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev nginx dcron tzdata imagemagick imagemagick-dev libzip-dev sqlite libwebp-dev && \
docker-php-ext-install pdo pdo_sqlite && \
docker-php-ext-enable pdo pdo_sqlite && \
- docker-php-ext-configure gd --with-freetype --with-jpeg && \
+ docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
docker-php-ext-install -j$(nproc) gd intl zip && \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
pecl install imagick && \
diff --git a/endpoints/currency/fixer_api_key.php b/endpoints/currency/fixer_api_key.php
index 90a5ec7..10f301a 100644
--- a/endpoints/currency/fixer_api_key.php
+++ b/endpoints/currency/fixer_api_key.php
@@ -3,7 +3,7 @@
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
if ($_SERVER["REQUEST_METHOD"] === "POST") {
- $newApiKey = isset($_POST["api_key"]) ? $_POST["api_key"] : "";
+ $newApiKey = isset($_POST["api_key"]) ? trim($_POST["api_key"]) : "";
$provider = isset($_POST["provider"]) ? $_POST["provider"] : 0;
$removeOldKey = "DELETE FROM fixer WHERE user_id = :userId";
diff --git a/includes/getdbkeys.php b/includes/getdbkeys.php
index 4c1a6ce..2130024 100644
--- a/includes/getdbkeys.php
+++ b/includes/getdbkeys.php
@@ -49,11 +49,8 @@
}
$frequencies = array();
- $query = "SELECT * FROM frequencies";
- $result = $db->query($query);
- while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
- $frequencyId = $row['id'];
- $frequencies[$frequencyId] = $row;
+ for ($i = 1; $i <= 366; $i++) {
+ $frequencies[$i] = array('id' => $i, 'name' => $i);
}
?>
\ No newline at end of file
diff --git a/includes/version.php b/includes/version.php
index cbed1a6..fc6d2d3 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
- $version = "v2.1.0";
+ $version = "v2.2.0";
?>
diff --git a/index.php b/index.php
index ec606e5..429ca24 100644
--- a/index.php
+++ b/index.php
@@ -83,6 +83,9 @@
<div class="filtermenu-submenu-content" id="filter-category">
<?php
foreach ($categories as $category) {
+ if ($category['name'] == "No category") {
+ $category['name'] = translate("no_category", $i18n);
+ }
$selectedClass = '';
if (isset($_GET['category']) && $_GET['category'] == $category['id']) {
$selectedClass = 'selected';
@@ -252,12 +255,12 @@
<div class="inline">
<select id="frequency" name="frequency" placeholder="<?= translate('frequency', $i18n) ?>">
<?php
- foreach ($frequencies as $frequency) {
- ?>
- <option value="<?= $frequency['id'] ?>"><?= $frequency['name'] ?></option>
- <?php
- }
- ?>
+ for ($i = 1; $i <= 366; $i++) {
+ ?>
+ <option value="<?= $i ?>"><?= $i ?></option>
+ <?php
+ }
+ ?>
</select>
<select id="cycle" name="cycle" placeholder="Cycle">
<?php
diff --git a/scripts/admin.js b/scripts/admin.js
index 9fb7472..d335157 100644
--- a/scripts/admin.js
+++ b/scripts/admin.js
@@ -101,7 +101,14 @@ function backupDB() {
const link = document.createElement('a');
const filename = data.file;
link.href = '.tmp/' + filename;
- link.download = 'backup.zip';
+ const date = new Date();
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const timestamp = `${year}${month}${day}-${hours}${minutes}`;
+ link.download = `Wallos-Backup-${timestamp}.zip`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
diff --git a/stats.php b/stats.php
index 7267650..201a415 100644
--- a/stats.php
+++ b/stats.php
@@ -112,7 +112,7 @@ if (isset($_GET['member'])) {
if (isset($_GET['category'])) {
$conditions[] = "category_id = :category";
$params[':category'] = $_GET['category'];
- $statsSubtitleParts[] = $categories[$_GET['category']]['name'];
+ $statsSubtitleParts[] = $categories[$_GET['category']]['name'] == "No category" ? translate("no_category", $i18n) : $categories[$_GET['category']]['name'];
}
if (isset($_GET['payment'])) {
@@ -264,6 +264,9 @@ $numberOfElements = 6;
<div class="filtermenu-submenu-content" id="filter-category">
<?php
foreach ($categories as $category) {
+ if ($category['name'] == "No category") {
+ $category['name'] = translate("no_category", $i18n);
+ }
$selectedClass = '';
if (isset($_GET['category']) && $_GET['category'] == $category['id']) {
$selectedClass = 'selected';