Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
feat: cache logos for offline use
Miguel Ribeiro50bd104b5b99
diff --git a/endpoints/settings/customcss.php b/endpoints/settings/customcss.phpnew file mode 100644index 0000000..2b29858--- /dev/null+++ b/endpoints/settings/customcss.php@@ -0,0 +1,37 @@+<?php++require_once '../../includes/connect_endpoint.php';++if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {+ die(json_encode([+ "success" => false,+ "message" => translate('session_expired', $i18n)+ ]));+}++if ($_SERVER["REQUEST_METHOD"] === "POST") {+ $postData = file_get_contents("php://input");+ $data = json_decode($postData, true);++ $customCss = $data['customCss'];++ $stmt = $db->prepare('DELETE FROM custom_css_style WHERE user_id = :userId');+ $stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $stmt->execute();++ $stmt = $db->prepare('INSERT INTO custom_css_style (css, user_id) VALUES (:customCss, :userId)');+ $stmt->bindParam(':customCss', $customCss, SQLITE3_TEXT);+ $stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmt->execute()) {+ die(json_encode([+ "success" => true,+ "message" => translate("success", $i18n)+ ]));+ } else {+ die(json_encode([+ "success" => false,+ "message" => translate("error", $i18n)+ ]));+ }+}diff --git a/endpoints/settings/customtheme.php b/endpoints/settings/customtheme.phpindex 2703041..96eba70 100644--- a/endpoints/settings/customtheme.php+++ b/endpoints/settings/customtheme.php@@ -17,7 +17,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {$accent_color = $data['accentColor'];$hover_color = $data['hoverColor'];- $stmt = $db->prepare('DELETE FROM custom_colors');+ if ($main_color == $accent_color) {+ die(json_encode([+ "success" => false,+ "message" => translate("main_accent_color_error", $i18n)+ ]));+ }++ $stmt = $db->prepare('DELETE FROM custom_colors WHERE user_id = :userId');+ $stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);$stmt->execute();$stmt = $db->prepare('INSERT INTO custom_colors (main_color, accent_color, hover_color, user_id) VALUES (:main_color, :accent_color, :hover_color, :userId)');diff --git a/includes/getsettings.php b/includes/getsettings.phpindex da53100..7b35a08 100644--- a/includes/getsettings.php+++ b/includes/getsettings.php@@ -39,6 +39,15 @@ if ($customColors) {$settings['customColors'] = $customColors;}+$query = "SELECT * FROM custom_css_style WHERE user_id = :userId";+$stmt = $db->prepare($query);+$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+$customCss = $result->fetchArray(SQLITE3_ASSOC);+if ($customCss) {+ $settings['customCss'] = $customCss['css'];+}+$query = "SELECT * FROM admin";$result = $db->query($query);$adminSettings = $result->fetchArray(SQLITE3_ASSOC);diff --git a/includes/header.php b/includes/header.phpindex 5f3bbe7..d9d5c98 100644--- a/includes/header.php+++ b/includes/header.php@@ -33,8 +33,27 @@$colorTheme = $settings['color_theme'];}+ $customCss = "";+ if (isset($settings['customCss'])) {+ $customCss = $settings['customCss'];+ }+$isAdmin = $_SESSION['userId'] == 1;+ function hex2rgb($hex) {+ $hex = str_replace("#", "", $hex);+ if(strlen($hex) == 3) {+ $r = hexdec(substr($hex,0,1).substr($hex,0,1));+ $g = hexdec(substr($hex,1,1).substr($hex,1,1));+ $b = hexdec(substr($hex,2,1).substr($hex,2,1));+ } else {+ $r = hexdec(substr($hex,0,2));+ $g = hexdec(substr($hex,2,2));+ $b = hexdec(substr($hex,4,2));+ }+ return "$r, $g, $b";+ }+?><!DOCTYPE html><html dir="<?= $languages[$lang]['dir'] ?>">@@ -64,6 +83,9 @@window.lang = "<?=$lang ?>";window.colorTheme = "<?= $colorTheme ?>";</script>+ <style>+ <?= htmlspecialchars($customCss, ENT_QUOTES, 'UTF-8') ?>+ </style><?phpif (isset($settings['customColors'])) {?>@@ -71,12 +93,15 @@:root {<?php if (isset($settings['customColors']['main_color']) && !empty($settings['customColors']['main_color'])): ?>--main-color: <?= $settings['customColors']['main_color'] ?>;+ --main-color-rgb: <?= hex2rgb($settings['customColors']['main_color']) ?>;<?php endif; ?><?php if (isset($settings['customColors']['accent_color']) && !empty($settings['customColors']['accent_color'])): ?>--accent-color: <?= $settings['customColors']['accent_color'] ?>;+ --accent-color-rgb: <?= hex2rgb($settings['customColors']['accent_color']) ?>;<?php endif; ?><?php if (isset($settings['customColors']['hover_color']) && !empty($settings['customColors']['hover_color'])): ?>--hover-color: <?= $settings['customColors']['hover_color'] ?>;+ --hover-color-rgb: <?= hex2rgb($settings['customColors']['hover_color']) ?>;<?php endif; ?>}</style>diff --git a/includes/i18n/de.php b/includes/i18n/de.phpindex 34fd475..c894831 100644--- a/includes/i18n/de.php+++ b/includes/i18n/de.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Alternativ können Sie einen kostenlosen Fixer-Api-Schlüssel erhalten von","display_settings" => "Display-Einstellungen","theme_settings" => "Themen-Einstellungen",+ "colors" => "Farben","custom_colors" => "Benutzerdefinierte Farben",+ "theme" => "Thema","dark_theme" => "Dark Theme",+ "light_theme" => "Light Theme","automatic"=> "Automatisch",+ "main_color" => "Hauptfarbe",+ "accent_color" => "Akzentfarbe",+ "hover_color" => "Hover Farbe",+ "custom_css" => "Benutzerdefiniertes CSS",+ "save_custom_css" => "Benutzerdefiniertes CSS speichern",+ "save_custom_colors" => "Benutzerdefinierte Farben speichern",+ "reset_custom_colors" => "Benutzerdefinierte Farben zurücksetzen","calculate_monthly_price" => "Berechne und zeige monatlichen Preis für alle Abonnements an","convert_prices" => "Preise immer in meine Hauptwährung umrechnen und darin anzeigen (langsamer)","hide_disabled_subscriptions" => "Deaktivierte Abonnements verstecken",@@ -202,6 +212,7 @@ $i18n = ["add" => "Hinzufügen","save" => "Speichern","reset" => "Zurücksetzen",+ "main_accent_color_error" => "Haupt- und Akzentfarbe dürfen nicht identisch sein","backup_and_restore" => "Backup und Wiederherstellung","backup" => "Backup","restore" => "Wiederherstellen",diff --git a/includes/i18n/el.php b/includes/i18n/el.phpindex 8b1dd2c..7001976 100644--- a/includes/i18n/el.php+++ b/includes/i18n/el.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Εναλλακτικά, μπορείτε να λάβετε ένα δωρεάν κλειδί api fixer από το","display_settings" => "Ρυθμίσεις εμφάνισης","theme_settings" => "Ρυθμίσεις θέματος",+ "colors" => "Χρώματα","custom_colors" => "Προσαρμοσμένα χρώματα",+ "theme" => "Θέμα","dark_theme" => "Dark Theme",+ "light_theme" => "Light Theme","automatic"=> "Αυτόματο",+ "main_color" => "Κύριο χρώμα",+ "accent_color" => "Χρώμα επισήμανσης",+ "hover_color" => "Χρώμα πάνω από",+ "save_custom_colors" => "Αποθήκευση προσαρμοσμένων χρωμάτων",+ "reset_custom_colors" => "Επαναφορά προεπιλεγμένων χρωμάτων",+ "custom_css" => "Προσαρμοσμένο CSS",+ "save_custom_css" => "Αποθήκευση προσαρμοσμένου CSS","calculate_monthly_price" => "Υπολογισμός και εμφάνιση της μηνιαίας τιμής για όλες τις συνδρομές","convert_prices" => "Πάντα να μετατρέπει και να εμφανίζει τις τιμές στο κύριο νόμισμά μου (πιο αργό)","hide_disabled_subscriptions" => "Απόκρυψη απενεργοποιημένων συνδρομών",@@ -202,6 +212,7 @@ $i18n = ["add" => "Προσθήκη","save" => "Αποθήκευση","reset" => "Επαναφορά",+ "main_accent_color_error" => "Το κύριο χρώμα δεν μπορεί να είναι το ίδιο με το χρώμα επισήμανσης","backup_and_restore" => "Αντίγραφο ασφαλείας και επαναφορά","backup" => "Αντίγραφο ασφαλείας","restore" => "Επαναφορά",diff --git a/includes/i18n/en.php b/includes/i18n/en.phpindex b4619d2..5edfffb 100644--- a/includes/i18n/en.php+++ b/includes/i18n/en.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Alternatively, you can get a free fixer api key from","display_settings" => "Display Settings","theme_settings" => "Theme Settings",+ "colors" => "Colors","custom_colors" => "Custom Colors",+ "theme" => "Theme","dark_theme" => "Dark Theme",+ "light_theme" => "Light Theme","automatic"=> "Automatic",+ "main_color" => "Main Color",+ "accent_color" => "Accent Color",+ "hover_color" => "Hover Color",+ "save_custom_colors" => "Save Custom Colors",+ "reset_custom_colors" => "Reset Custom Colors",+ "custom_css" => "Custom CSS",+ "save_custom_css" => "Save Custom CSS","calculate_monthly_price" => "Calculate and show monthly price for all subscriptions","convert_prices" => "Always convert and show prices on my main currency (slower)","hide_disabled_subscriptions" => "Hide disabled subscriptions",@@ -202,6 +212,7 @@ $i18n = ["add" => "Add","save" => "Save","reset" => "Reset",+ "main_accent_color_error" => "Main and accent color can't be the same","backup_and_restore" => "Backup and Restore","backup" => "Backup","restore" => "Restore",diff --git a/includes/i18n/es.php b/includes/i18n/es.phpindex 69f8fde..c879c76 100644--- a/includes/i18n/es.php+++ b/includes/i18n/es.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "También puede obtener una clave api gratuita de Fixer en","display_settings" => "Configuración de Pantalla","theme_settings" => "Configuración de Tema",+ "colors" => "Colores","custom_collors" => "Colores Personalizados",+ "theme" => "Tema","dark_theme" => "Tema Oscuro",+ "light_theme" => "Tema Claro","automatic"=> "Automático",+ "main_color" => "Color Principal",+ "accent_color" => "Color de Acento",+ "hover_color" => "Color de Hover",+ "save_custom_colors" => "Guardar Colores Personalizados",+ "reset_custom_colors" => "Restablecer Colores Personalizados",+ "custom_css" => "CSS Personalizado",+ "save_custom_css" => "Guardar CSS Personalizado","calculate_monthly_price" => "Calcular y mostrar el precio mensual de todas las suscripciones","convert_prices" => "Convertir y mostrar siempre los precios en mi moneda principal (más lento)","hide_disabled_subscriptions" => "Ocultar suscripciones desactivadas",@@ -202,6 +212,7 @@ $i18n = ["add" => "Agregar","save" => "Guardar","reset" => "Restablecer",+ "main_accent_color_error" => "El color principal y el color de acento no pueden ser iguales","backup_and_restore" => "Copia de Seguridad y Restauración","backup" => "Copia de Seguridad","restore" => "Restaurar",diff --git a/includes/i18n/fr.php b/includes/i18n/fr.phpindex dfe7010..dade858 100644--- a/includes/i18n/fr.php+++ b/includes/i18n/fr.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Vous pouvez également obtenir une clé api de fixation gratuite auprès de","display_settings" => "Paramètres d'affichage","theme_settings" => "Paramètres de thème",+ "colors" => "Couleurs","custom_colors" => "Couleurs personnalisées",+ "theme" => "Thème","dark_theme" => "Thème sombre",+ "light_theme" => "Thème clair","automatic"=> "Automatique",+ "main_color" => "Couleur principale",+ "accent_color" => "Couleur d'accent",+ "hover_color" => "Couleur de survol",+ "save_custom_colors" => "Enregistrer les couleurs personnalisées",+ "reset_custom_colors" => "Réinitialiser les couleurs personnalisées",+ "custom_css" => "CSS personnalisé",+ "save_custom_css" => "Enregistrer le CSS personnalisé","calculate_monthly_price" => "Calculer et afficher le prix mensuel pour tous les abonnements","convert_prices" => "Convertir toujours et afficher les prix dans ma devise principale (plus lent)","hide_disabled_subscriptions" => "Masquer les abonnements désactivés",@@ -202,6 +212,7 @@ $i18n = ["add" => "Ajouter","save" => "Enregistrer","reset" => "Réinitialiser",+ "main_accent_color_error" => "La couleur principale et la couleur d'accent ne peuvent pas être identiques","backup_and_restore" => "Sauvegarde et restauration","backup" => "Sauvegarde","restore" => "Restauration",diff --git a/includes/i18n/it.php b/includes/i18n/it.phpindex eb8670f..9879b73 100644--- a/includes/i18n/it.php+++ b/includes/i18n/it.php@@ -184,9 +184,19 @@ $i18n = ['get_key_alternative' => 'In alternativa, puoi ottenere gratuitamente una chiave API di Fixer da','display_settings' => 'Impostazioni di visualizzazione',"theme_settings" => 'Impostazioni del tema',+ "colors" => 'Colori',"custom_colors" => 'Colori personalizzati',+ "theme" => 'Tema',"dark_theme" => 'Tema scuro',+ "light_theme" => 'Tema chiaro',"automatic" => "Automatico",+ "main_color" => "Colore principale",+ "accent_color" => "Colore di accento",+ "hover_color" => "Colore al passaggio del mouse",+ "save_custom_colors" => "Salva colori personalizzati",+ "reset_custom_colors" => "Ripristina colori personalizzati",+ "custom_css" => "CSS personalizzato",+ "save_custom_css" => "Salva CSS personalizzato",'calculate_monthly_price' => 'Calcola e mostra il prezzo mensile per tutti gli abbonamenti','convert_prices' => 'Converti sempre e mostra i prezzi nella mia valuta principale (più lento)',"hide_disabled_subscriptions" => 'Nascondi gli abbonamenti disattivati',@@ -210,6 +220,7 @@ $i18n = ['add' => 'Aggiungi','save' => 'Salva',"reset" => 'Ripristina',+ "main_accent_color_error" => 'Il colore principale e il colore di accento non possono essere uguali',"backup_and_restore" => 'Backup e ripristino',"backup" => 'Backup',"restore" => 'Ripristina',diff --git a/includes/i18n/jp.php b/includes/i18n/jp.phpindex 80c305a..189bd37 100644--- a/includes/i18n/jp.php+++ b/includes/i18n/jp.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "または、以下のサイトから無料のフィクサーapiキーを入手することもできます。","display_settings" => "表示設定","theme_settings" => "テーマ設定",+ "colors" => "色","custom_colors" => "カスタムカラー",+ "theme" => "テーマ","dark_theme" => "ダークテーマ",+ "light_theme" => "ライトテーマ","automatic"=> "自動",+ "main_color" => "メインカラー",+ "accent_color" => "アクセントカラー",+ "hover_color" => "ホバーカラー",+ "save_custom_colors" => "カスタムカラーを保存",+ "reset_custom_colors" => "カスタムカラーをリセット",+ "custom_css" => "カスタムCSS",+ "save_custom_css" => "カスタムCSSを保存","calculate_monthly_price" => "すべての定期購入の月額料金を計算して表示する","convert_prices" => "常にメイン通貨で価格を換算して表示する (遅い)","hide_disabled_subscriptions" => "無効な定期購入を非表示にする",@@ -202,6 +212,7 @@ $i18n = ["add" => "追加","save" => "保存","reset" => "リセット",+ "main_accent_color_error" => "メインカラーとアクセントカラーは同じにすることはできません","backup_and_restore" => "バックアップとリストア","backup" => "バックアップ","restore" => "リストア",diff --git a/includes/i18n/ko.php b/includes/i18n/ko.phpindex 994f0d6..3ec1152 100644--- a/includes/i18n/ko.php+++ b/includes/i18n/ko.php@@ -177,9 +177,19 @@ $i18n = ["get_key_alternative" => "또는 다음 사이트에서 무료 Fixer api 키를 얻을 수 있습니다.","display_settings" => "디스플레이 설정","theme_settings" => "테마 설정",+ "colors" => "색상","custom_colors" => "커스텀 색상",+ "theme" => "테마","dark_theme" => "다크 테마",+ "light_theme" => "라이트 테마","automatic"=> "자동",+ "main_color" => "메인 색상",+ "accent_color" => "강조 색상",+ "hover_color" => "마우스 호버 색상",+ "save_custom_colors" => "커스텀 색상 저장",+ "reset_custom_colors" => "커스텀 색상 리셋",+ "custom_css" => "커스텀 CSS",+ "save_custom_css" => "커스텀 CSS 저장","calculate_monthly_price" => "모든 구독에 대한 월별 요금을 계산하고 표시","convert_prices" => "항상 기본 통화로 가격을 환산하고 표시 (느림)","hide_disabled_subscriptions" => "비활성화된 구독 숨기기",@@ -203,6 +213,7 @@ $i18n = ["add" => "추가","save" => "저장","reset" => "리셋",+ "main_accent_color_error" => "메인 색상과 강조 색상은 같을 수 없습니다.","backup_and_restore" => "백업 및 복구","backup" => "백업","restore" => "복구",diff --git a/includes/i18n/pl.php b/includes/i18n/pl.phpindex 82bfcd8..bb60284 100644--- a/includes/i18n/pl.php+++ b/includes/i18n/pl.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Alternatywnie, możesz uzyskać darmowy klucz api fixer'a od","display_settings" => "Ustawienia wyświetlania","theme_settings" => "Ustawienia motywu",+ "colors" => "Kolory","custom_colors" => "Kolory niestandardowe",+ "theme" => "Motyw","dark_theme" => "Przełącz na jasny/ciemny motyw",+ "light_theme" => "Przełącz na ciemny/jasny motyw","automatic"=> "Automatycznie",+ "main_color" => "Główny kolor",+ "accent_color" => "Kolor akcentowy",+ "hover_color" => "Kolor najechania",+ "save_custom_colors" => "Zapisz niestandardowe kolory",+ "reset_custom_colors" => "Resetuj niestandardowe kolory",+ "custom_css" => "Niestandardowy CSS",+ "save_custom_css" => "Zapisz niestandardowy CSS","calculate_monthly_price" => "Oblicz i pokaż miesięczną cenę wszystkich subskrypcji","convert_prices" => "Zawsze przeliczaj i pokazuj ceny w mojej głównej walucie (wolniej)","hide_disabled_subscriptions" => "Ukryj wyłączone subskrypcje",@@ -202,6 +212,7 @@ $i18n = ["add" => "Dodaj","save" => "Zapisz","reset" => "Resetuj",+ "main_accent_color_error" => "Kolor główny i akcentowy nie mogą być takie same","backup_and_restore" => "Kopia zapasowa i przywracanie","backup" => "Kopia zapasowa","restore" => "Przywróć",diff --git a/includes/i18n/pt.php b/includes/i18n/pt.phpindex a7fb1c0..828f990 100644--- a/includes/i18n/pt.php+++ b/includes/i18n/pt.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Como alternativa obtenha a sua API Key em","display_settings" => "Definições de visualização","theme_settings" => "Definições de Tema",+ "colors" => "Cores","custom_colors" => "Cores Personalizadas",+ "theme" => "Tema","dark_theme" => "Tema Escuro",+ "light_theme" => "Tema Claro","automatic"=> "Automático",+ "main_color" => "Cor Principal",+ "accent_color" => "Cor de Destaque",+ "hover_color" => "Cor de Hover",+ "save_custom_colors" => "Guardar Cores Personalizadas",+ "reset_custom_colors" => "Repor Cores Personalizadas",+ "custom_css" => "CSS Personalizado",+ "save_custom_css" => "Guardar CSS Personalizado","calculate_monthly_price" => "Calcular e mostrar preço mensal para todas as subscrições","convert_prices" => "Converter e mostrar todas as subscrições na moeda principal (mais lento)","hide_disabled_subscriptions" => "Esconder subscrições desactivadas",@@ -202,6 +212,7 @@ $i18n = ["add" => "Adicionar","save" => "Guardar","reset" => "Repor",+ "main_accent_color_error" => "A cor principal e a cor de destaque não podem ser iguais","backup_and_restore" => "Backup e Restauro","backup" => "Backup","restore" => "Restauro",diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.phpindex 7390421..c1be7d9 100644--- a/includes/i18n/pt_br.php+++ b/includes/i18n/pt_br.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Como alternativa, você pode obter uma chave de API grátis em","display_settings" => "Configurações de visualização","theme_settings" => "Configurações de tema",+ "colors" => "Cores","custom_colors" => "Cores personalizadas",+ "theme" => "Tema","dark_theme" => "Tema Escuro",+ "light_theme" => "Tema Claro","automatic" => "Automático",+ "main_color" => "Cor principal",+ "accent_color" => "Cor de destaque",+ "hover_color" => "Cor de destaque (hover)",+ "save_custom_colors" => "Salvar Cores Personalizadas",+ "reset_custom_colors" => "Redefinir Cores Personalizadas",+ "custom_css" => "CSS Personalizado",+ "save_custom_css" => "Salvar CSS Personalizado","calculate_monthly_price" => "Calcular e exibir o custo mensal para todas as assinaturas","convert_prices" => "Sempre converter e exibir preços na moeda principal (mais lento)","hide_disabled_subscriptions" => "Ocultar assinaturas desativadas",@@ -202,6 +212,7 @@ $i18n = ["add" => "Adicionar","save" => "Salvar","reset" => "Redefinir",+ "main_accent_color_error" => "A cor principal e a cor de destaque não podem ser iguais","backup_and_restore" => "Backup e Restauração","backup" => "Backup","restore" => "Restaurar",diff --git a/includes/i18n/ru.php b/includes/i18n/ru.phpindex 0257352..4282566 100644--- a/includes/i18n/ru.php+++ b/includes/i18n/ru.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Кроме того, вы можете получить бесплатный ключ API Fixer на сайте","display_settings" => "Настройки отображения","theme_settings" => "Настройки темы",+ "colors" => "Цвета","custom_colors" => "Пользовательские цвета",+ "theme" => "Тема","dark_theme" => "Темная тема",+ "light_theme" => "Светлая тема","automatic"=> "Автоматически",+ "main_color" => "Основной цвет",+ "accent_color" => "Акцентный цвет",+ "hover_color" => "Цвет при наведении",+ "save_custom_colors" => "Сохранить пользовательские цвета",+ "reset_custom_colors" => "Сбросить пользовательские цвета",+ "custom_css" => "Пользовательский CSS",+ "save_custom_css" => "Сохранить пользовательский CSS","calculate_monthly_price" => "Рассчитать и показать ежемесячную цену для всех подписок","convert_prices" => "Всегда конвертировать и показывать цены в моей основной валюте (медленнее)","hide_disabled_subscriptions" => "Скрыть отключенные подписки",@@ -202,6 +212,7 @@ $i18n = ["add" => "Добавить","save" => "Сохранить","reset" => "Перезагрузить",+ "main_accent_color_error" => "Основной и акцентный цвет не могут быть одинаковыми.","backup_and_restore" => "Резервное копирование и восстановление","backup" => "Резервное копирование","restore" => "Восстановление",diff --git a/includes/i18n/sl.php b/includes/i18n/sl.phpindex e73224e..5672f2e 100644--- a/includes/i18n/sl.php+++ b/includes/i18n/sl.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Lahko pa tudi dobite brezplačni Fixer API od","display_settings" => "Nastavitve zaslona","theme_settings" => "Nastavitve teme",+ "colors" => "Barve","custom_colors" => "Barve po meri",+ "theme" => "Tema","dark_theme" => "Temna tema",+ "light_theme" => "Svetla tema","automatic"=> "Samodejno",+ "main_color" => "Glavna barva",+ "accent_color" => "Poudarna barva",+ "hover_color" => "Barva ob hoverju",+ "save_custom_colors" => "Shrani barve po meri",+ "reset_custom_colors" => "Ponastavi barve po meri",+ "custom_css" => "CSS po meri",+ "save_custom_css" => "Shrani CSS po meri","calculate_monthly_price" => "Izračunaj in prikaži mesečno ceno za vse naročnine","convert_prices" => "Vedno pretvori in prikaži cene v moji glavni valuti (počasneje)","hide_disabled_subscriptions" => "Skrij onemogočene naročnine",@@ -202,6 +212,7 @@ $i18n = ["add" => "Dodaj","save" => "Shrani","reset" => "Ponastavi",+ "main_accent_color_error" => "Glavna in poudarna barva se ne sme ujemati","backup_and_restore" => "Varnostno kopiranje in obnovitev","backup" => "Varnostna kopija","restore" => "Obnovitev",diff --git a/includes/i18n/sr.php b/includes/i18n/sr.phpindex fc122f7..eba5e1d 100644--- a/includes/i18n/sr.php+++ b/includes/i18n/sr.php@@ -175,9 +175,19 @@ $i18n = ["get_key_alternative" => "Алтернативно, можете добити бесплатни Fixer API кључ са","display_settings" => "Подешавања приказа","theme_settings" => "Подешавања теме",+ "colors" => "Боје","custom_colors" => "Прилагођене боје",+ "theme" => "Тема","dark_theme" => "Тамна тема",+ "light_theme" => "Светла тема","automatic"=> "Аутоматски",+ "main_color" => "Главна боја",+ "accent_color" => "Акцент боја",+ "hover_color" => "Боја приликом преласка",+ "save_custom_colors" => "Сачувај прилагођене боје",+ "reset_custom_colors" => "Ресетуј прилагођене боје",+ "custom_css" => "Прилагођени CSS",+ "save_custom_css" => "Сачувај прилагођени CSS","calculate_monthly_price" => "Израчунајте и прикажите месечну цену за све претплате","convert_prices" => "Увек конвертујте и прикажите цене на мојој главној валути (спорије)","hide_disabled_subscriptions" => "Сакриј онемогућене претплате",@@ -201,6 +211,7 @@ $i18n = ["add" => "Додај","save" => "Сачувај","reset" => "Ресетуј",+ "main_accent_color_error" => "Главна и акцент боја не могу бити исте","backup_and_restore" => "Бекап и ресторе","backup" => "Бекап","restore" => "Ресторе",diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.phpindex 35bfe40..2535d03 100644--- a/includes/i18n/sr_lat.php+++ b/includes/i18n/sr_lat.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "Alternativno, možete dobiti besplatni Fixer API ključ na","display_settings" => "Podešavanja prikaza","theme_settings" => "Podešavanja teme",+ "colors" => "Boje","custom_colors" => "Prilagođene boje",+ "theme" => "Tema","dark_theme" => "Tamna tema",+ "light_theme" => "Svetla tema","automatic"=> "Automatski",+ "main_color" => "Glavna boja",+ "accent_color" => "Akcentna boja",+ "hover_color" => "Boja prilikom prelaska",+ "save_custom_colors" => "Sačuvaj prilagođene boje",+ "reset_custom_colors" => "Resetuj prilagođene boje",+ "custom_css" => "Prilagođeni CSS",+ "save_custom_css" => "Sačuvaj prilagođeni CSS","calculate_monthly_price" => "Izračunaj i prikaži mesečnu cenu za sve pretplate","convert_prices" => "Uvek konvertuj i prikaži cene u mojoj glavnoj valuti (sporije)","hide_disabled_subscriptions" => "Sakrij onemogućene pretplate",@@ -202,6 +212,7 @@ $i18n = ["add" => "Dodaj","save" => "Sačuvaj","reset" => "Resetuj",+ "main_accent_color_error" => "Glavna i akcentna boja ne mogu biti iste","backup_and_restore" => "Backup i restore","backup" => "Backup","restore" => "Restore",diff --git a/includes/i18n/tr.php b/includes/i18n/tr.phpindex 8763f6d..bf08e2a 100644--- a/includes/i18n/tr.php+++ b/includes/i18n/tr.php@@ -176,10 +176,19 @@ $i18n = ["get_key_alternative" => "Alternatif olarak, şu adresten ücretsiz bir fixer api anahtarı edinebilirsiniz","display_settings" => "Görüntüleme Ayarları","theme_settings" => "Tema Ayarları",+ "colors" => "Renkler","custom_colors" => "Özel Renkler",+ "theme" => "Tema","dark_theme" => "Koyu Temayı",- "switch_theme" => "Açık / Koyu Temayı Değiştir",+ "light_theme" => "Açık Temayı","automatic"=> "Otomatik",+ "main_color" => "Ana",+ "accent_color" => "Vurgu",+ "hover_color" => "Üzerine gelindiğinde",+ "save_custom_colors" => "Özel Renkleri Kaydet",+ "reset_custom_colors" => "Özel Renkleri Sıfırla",+ "custom_css" => "Özel CSS",+ "save_custom_css" => "Özel CSS'yi Kaydet","calculate_monthly_price" => "Tüm aboneliklerin aylık fiyatını hesaplayın ve gösterin","convert_prices" => "Fiyatları her zaman ana para birimimde dönüştürün ve gösterin (daha yavaş)","hide_disabled_subscriptions" => "Devre dışı bırakılan abonelikleri gizle",@@ -203,6 +212,7 @@ $i18n = ["add" => "Ekle","save" => "Kaydet","reset" => "Sıfırla",+ "main_accent_color_error" => "Ana ve vurgu rengi aynı olamaz","backup_and_restore" => "Yedekle ve Geri Yükle","backup" => "Yedekle","restore" => "Geri Yükle",diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.phpindex 6ae63af..617b444 100644--- a/includes/i18n/zh_cn.php+++ b/includes/i18n/zh_cn.php@@ -184,9 +184,19 @@ $i18n = ["get_key_alternative" => "或者,您也可以从以下网站获取免费的修复程序 api 密钥","display_settings" => "显示设置","theme_settings" => "主题设置",+ "colors" => "颜色","custom_colors" => "自定义颜色",+ "theme" => "主题","dark_theme" => "深色主题",+ "light_theme" => "浅色主题","automatic"=> "自动",+ "main_color" => "主色",+ "accent_color" => "强调色",+ "hover_color" => "悬停颜色",+ "save_custom_colors" => "保存自定义颜色",+ "reset_custom_colors" => "重置自定义颜色",+ "custom_css" => "自定义 CSS",+ "save_custom_css" => "保存自定义 CSS","calculate_monthly_price" => "计算并显示所有订阅的月价格","convert_prices" => "始终按我的主要货币转换和显示价格(较慢)","hide_disabled_subscriptions" => "隐藏已停用的订阅",@@ -210,6 +220,7 @@ $i18n = ["add" => "添加","save" => "保存","reset" => "重置",+ "main_accent_color_error" => "主色和强调色不能相同","backup_and_restore" => "备份和恢复","backup" => "备份","restore" => "恢复",diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.phpindex fa97cb6..aafc3f6 100644--- a/includes/i18n/zh_tw.php+++ b/includes/i18n/zh_tw.php@@ -176,9 +176,19 @@ $i18n = ["get_key_alternative" => "或者,您可以從以下網址取得一個免費的修復 api 金鑰","display_settings" => "顯示設定","theme_settings" => "主題設定",+ "colors" => "顏色","custom_colors" => "自訂顏色",+ "theme" => "主題","dark_theme" => "深色主題",+ "light_theme" => "淺色主題","automatic"=> "自動",+ "main_color" => "主要顏色",+ "accent_color" => "強調顏色",+ "hover_color" => "懸停顏色",+ "save_custom_colors" => "儲存自訂顏色",+ "reset_custom_colors" => "重設自訂顏色",+ "custom_css" => "自訂 CSS",+ "save_custom_css" => "儲存自訂 CSS","calculate_monthly_price" => "計算並顯示所有訂閱的每月價格","convert_prices" => "始終按照我的主要貨幣單位轉換和顯示價格(較慢)","hide_disabled_subscriptions" => "隱藏已停用的訂閱",@@ -202,6 +212,7 @@ $i18n = ["add" => "新增","save" => "儲存","reset" => "重設",+ "main_accent_color_error" => "主要和強調顏色不能相同","backup_and_restore" => "備份與還原","backup" => "備份","restore" => "還原",diff --git a/includes/version.php b/includes/version.phpindex ce40197..356290f 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v2.11.2";+$version = "v2.12.0";?>\ No newline at end of filediff --git a/migrations/000023.php b/migrations/000023.phpnew file mode 100644index 0000000..c126d5a--- /dev/null+++ b/migrations/000023.php@@ -0,0 +1,12 @@+<?php++/*+* This migration adds a table to store custom css styles per user+*/++/** @noinspection PhpUndefinedVariableInspection */+$db->exec('CREATE TABLE IF NOT EXISTS custom_css_style (+ css TEXT DEFAULT "",+ user_id INTEGER,+ FOREIGN KEY (user_id) REFERENCES user(id)+)');\ No newline at end of filediff --git a/scripts/settings.js b/scripts/settings.jsindex 781ff3d..350c2ed 100644--- a/scripts/settings.js+++ b/scripts/settings.js@@ -872,98 +872,6 @@ function addFixerKeyButton() {document.getElementById("addFixerKey").disabled = false;});}--function switchTheme() {- const darkThemeCss = document.querySelector("#dark-theme");- darkThemeCss.disabled = !darkThemeCss.disabled;-- const themeChoice = darkThemeCss.disabled ? 'light' : 'dark';- document.cookie = `theme=${themeChoice}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;-- document.body.className = themeChoice;-- const button = document.getElementById("switchTheme");- button.disabled = true;-- fetch('endpoints/settings/theme.php', {- method: 'POST',- headers: {- 'Content-Type': 'application/json'- },- body: JSON.stringify({theme: themeChoice === 'dark'})- })- .then(response => response.json())- .then(data => {- if (data.success) {- showSuccessMessage(data.message);- } else {- showErrorMessage(data.errorMessage);- }- button.disabled = false;- }).catch(error => {- button.disabled = false;- });-}--function setDarkTheme(theme) {- const darkThemeRadio = document.querySelector("#theme-dark");- const lightThemeRadio = document.querySelector("#theme-light");- const automaticThemeRadio = document.querySelector("#theme-automatic");- const darkThemeCss = document.querySelector("#dark-theme");- const themes = {0: 'light', 1: 'dark', 2: 'automatic'};- const themeValue = themes[theme];- const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;-- darkThemeRadio.disabled = true;- lightThemeRadio.disabled = true;- automaticThemeRadio.disabled = true;-- fetch('endpoints/settings/theme.php', {- method: 'POST',- headers: {- 'Content-Type': 'application/json'- },- body: JSON.stringify({theme: theme})- })- .then(response => response.json())- .then(data => {- if (data.success) {- darkThemeRadio.disabled = false;- lightThemeRadio.disabled = false;- automaticThemeRadio.disabled = false;-- document.cookie = `theme=${themeValue}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;-- if (theme == 0) {- darkThemeCss.disabled = true;- document.body.className = 'light';- }-- if (theme == 1) {- darkThemeCss.disabled = false;- document.body.className = 'dark';- }-- if (theme == 2) {- darkThemeCss.disabled = !prefersDarkMode;- document.body.className = prefersDarkMode ? 'dark' : 'light';- document.cookie = `inUseTheme=${prefersDarkMode ? 'dark' : 'light'}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;- }-- showSuccessMessage(data.message);- } else {- showErrorMessage(data.errorMessage);- darkThemeRadio.disabled = false;- lightThemeRadio.disabled = false;- automaticThemeRadio.disabled = false;- }- }).catch(error => {- darkThemeRadio.disabled = false;- lightThemeRadio.disabled = false;- automaticThemeRadio.disabled = false;- });-}-function storeSettingsOnDB(endpoint, value) {fetch('endpoints/settings/' + endpoint + '.php', {method: 'POST',@@ -1046,128 +954,4 @@ var sortable = Sortable.create(el, {onEnd: function (evt) {saveCategorySorting();},-});---function setTheme(themeColor) {- var currentTheme = 'blue';- var themeIds = ['red-theme', 'green-theme', 'yellow-theme', 'purple-theme'];-- themeIds.forEach(function(id) {- var themeStylesheet = document.getElementById(id);- if (themeStylesheet && !themeStylesheet.disabled) {- currentTheme = id.replace('-theme', '');- themeStylesheet.disabled = true;- }- });-- if (themeColor !== "blue") {- var enableTheme = document.getElementById(themeColor + '-theme');- enableTheme.disabled = false;- }-- var images = document.querySelectorAll('img');- images.forEach(function(img) {- if (img.src.includes('siteicons/' + currentTheme)) {- img.src = img.src.replace(currentTheme, themeColor);- }- });-- var labels = document.querySelectorAll('.theme-preview');- labels.forEach(function(label) {- label.classList.remove('is-selected');- });-- var targetLabel = document.querySelector(`.theme-preview.${themeColor}`);- if (targetLabel) {- targetLabel.classList.add('is-selected');- }-- document.cookie = `colorTheme=${themeColor}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;-- fetch('endpoints/settings/colortheme.php', {- method: 'POST',- headers: {- 'Content-Type': 'application/json'- },- body: JSON.stringify({ color: themeColor })- })- .then(response => response.json())- .then(data => {- if (data.success) {- showSuccessMessage(data.message);- } else {- showErrorMessage(data.message);- }- })- .catch(error => {- showErrorMessage(translate('unknown_error'));- });--}--function resetCustomColors() {- const button = document.getElementById("reset-colors");- button.disabled = true;-- fetch('endpoints/settings/resettheme.php', {- method: 'DELETE',- })- .then(response => response.json())- .then(data => {- if (data.success) {- showSuccessMessage(data.message);- const custom_theme_colors = document.getElementById('custom_theme_colors');- if (custom_theme_colors) {- custom_theme_colors.remove();- }- document.documentElement.style.removeProperty('--main-color');- document.documentElement.style.removeProperty('--accent-color');- document.documentElement.style.removeProperty('--hover-color');- document.getElementById("mainColor").value = "#FFFFFF";- document.getElementById("accentColor").value = "#FFFFFF";- document.getElementById("hoverColor").value = "#FFFFFF";- } else {- showErrorMessage(data.message);- }- button.disabled = false;- })- .catch(error => {- showErrorMessage(translate('unknown_error'));- button.disabled = false;- });-}--function saveCustomColors() {- const button = document.getElementById("save-colors");- button.disabled = true;-- const mainColor = document.getElementById("mainColor").value;- const accentColor = document.getElementById("accentColor").value;- const hoverColor = document.getElementById("hoverColor").value;-- fetch('endpoints/settings/customtheme.php', {- method: 'POST',- headers: {- 'Content-Type': 'application/json'- },- body: JSON.stringify({ mainColor: mainColor, accentColor: accentColor, hoverColor: hoverColor })- })- .then(response => response.json())- .then(data => {- if (data.success) {- showSuccessMessage(data.message);- document.documentElement.style.setProperty('--main-color', mainColor);- document.documentElement.style.setProperty('--accent-color', accentColor);- document.documentElement.style.setProperty('--hover-color', hoverColor);- } else {- showErrorMessage(data.message);- }- button.disabled = false;- })- .catch(error => {- showErrorMessage(translate('unknown_error'));- button.disabled = false;- });--}\ No newline at end of file+});\ No newline at end of filediff --git a/scripts/theme.js b/scripts/theme.jsnew file mode 100644index 0000000..f267fba--- /dev/null+++ b/scripts/theme.js@@ -0,0 +1,247 @@+function switchTheme() {+ const darkThemeCss = document.querySelector("#dark-theme");+ darkThemeCss.disabled = !darkThemeCss.disabled;++ const themeChoice = darkThemeCss.disabled ? 'light' : 'dark';+ document.cookie = `theme=${themeChoice}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;++ document.body.className = themeChoice;++ const button = document.getElementById("switchTheme");+ button.disabled = true;++ fetch('endpoints/settings/theme.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ theme: themeChoice === 'dark' })+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ } else {+ showErrorMessage(data.errorMessage);+ }+ button.disabled = false;+ }).catch(error => {+ button.disabled = false;+ });+}++function setDarkTheme(theme) {+ const darkThemeButton = document.querySelector("#theme-dark");+ const lightThemeButton = document.querySelector("#theme-light");+ const automaticThemeButton = document.querySelector("#theme-automatic");+ const darkThemeCss = document.querySelector("#dark-theme");+ const themes = { 0: 'light', 1: 'dark', 2: 'automatic' };+ const themeValue = themes[theme];+ const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;++ darkThemeButton.disabled = true;+ lightThemeButton.disabled = true;+ automaticThemeButton.disabled = true;++ fetch('endpoints/settings/theme.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ theme: theme })+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ darkThemeButton.disabled = false;+ lightThemeButton.disabled = false;+ automaticThemeButton.disabled = false;+ darkThemeButton.classList.remove('selected');+ lightThemeButton.classList.remove('selected');+ automaticThemeButton.classList.remove('selected');++ document.cookie = `theme=${themeValue}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;++ if (theme == 0) {+ darkThemeCss.disabled = true;+ document.body.className = 'light';+ lightThemeButton.classList.add('selected');+ }++ if (theme == 1) {+ darkThemeCss.disabled = false;+ document.body.className = 'dark';+ darkThemeButton.classList.add('selected');+ }++ if (theme == 2) {+ darkThemeCss.disabled = !prefersDarkMode;+ document.body.className = prefersDarkMode ? 'dark' : 'light';+ automaticThemeButton.classList.add('selected');+ document.cookie = `inUseTheme=${prefersDarkMode ? 'dark' : 'light'}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;+ }++ showSuccessMessage(data.message);+ } else {+ showErrorMessage(data.errorMessage);+ darkThemeButton.disabled = false;+ lightThemeButton.disabled = false;+ automaticThemeButton.disabled = false;+ }+ }).catch(error => {+ darkThemeButton.disabled = false;+ lightThemeButton.disabled = false;+ automaticThemeButton.disabled = false;+ });+}++function setTheme(themeColor) {+ var currentTheme = 'blue';+ var themeIds = ['red-theme', 'green-theme', 'yellow-theme', 'purple-theme'];++ themeIds.forEach(function(id) {+ var themeStylesheet = document.getElementById(id);+ if (themeStylesheet && !themeStylesheet.disabled) {+ currentTheme = id.replace('-theme', '');+ themeStylesheet.disabled = true;+ }+ });++ if (themeColor !== "blue") {+ var enableTheme = document.getElementById(themeColor + '-theme');+ enableTheme.disabled = false;+ }++ var images = document.querySelectorAll('img');+ images.forEach(function(img) {+ if (img.src.includes('siteicons/' + currentTheme)) {+ img.src = img.src.replace(currentTheme, themeColor);+ }+ });++ var labels = document.querySelectorAll('.theme-preview');+ labels.forEach(function(label) {+ label.classList.remove('is-selected');+ });++ var targetLabel = document.querySelector(`.theme-preview.${themeColor}`);+ if (targetLabel) {+ targetLabel.classList.add('is-selected');+ }++ document.cookie = `colorTheme=${themeColor}; expires=Fri, 31 Dec 9999 23:59:59 GMT`;++ fetch('endpoints/settings/colortheme.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ color: themeColor })+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ });++ }++ function resetCustomColors() {+ const button = document.getElementById("reset-colors");+ button.disabled = true;++ fetch('endpoints/settings/resettheme.php', {+ method: 'DELETE',+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ const custom_theme_colors = document.getElementById('custom_theme_colors');+ if (custom_theme_colors) {+ custom_theme_colors.remove();+ }+ document.documentElement.style.removeProperty('--main-color');+ document.documentElement.style.removeProperty('--accent-color');+ document.documentElement.style.removeProperty('--hover-color');+ document.getElementById("mainColor").value = "#FFFFFF";+ document.getElementById("accentColor").value = "#FFFFFF";+ document.getElementById("hoverColor").value = "#FFFFFF";+ } else {+ showErrorMessage(data.message);+ }+ button.disabled = false;+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ button.disabled = false;+ });+ }++ function saveCustomColors() {+ const button = document.getElementById("save-colors");+ button.disabled = true;++ const mainColor = document.getElementById("mainColor").value;+ const accentColor = document.getElementById("accentColor").value;+ const hoverColor = document.getElementById("hoverColor").value;++ fetch('endpoints/settings/customtheme.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ mainColor: mainColor, accentColor: accentColor, hoverColor: hoverColor })+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ document.documentElement.style.setProperty('--main-color', mainColor);+ document.documentElement.style.setProperty('--accent-color', accentColor);+ document.documentElement.style.setProperty('--hover-color', hoverColor);+ } else {+ showErrorMessage(data.message);+ }+ button.disabled = false;+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ button.disabled = false;+ });++ }++ function saveCustomCss() {+ const button = document.getElementById("save-css");+ button.disabled = true;++ const customCss = document.getElementById("customCss").value;++ fetch('endpoints/settings/customcss.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ customCss: customCss })+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ } else {+ showErrorMessage(data.message);+ }+ button.disabled = false;+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ button.disabled = false;+ });+ }\ No newline at end of filediff --git a/service-worker.js b/service-worker.jsindex 700c903..c2ee0a3 100644--- a/service-worker.js+++ b/service-worker.js@@ -1,6 +1,6 @@-self.addEventListener('install', function(event) {+self.addEventListener('install', function (event) {event.waitUntil(- caches.open('my-cache').then(function(cache) {+ caches.open('my-cache').then(function (cache) {const urlsToCache = ['.','index.php',@@ -10,6 +10,7 @@ self.addEventListener('install', function(event) {'about.php','logout.php','login.php',+ 'admin.php','endpoints/subscriptions/get.php','manifest.json','styles/styles.css',@@ -30,6 +31,7 @@ self.addEventListener('install', function(event) {'scripts/dashboard.js','scripts/stats.js','scripts/settings.js',+ 'scripts/theme.js','scripts/notifications.js','scripts/registration.js','scripts/login.js',@@ -118,11 +120,10 @@ self.addEventListener('install', function(event) {'images/uploads/icons/venmo.png','images/uploads/icons/verifone.png','images/uploads/icons/webmoney.png',- 'images/uploads/logos/*',];- urlsToCache.forEach(function(url) {- fetch(url).then(function(response) {+ urlsToCache.forEach(function (url) {+ fetch(url).then(function (response) {if (response.ok) {cache.put(url, response);}@@ -132,9 +133,9 @@ self.addEventListener('install', function(event) {);});-self.addEventListener('fetch', function(event) {+self.addEventListener('fetch', function (event) {event.respondWith(- fetch(event.request.clone()).then(function(response) {+ fetch(event.request.clone()).then(function (response) {// Check if the response is a redirectif (response.redirected) {// If the response is a redirect, follow it by making a new fetch request@@ -143,9 +144,27 @@ self.addEventListener('fetch', function(event) {// If the response is not a redirect, return it as-isreturn response;}- }).catch(function(error) {+ }).catch(function (error) {// If fetching fails, try to retrieve the response from cachereturn caches.match(event.request, { ignoreSearch: true });}));+});++self.addEventListener('fetch', event => {+ const url = new URL(event.request.url);+ // Check if the request is for an image in the logos directory+ if (url.pathname.startsWith('/images/uploads/logos/')) {+ event.respondWith(+ caches.match(event.request).then(response => {+ return response || fetch(event.request).then(response => {+ // Open a specific cache and cache the response for future requests+ return caches.open('logos-cache').then(cache => {+ cache.put(event.request, response.clone());+ return response;+ });+ });+ })+ );+ }});\ No newline at end of filediff --git a/settings.php b/settings.phpindex e2d6b2c..e118b0d 100644--- a/settings.php+++ b/settings.php@@ -119,7 +119,8 @@ require_once 'includes/header.php';</div></div><div class="buttons">- <input type="submit" value="<?= translate('save', $i18n) ?>" id="userSubmit" class="thin" />+ <input type="submit" value="<?= translate('save', $i18n) ?>" id="userSubmit"+ class="thin mobile-grow" /></div></div></form>@@ -178,13 +179,15 @@ require_once 'includes/header.php';<?php}?>- <button class="image-button medium" onClick="editMember(<?= $member['id'] ?>)" name="save" title="<?= translate('save_member', $i18n) ?>">+ <button class="image-button medium" onClick="editMember(<?= $member['id'] ?>)" name="save"+ title="<?= translate('save_member', $i18n) ?>"><?php include "images/siteicons/svg/save.php"; ?></button><?phpif ($index !== 0) {?>- <button class="image-button medium" onClick="removeMember(<?= $member['id'] ?>)" title="<?= translate('delete_member', $i18n) ?>">+ <button class="image-button medium" onClick="removeMember(<?= $member['id'] ?>)"+ title="<?= translate('delete_member', $i18n) ?>"><?php include "images/siteicons/svg/delete.php"; ?></button><?php@@ -201,16 +204,16 @@ require_once 'includes/header.php';}?></div>+ <div class="buttons">+ <input type="submit" value="<?= translate('add', $i18n) ?>" id="addMember" onClick="addMemberButton()"+ class="thin mobile-grow" />+ </div><div class="settings-notes"><p><i class="fa-solid fa-circle-info"></i> <?= translate('household_info', $i18n) ?></p><p></div>- <div class="buttons">- <input type="submit" value="<?= translate('add', $i18n) ?>" id="addMember" onClick="addMemberButton()"- class="thin" />- </div></div></section>@@ -747,19 +750,22 @@ require_once 'includes/header.php';<div class="form-group-inline" data-categoryid="<?= $category['id'] ?>"><div class=" drag-icon"><i class="fa-solid fa-grip-vertical"></i></div><input type="text" name="category" value="<?= $category['name'] ?>" placeholder="Category">- <button class="image-button medium" onClick="editCategory(<?= $category['id'] ?>)" name="save" title="<?= translate('save_category', $i18n) ?>">+ <button class="image-button medium" onClick="editCategory(<?= $category['id'] ?>)" name="save"+ title="<?= translate('save_category', $i18n) ?>"><?php include "images/siteicons/svg/save.php"; ?></button><?phpif ($canDelete) {?>- <button class="image-button medium" onClick="removeCategory(<?= $category['id'] ?>)" title="<?= translate('delete_category', $i18n) ?>">+ <button class="image-button medium" onClick="removeCategory(<?= $category['id'] ?>)"+ title="<?= translate('delete_category', $i18n) ?>"><?php include "images/siteicons/svg/delete.php"; ?></button><?php} else {?>- <button class="image-button medium disabled" title="<?= translate('cant_delete_category_in_use', $i18n) ?>">+ <button class="image-button medium disabled"+ title="<?= translate('cant_delete_category_in_use', $i18n) ?>"><?php include "images/siteicons/svg/delete.php"; ?></button><?php@@ -773,7 +779,7 @@ require_once 'includes/header.php';</div><div class="buttons"><input type="submit" value="<?= translate('add', $i18n) ?>" id="addCategory"- onClick="addCategoryButton()" class="thin" />+ onClick="addCategoryButton()" class="thin mobile-grow" /></div></div></section>@@ -835,13 +841,15 @@ require_once 'includes/header.php';<input type="text" name="currency" value="<?= $currency['name'] ?>" placeholder="Currency Name"><input type="text" name="code" value="<?= $currency['code'] ?>" placeholder="Currency Code"<?= !$canDelete ? 'disabled' : '' ?>>- <button class="image-button medium" onClick="editCurrency(<?= $currency['id'] ?>)" name="save" title="<?= translate('save_currency', $i18n) ?>">+ <button class="image-button medium" onClick="editCurrency(<?= $currency['id'] ?>)" name="save"+ title="<?= translate('save_currency', $i18n) ?>"><?php include "images/siteicons/svg/save.php"; ?></button><?phpif ($canDelete) {?>- <button class="image-button medium" onClick="removeCurrency(<?= $currency['id'] ?>)" title="<?= translate('delete_currency', $i18n) ?>">+ <button class="image-button medium" onClick="removeCurrency(<?= $currency['id'] ?>)"+ title="<?= translate('delete_currency', $i18n) ?>"><?php include "images/siteicons/svg/delete.php"; ?></button><?php@@ -862,7 +870,7 @@ require_once 'includes/header.php';</div><div class="buttons"><input type="submit" value="<?= translate('add', $i18n) ?>" id="addCurrency"- onClick="addCurrencyButton()" class="thin" />+ onClick="addCurrencyButton()" class="thin mobile-grow" /></div><div class="settings-notes"><p>@@ -946,7 +954,7 @@ require_once 'includes/header.php';</div><div class="buttons"><input type="submit" value="<?= translate('save', $i18n) ?>" id="addFixerKey"- onClick="addFixerKeyButton()" class="thin" />+ onClick="addFixerKeyButton()" class="thin mobile-grow" /></div></div></section>@@ -1058,101 +1066,125 @@ require_once 'includes/header.php';<h2><?= translate('theme_settings', $i18n) ?></h2></header><div class="account-settings-theme">+ <div>+ <h3><?= translate('theme', $i18n) ?></h3>+ <div class="form-group-inline wrap">+ <button type="button"+ class="dark-theme-button capitalize <?= $settings['dark_theme'] == '0' ? 'selected' : '' ?>"+ onClick="setDarkTheme('0')" id="theme-light">+ <i class="fa-solid fa-sun"></i> <?= translate('light_theme', $i18n) ?>+ </button>+ <button type="button"+ class="dark-theme-button capitalize <?= $settings['dark_theme'] == '1' ? 'selected' : '' ?>"+ onClick="setDarkTheme('1')" id="theme-dark">+ <i class="fa-solid fa-moon"></i> <?= translate('dark_theme', $i18n) ?>+ </button>+ <button type="button"+ class="dark-theme-button capitalize <?= $settings['dark_theme'] == '2' ? 'selected' : '' ?>"+ onClick="setDarkTheme('2')" id="theme-automatic">+ <i class="fa-solid fa-circle-half-stroke"></i> <?= translate('automatic', $i18n) ?>+ </button>+ </div>+ </div><div><form class="theme-selector">- <div class="theme">- <label for="theme-blue"- class="theme-preview blue <?= $settings['color_theme'] == 'blue' ? 'is-selected' : '' ?>">- <input type="radio" name="theme" id="theme-blue" value="blue" onClick="setTheme('blue')"- <?= $settings['color_theme'] == 'blue' ? 'checked' : '' ?>>- <span class="main-color"></span>- <span class="accent-color"></span>- <span class="hover-color"></span>- </label>- </div>- <div class="theme">- <label for="theme-green"- class="theme-preview green <?= $settings['color_theme'] == 'green' ? 'is-selected' : '' ?>">- <input type="radio" name="theme" id="theme-green" value="green" onClick="setTheme('green')"- <?= $settings['color_theme'] == 'green' ? 'checked' : '' ?>>- <span class="main-color"></span>- <span class="accent-color"></span>- <span class="hover-color"></span>- </label>- </div>- <div class="theme">- <label for="theme-red"- class="theme-preview red <?= $settings['color_theme'] == 'red' ? 'is-selected' : '' ?>">- <input type="radio" name="theme" id="theme-red" value="red" onClick="setTheme('red')"- <?= $settings['color_theme'] == 'red' ? 'checked' : '' ?>>- <span class="main-color"></span>- <span class="accent-color"></span>- <span class="hover-color"></span>- </label>- </div>- <div class="theme">- <label for="theme-yellow"- class="theme-preview yellow <?= $settings['color_theme'] == 'yellow' ? 'is-selected' : '' ?>">- <input type="radio" name="theme" id="theme-yellow" value="yellow"- onClick="setTheme('yellow')" <?= $settings['color_theme'] == 'yellow' ? 'checked' : '' ?>>- <span class="main-color"></span>- <span class="accent-color"></span>- <span class="hover-color"></span>- </label>- </div>- <div class="theme">- <label for="theme-purple"- class="theme-preview purple <?= $settings['color_theme'] == 'purple' ? 'is-selected' : '' ?>">- <input type="radio" name="theme" id="theme-purple" value="purple"- onClick="setTheme('purple')" <?= $settings['color_theme'] == 'purple' ? 'checked' : '' ?>>- <span class="main-color"></span>- <span class="accent-color"></span>- <span class="hover-color"></span>- </label>+ <h3><?= translate('colors', $i18n) ?></h3>+ <div class="form-group-inline wrap">+ <div class="theme">+ <label for="theme-blue"+ class="theme-preview blue <?= $settings['color_theme'] == 'blue' ? 'is-selected' : '' ?>">+ <input type="radio" name="theme" id="theme-blue" value="blue" onClick="setTheme('blue')"+ <?= $settings['color_theme'] == 'blue' ? 'checked' : '' ?>>+ <span class="main-color"></span>+ <span class="accent-color"></span>+ <span class="hover-color"></span>+ </label>+ </div>+ <div class="theme">+ <label for="theme-green"+ class="theme-preview green <?= $settings['color_theme'] == 'green' ? 'is-selected' : '' ?>">+ <input type="radio" name="theme" id="theme-green" value="green"+ onClick="setTheme('green')" <?= $settings['color_theme'] == 'green' ? 'checked' : '' ?>>+ <span class="main-color"></span>+ <span class="accent-color"></span>+ <span class="hover-color"></span>+ </label>+ </div>+ <div class="theme">+ <label for="theme-red"+ class="theme-preview red <?= $settings['color_theme'] == 'red' ? 'is-selected' : '' ?>">+ <input type="radio" name="theme" id="theme-red" value="red" onClick="setTheme('red')"+ <?= $settings['color_theme'] == 'red' ? 'checked' : '' ?>>+ <span class="main-color"></span>+ <span class="accent-color"></span>+ <span class="hover-color"></span>+ </label>+ </div>+ <div class="theme">+ <label for="theme-yellow"+ class="theme-preview yellow <?= $settings['color_theme'] == 'yellow' ? 'is-selected' : '' ?>">+ <input type="radio" name="theme" id="theme-yellow" value="yellow"+ onClick="setTheme('yellow')" <?= $settings['color_theme'] == 'yellow' ? 'checked' : '' ?>>+ <span class="main-color"></span>+ <span class="accent-color"></span>+ <span class="hover-color"></span>+ </label>+ </div>+ <div class="theme">+ <label for="theme-purple"+ class="theme-preview purple <?= $settings['color_theme'] == 'purple' ? 'is-selected' : '' ?>">+ <input type="radio" name="theme" id="theme-purple" value="purple"+ onClick="setTheme('purple')" <?= $settings['color_theme'] == 'purple' ? 'checked' : '' ?>>+ <span class="main-color"></span>+ <span class="accent-color"></span>+ <span class="hover-color"></span>+ </label>+ </div></div></form></div><div>- <h2><?= translate('custom_colors', $i18n) ?></h2>- <div class="form-group-inline wrap">- <div class="color-picker-wrapper wrap">+ <h3><?= translate('custom_colors', $i18n) ?></h3>+ <div class="custom-colors wrap">+ <div class="form-group-inline mobile-grow"><input type="color" id="mainColor" name="mainColor"value="<?= isset($settings['customColors']['main_color']) ? $settings['customColors']['main_color'] : '#FFFFFF' ?>"class="color-picker fa-solid fa-eye-dropper">+ <label for="mainColor"><?= translate('main_color', $i18n) ?></label>+ </div>+ <div class="form-group-inline mobile-grow"><input type="color" id="accentColor" name="accentColor"value="<?= isset($settings['customColors']['accent_color']) ? $settings['customColors']['accent_color'] : '#FFFFFF' ?>"class="color-picker fa-solid fa-eye-dropper">+ <label for="accentColor"><?= translate('accent_color', $i18n) ?></label>+ </div>+ <div class="form-group-inline mobile-grow"><input type="color" id="hoverColor" name="hoverColor"value="<?= isset($settings['customColors']['hover_color']) ? $settings['customColors']['hover_color'] : '#FFFFFF' ?>"class="color-picker fa-solid fa-eye-dropper">+ <label for="hoverColor"><?= translate('hover_color', $i18n) ?></label></div>- <div class="color-picker-wrapper wrap">- <input type="button" value="<?= translate('reset', $i18n) ?>" onClick="resetCustomColors()"- class="secondary-button thin" id="reset-colors">- <input type="button" value="<?= translate('save', $i18n) ?>" onClick="saveCustomColors()"- class="buton thin" id="save-colors">- </div>+ </div>+ <div class="custom-colors wrap">+ <input type="button" value="<?= translate('reset_custom_colors', $i18n) ?>"+ onClick="resetCustomColors()" class="secondary-button thin mobile-grow" id="reset-colors">+ <input type="button" value="<?= translate('save_custom_colors', $i18n) ?>"+ onClick="saveCustomColors()" class="buton thin mobile-grow" id="save-colors"></div></div>- <h2><?= translate('dark_theme', $i18n) ?></h2>- <div class="form-group-inline">- <label for="theme-light" class="capitalize">- <input type="radio" name="theme" id="theme-light" value="light" onClick="setDarkTheme('0')"- <?= $settings['dark_theme'] == '0' ? 'checked' : '' ?>>- <?= translate('disabled', $i18n) ?>- </label>- <label for="theme-dark" class="capitalize">- <input type="radio" name="theme" id="theme-dark" value="dark" onClick="setDarkTheme('1')"- <?= $settings['dark_theme'] == '1' ? 'checked' : '' ?>>- <?= translate('enabled', $i18n) ?>- </label>- <label for="theme-automatic" class="capitalize">- <input type="radio" name="theme" id="theme-automatic" value="automatic" onClick="setDarkTheme('2')"- <?= $settings['dark_theme'] == '2' ? 'checked' : '' ?>>- <?= translate('automatic', $i18n) ?>- </label>+ <div>+ <h3><?= translate('custom_css', $i18n) ?></h3>+ <div class="form-group">+ <div class="form-group-inline">+ <textarea name="customCss" id="customCss" placeholder="<?= translate('custom_css', $i18n) ?>"+ class="thin"><?= $settings['customCss'] ?? "" ?></textarea>+ </div>+ <div class="form-group-inline">+ <input type="button" value="<?= translate('save_custom_css', $i18n) ?>"+ onClick="saveCustomCss()" class="buton thin mobile-grow" id="save-css">+ </div>+ </div></div>- </div></section><section class="account-section">@@ -1209,6 +1241,7 @@ require_once 'includes/header.php';</section><script src="scripts/settings.js?<?= $version ?>"></script>+<script src="scripts/theme.js?<?= $version ?>"></script><script src="scripts/notifications.js?<?= $version ?>"></script><?phpdiff --git a/styles/dark-theme.css b/styles/dark-theme.cssindex 2ce4d0c..b2675bd 100644--- a/styles/dark-theme.css+++ b/styles/dark-theme.css@@ -204,3 +204,7 @@ textarea {.calendar .calendar-body .calendar-cell {border-right: 1px solid #111;}++button.dark-theme-button {+ color: #E0E0E0;+}diff --git a/styles/styles.css b/styles/styles.cssindex 53b7bd9..80e833f 100644--- a/styles/styles.css+++ b/styles/styles.css@@ -569,6 +569,10 @@ main > .contain {margin-bottom: 0px;}+.account-section .account-settings-theme h3 {+ margin-bottom: 24px;+}+.user-form {display: flex;flex-direction: column;@@ -1090,12 +1094,15 @@ input[type="button"].warning-button {border-color: #f45a40;}-input[type="button"].warning-button:hover {+input[type="button"].warning-button:hover,+button.button.warning-button:hover {background-color: #ef8674;border-color: #ef8674;}-input[type="submit"]:hover {+input[type="submit"]:hover,+input[type="button"]:hover,+button.button:hover {background-color: var(--hover-color);border-color: var(--hover-color);}@@ -1235,6 +1242,33 @@ textarea.thin {text-transform: capitalize;}+button.dark-theme-button {+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: center;+ font-size: 18px !important;+ border: 1px solid #ccc;+ border-radius: 8px;+ padding: 16px 20px 14px;+ background-color: transparent;+ color: #202020;+ cursor: pointer;+ flex-grow: 1;+}++button.dark-theme-button:hover {+ background-color: rgba(var(--accent-color-rgb), 0.6)+}++button.dark-theme-button.selected {+ border: 1px solid var(--main-color);+}++button.dark-theme-button i {+ margin-right: 12px;+}+.error {display: block;color: #f45a40;@@ -1640,7 +1674,7 @@ textarea.thin {.statistic > span {font-size: 42px;- color: var(--hover-color);+ color: var(--main-color);}.statistic > .title {@@ -1856,12 +1890,8 @@ textarea.thin {/* Theme Selector */-.theme-selector {- display: flex;- flex-direction: row;- gap: 10px;- align-items: center;- flex-wrap: wrap;+.theme {+ flex-grow: 1;}.theme-preview {@@ -1952,11 +1982,10 @@ textarea.thin {background-color: #5e42cd;}-.color-picker-wrapper {+.custom-colors {display: flex;flex-direction: row;- gap: 16px;-+ gap: 12px;}.color-picker {@@ -2149,6 +2178,12 @@ textarea.thin {max-width: 135px;}-.capitalize {- text-transform: capitalize;-}\ No newline at end of file+.grow {+ flex-grow: 1;+}++@media (max-width: 768px) {+ .mobile-grow {+ flex-grow: 1;+ }+}