This commit is contained in:
Miguel Ribeiro
2025-06-09 13:51:33 +02:00
committed by GitHub
parent 7dcab56ce2
commit a25eb0b39e
15 changed files with 96 additions and 27 deletions

View File

@@ -23,6 +23,10 @@ COPY . .
COPY nginx.conf /etc/nginx/nginx.conf
COPY nginx.default.conf /etc/nginx/http.d/default.conf
# Remove nginx conf files from webroot
RUN rm -rf /var/www/html/nginx.conf && \
rm -rf /var/www/html/nginx.default.conf
# Copy the custom crontab file
COPY cronjobs /etc/cron.d/cronjobs

View File

@@ -13,6 +13,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$postData = file_get_contents("php://input");
$data = json_decode($postData, true);
// Valiudate input, should be a color from the allowed list
$allowedColors = ['blue', 'red', 'green', 'yellow', 'purple'];
if (!isset($data['color']) || !in_array($data['color'], $allowedColors)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$color = $data['color'];
$stmt = $db->prepare('UPDATE settings SET color_theme = :color WHERE user_id = :userId');

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$convert_currency = $data['value'];
// Validate input
if (!isset($convert_currency) || !is_bool($convert_currency)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET convert_currency = :convert_currency WHERE user_id = :userId');
$stmt->bindParam(':convert_currency', $convert_currency, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -17,6 +17,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$accent_color = $data['accentColor'];
$hover_color = $data['hoverColor'];
// Validate input, should be a color in #RRGGBB format
if (!preg_match('/^#[0-9A-Fa-f]{6}$/', $main_color) || !preg_match('/^#[0-9A-Fa-f]{6}$/', $accent_color) || !preg_match('/^#[0-9A-Fa-f]{6}$/', $hover_color)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
if ($main_color == $accent_color) {
die(json_encode([
"success" => false,

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$disabled_to_bottom = $data['value'];
// Validate input
if (!isset($disabled_to_bottom) || !is_bool($disabled_to_bottom)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET disabled_to_bottom = :disabled_to_bottom WHERE user_id = :userId');
$stmt->bindParam(':disabled_to_bottom', $disabled_to_bottom, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$hide_disabled = $data['value'];
// Validate input
if (!isset($hide_disabled) || !is_bool($hide_disabled)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET hide_disabled = :hide_disabled WHERE user_id = :userId');
$stmt->bindParam(':hide_disabled', $hide_disabled, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -15,6 +15,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$mobile_nav = $data['value'];
// Validate input
if (!isset($mobile_nav) || !is_bool($mobile_nav)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET mobile_nav = :mobile_nav WHERE user_id = :userId');
$stmt->bindParam(':mobile_nav', $mobile_nav, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$monthly_price = $data['value'];
// Validate input
if (!isset($monthly_price) || !is_bool($monthly_price)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET monthly_price = :monthly_price WHERE user_id = :userId');
$stmt->bindParam(':monthly_price', $monthly_price, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$remove_background = $data['value'];
// Validate input
if (!isset($remove_background) || !is_bool($remove_background)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET remove_background = :remove_background WHERE user_id = :userId');
$stmt->bindParam(':remove_background', $remove_background, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$show_original_price = $data['value'];
// Validate input
if (!isset($show_original_price) || !is_bool($show_original_price)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET show_original_price = :show_original_price WHERE user_id = :userId');
$stmt->bindParam(':show_original_price', $show_original_price, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -14,6 +14,14 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$show_subscription_progress = $data['value'];
// Validate input
if (!isset($show_subscription_progress) || !is_bool($show_subscription_progress)) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET show_subscription_progress = :show_subscription_progress WHERE user_id = :userId');
$stmt->bindParam(':show_subscription_progress', $show_subscription_progress, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

View File

@@ -12,7 +12,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$postData = file_get_contents("php://input");
$data = json_decode($postData, true);
$theme = $data['theme'];
$theme = (int)$data['theme'];
// Validate input, should be an integer (0, 1 or 2)
if (!isset($theme) || !is_int($theme) || $theme < 0 || $theme > 2) {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
$stmt = $db->prepare('UPDATE settings SET dark_theme = :theme WHERE user_id = :userId');
$stmt->bindParam(':theme', $theme, SQLITE3_INTEGER);

View File

@@ -1,3 +1,3 @@
<?php
$version = "v3.2.0";
$version = "v3.2.1";
?>

View File

@@ -387,14 +387,10 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
<label for="start_date"><?= translate('start_date', $i18n) ?></label>
<input type="date" id="start_date" name="start_date">
</div>
<button type="button" id="autofill-next-payment-button" class="button secondary-button autofill-next-payment hideOnMobile"
title="<?= translate('calculate_next_payment_date', $i18n) ?>" onClick="autoFillNextPaymentDate(event)">
<i class="fa-solid fa-wand-magic-sparkles"></i>
</button>
<div class="split50">
<label for="next_payment" class="split-label">
<?= translate('next_payment', $i18n) ?>
<div id="autofill-next-payment-button" class="autofill-next-payment hideOnDesktop"
<div id="autofill-next-payment-button" class="autofill-next-payment"
title="<?= translate('calculate_next_payment_date', $i18n) ?>" onClick="autoFillNextPaymentDate(event)">
<i class="fa-solid fa-wand-magic-sparkles"></i>
</div>

View File

@@ -2838,27 +2838,7 @@ input[type="radio"]:checked+label::after {
}
}
.button.autofill-next-payment {
padding: 15px 15px !important;
margin-top: 22px;
}
.autofill-next-payment {
color: var(--main-color);
cursor: pointer;
}
.autofill-next-payment.hideOnDesktop {
display: none;
}
@media (max-width: 768px) {
.button.autofill-next-payment.hideOnMobile {
display: none !important;
}
.autofill-next-payment.hideOnDesktop {
display: block;
}
}