From c6a402927dde12009a2e324b7db18c1a2fbe18f6 Mon Sep 17 00:00:00 2001
From: recanman <29310982+recanman@users.noreply.github.com>
Date: Sat, 5 Oct 2024 00:00:17 -0700
Subject: [PATCH 1/3] refactor: replace require with require_once, remove
unneeded semicolon
---
index.php | 4 ++--
templates/index.php | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/index.php b/index.php
index 27dc946..7ba03be 100644
--- a/index.php
+++ b/index.php
@@ -20,7 +20,7 @@ $api_cg = json_decode(file_get_contents('coingecko.json'), true);
// Configuration file
$config = [];
if (file_exists('config.php')) {
- $config = require 'config.php';
+ $config = require_once 'config.php';
}
$display_servers_guru = isset($config['servers_guru']) && $config['servers_guru'] === true;
@@ -106,5 +106,5 @@ foreach (array_reverse($preferred_currencies) as $currency) {
}
// Output the HTML
-require 'templates/index.php';
+require_once 'templates/index.php';
?>
diff --git a/templates/index.php b/templates/index.php
index c7c8575..1e4cd0b 100644
--- a/templates/index.php
+++ b/templates/index.php
@@ -121,7 +121,7 @@
From ce610fbea5471bf1b199f5663f4b59052f662709 Mon Sep 17 00:00:00 2001
From: recanman <29310982+recanman@users.noreply.github.com>
Date: Sat, 5 Oct 2024 00:01:41 -0700
Subject: [PATCH 2/3] feat: make config clear and add fetch interval config
---
src/js/main.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/js/main.js b/src/js/main.js
index 9f99bd2..67758ad 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -3,6 +3,14 @@ import '../css/custom.css';
import Tooltip from 'bootstrap/js/dist/tooltip';
+/////
+let inactivityTimeout = 30; // in seconds
+let fetchInterval = 30; // in seconds
+/////
+
+inactivityTimeout = inactivityTimeout * 1000;
+fetchInterval = fetchInterval * 1000;
+
const tooltipTriggerList = Array.from(document.querySelectorAll('[data-toggle="tooltip"]'));
const tooltipList = tooltipTriggerList.map(tooltipTriggerEl => new Tooltip(tooltipTriggerEl, { placement: 'top' }));
console.log(tooltipList);
@@ -14,13 +22,12 @@ const runConvert = () =>
lastModifiedField === 'xmr' ? xmrConvert() : fiatConvert();
let updateInterval
-const startFetching = () => updateInterval = setInterval(fetchUpdatedExchangeRates, 5000);
+const startFetching = () => updateInterval = setInterval(fetchUpdatedExchangeRates, fetchInterval);
const stopFetching = () => {
clearInterval(updateInterval)
updateInterval = null;
};
-const inactivityTimeout = 30 * 1000; // 30 seconds
let lastActivity = Date.now()
const resetActivity = () => lastActivity = Date.now()
From 3118dcebab673bae09fb890ad5e609e5058eb749 Mon Sep 17 00:00:00 2001
From: recanman <29310982+recanman@users.noreply.github.com>
Date: Sat, 5 Oct 2024 00:36:52 -0700
Subject: [PATCH 3/3] feat: add donation qr css
---
src/css/custom.css | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/css/custom.css b/src/css/custom.css
index 702ad95..6fda3a8 100644
--- a/src/css/custom.css
+++ b/src/css/custom.css
@@ -122,6 +122,18 @@ p {
.btn {
min-width: 38px;
}
+
+ #donation-qr {
+ width: auto;
+ height: 80vh;
+ max-width: 600px;
+ max-height: 600px;
+ }
+
+ #donation-qr-container {
+ height: auto;
+ padding: 20px;
+ }
}
.bs-tooltip-auto {
@@ -136,4 +148,20 @@ p {
top: -1px;
border-width: 0.4rem 0.4rem 0;
border-top-color: #000;
+}
+
+#donation-qr-container {
+ display: none;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+}
+
+#donation-qr {
+ width: 100%;
+ height: auto;
+}
+
+#donation-qr-toggle:checked ~ #donation-qr-container {
+ display: flex;
}
\ No newline at end of file