-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix.patch
More file actions
714 lines (646 loc) · 34.3 KB
/
fix.patch
File metadata and controls
714 lines (646 loc) · 34.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
diff --git a/host.php b/host.php
index 6e927a57b3f1ca792483d9f4bf36cef669eec92f..7c38daadc1018bee0d5497375e1363208b2e5efb 100644
--- a/host.php
+++ b/host.php
@@ -75,51 +75,51 @@ if (!$troubleshooterCacheResult) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph Host Explorer - <?php echo $hostdata['net_address']; ?></title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
<!-- Import Moment.js library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<!-- Import Chart.js 3 library with Moment adapter -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@3"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@1"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-annotation@1.0.2"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html"; ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5">
<div class="max-w-6xl mx-auto">
<div class="flex justify-start mt-4 mb-2 gap-2">
<a class="hover:underline cursor-pointer flex items-center font-bold text-xl" href='/host_explorer'>Top
Hosts</a>
<span class="flex items-center font-bold text-xl ">/</span>
<span class="flex items-center font-bold text-xl"><?php echo $hostdata['net_address']; ?></span>
</div>
<?php if ($troubleshootData['port_status']['ipv4_rhp4'] === false): ?>
<div class="mb-4 p-4 bg-red-400 border-l-4 border-red-500 text-red-700 rounded">
❌ Failed to connect to RHP4 via port <?php echo $assumed_rhp4_port; ?>. Make sure RHP4 is accessible before
block height 526.000.
</div>
<?php endif; ?>
<?php if (!str_starts_with($hostdata['software_version'], 'hostd v2.2')): ?>
<div class="mb-4 p-4 bg-red-400 border-l-4 border-red-500 text-red-700 rounded">
❌ Hostd v2.2.0 or newer is required for the hardfork. Make sure to update to Hostd v2.2.0 or newer before
block
height 526.000.
</div>
<?php endif; ?>
diff --git a/host_benchmarks.php b/host_benchmarks.php
index ed3f85955ba8f742e83f17fadf13b5f3c106c96f..af6bb076d7924b9ebad068eb80d81d5da3cc71d4 100644
--- a/host_benchmarks.php
+++ b/host_benchmarks.php
@@ -158,51 +158,51 @@ function fetchData($host_id, $page, $sortCriteria, $showInactive, $result, $sort
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<script src="script.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.6.0/nouislider.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html" ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5 masonry-container">
<div class="flex flex-wrap justify-start mt-4 mb-2 gap-2">
<a class="cursor-pointer hover:underline flex items-center font-bold text-xl" href='/host_explorer'>Top
Hosts</a>
<span class="flex items-center font-bold text-xl">/</span>
<a class="cursor-pointer hover:underline flex items-center font-bold text-xl"
href='/host.php?id=<?php echo $host_id; ?>'>
<?php echo $net_address; ?>
</a>
<span class="flex items-center font-bold text-xl">/</span>
<span class="flex items-center font-bold text-xl">Recent benchmarks</span>
</div>
<div class="d-flex flex-wrap mb-3 align-items-center">
<label for="nodeSelect" class="form-label me-2 mb-0">Select Node:</label>
<select id="nodeSelect" class="form-select" style="width: auto;">
<?php
// Populate dropdown options for each node group
foreach ($groupedBenchmarks as $node => $benchmarks) {
echo '<option value="' . htmlspecialchars($node) . '">' . htmlspecialchars($node) . '</option>';
diff --git a/host_explorer.php b/host_explorer.php
index 7367b654df2ee3affd7d1e553172c7051e4f0e4c..afabe75c1c14ddb8e6eb2208db18d5e57cf5a292 100644
--- a/host_explorer.php
+++ b/host_explorer.php
@@ -1,41 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<meta property="og:title" content="SiaGraph Host Explorer" />
<!--<meta property="og:description" content="A statistics website for the Sia Network." />-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="script.js"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html"; ?>
<!-- Main Content Section -->
<!-- <section id="main-content" class="container mt-4 pb-5 masonry-container">-->
<section id="main-content" class="container mt-4 pb-5 max-w-screen-xl">
<div class="flex flex-col md:flex-row justify-between mt-4 mb-2">
<a class="flex md:mr-auto items-center font-bold text-xl cursor-pointer hover:underline mb-2 sm:mb-0"
href='/host_explorer'>Top Hosts</a>
<div class="mb-2 md:ml-2 sm:mb-0 flex items-center space-x-2">
<input type="text" id="search" name="search" class="px-4 py-2 border rounded-md h-10"
placeholder="Search...">
<button class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 h-10"
onclick="handleSearch()">Search</button>
</div>
<div class="flex justify-between items-center mb-2 md:ml-2 sm:mb-0">
<label for="sort" class="mr-2">Sort hosts by:</label>
<select id="sort" class="px-4 py-2 border rounded-md h-10" onchange="handleSortChange()">
<option value="rank">Rank</option>
<option value="used_storage">Used Storage</option>
<option value="total_storage">Total Storage</option>
<option value="storage_price">Storage Price</option>
<option value="net_address">Name</option>
diff --git a/host_overview.php b/host_overview.php
index f078fe2b3177868987b93ea73feb604f040634ed..4025b20ea61cb4081f84572d31a24ba96060ef28 100644
--- a/host_overview.php
+++ b/host_overview.php
@@ -84,51 +84,51 @@ $stats3a_value = round(calculate_average_excluding_outliers($download_prices), 1
$stats3b_value = 0;
$stats4a_value = count($json_data['hosts']);
$stats4b_value = 0;
$stats5a_value = $fullHosts;
$stats5b_value = 0;
$stats6a_value = "N/A";
$stats6b_value = 0;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include_once "include/header.html" ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5 masonry-container">
<!-- Updated Additional Information Section -->
<div class="w-full break-inside-avoid">
<section id="additional-info" class="bg-light p-3 rounded-3">
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">Today's Stats</h2>
<!-- Used Storage -->
<div class="row mt-4">
<!-- Statistics Section -->
<div class="col-md-12">
<div class="row">
<!-- Average Storage Price -->
<div class="col-md-4">
<div class="p-2">
<span class="fs-6">Average Storage Price</span>
<br><span id="stats1a"
class="glanceNumber fs-4"><?php echo $stats1a_value . ' SC'; ?></span>
<span id="stats1b" class="fs-6"> (<?php echo $stats1b_value; ?>)</span>
</div>
</div>
diff --git a/host_troubleshooter.php b/host_troubleshooter.php
index a2dd6796e85aad585b60a440598b5bda4a7b3e01..e1800bcab698840898906c55378974ea8c4171d0 100644
--- a/host_troubleshooter.php
+++ b/host_troubleshooter.php
@@ -1,40 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph Host Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="script.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<?php include "include/header.html" ?>
<section id="main-content" class="container-sm mt-4 pb-5">
<!-- Search Section -->
<div class="row mb-4">
<div class="col-lg-4 d-none d-lg-block"></div>
<div class="col-lg-8">
<div class="max-w-2xl" style="width: 100%;">
<!-- Net Address Search -->
<form id="netAddressForm" class="row g-2 mb-3">
<div class="col-sm-9">
<input type="text" id="netAddressInput" class="form-control" placeholder="example.com:9982" />
</div>
<div class="col-sm-3">
<button type="submit" class="btn btn-primary w-100">Lookup</button>
</div>
</form>
<!-- Recently Searched Hosts -->
<div id="recentHosts" class="mb-5 hidden">
<div class="bg-white shadow rounded-lg p-4">
<h5 class="text-md font-semibold mb-2">Recently Searched Hosts</h5>
<ul id="recentHostList" class="list-disc pl-5 text-sm text-gray-700"></ul>
</div>
</div>
diff --git a/include/header.html b/include/header.html
index c52f18cc792338b036ce97cd71a1f01ed225e93a..ef04d43a817500d0f2859073d27806841d580f01 100644
--- a/include/header.html
+++ b/include/header.html
@@ -1,77 +1,77 @@
-<header class="bg-primary text-white">
+<header class="bg-primary text-white dark:bg-gray-800">
<div id="header-content " class="container py-1 max-w-screen-xl">
- <nav class="navbar navbar-expand-lg navbar-light bg-primary ">
+ <nav class="navbar navbar-expand-lg navbar-light bg-primary dark:bg-gray-800">
<div class="container-fluid">
<a class="navbar-brand text-white font-bold" href="/">SiaGraph</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link text-white font-medium" href="/">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white font-medium" href="#" id="navhostDropdown"
role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Network
</a>
- <div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a class="dropdown-item text-black font-medium"
+ <div class="dropdown-menu dark:bg-gray-700" aria-labelledby="navbarDropdown">
+ <a class="dropdown-item text-black dark:text-white font-medium"
href="network_growth">Growth</a>
- <div class="dropdown-divider"></div><a class="opacity-50 dropdown-item text-black font-medium"
+ <div class="dropdown-divider"></div><a class="opacity-50 dropdown-item text-black dark:text-white font-medium"
href="#">Tokenomics (TBA)</a>
- <div class="dropdown-divider"></div><a class="dropdown-item text-black font-medium"
+ <div class="dropdown-divider"></div><a class="dropdown-item text-black dark:text-white font-medium"
href="peers">Peers</a>
</div>
<li class="nav-item">
<a class="nav-link text-white opacity-50 font-medium" href="#">Renting (TBA)</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white font-medium" href="#" id="navhostDropdown"
role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Hosting
</a>
- <div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a class="dropdown-item text-black font-medium" href="host_overview">Overview</a>
- <div class="dropdown-divider"></div><a class="dropdown-item text-black font-medium" href="host_troubleshooter">Troubleshooter</a>
- <div class="dropdown-divider"></div><a class="dropdown-item text-black font-medium"
+ <div class="dropdown-menu dark:bg-gray-700" aria-labelledby="navbarDropdown">
+ <a class="dropdown-item text-black dark:text-white font-medium" href="host_overview">Overview</a>
+ <div class="dropdown-divider"></div><a class="dropdown-item text-black dark:text-white font-medium" href="host_troubleshooter">Troubleshooter</a>
+ <div class="dropdown-divider"></div><a class="dropdown-item text-black dark:text-white font-medium"
href="host_explorer">Host explorer</a>
</div>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white font-medium" href="#" id="navbarDropdown"
role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
API
</a>
- <div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a class="dropdown-item text-black font-medium" href="/swagger">SiaGraph</a>
+ <div class="dropdown-menu dark:bg-gray-700" aria-labelledby="navbarDropdown">
+ <a class="dropdown-item text-black dark:text-white font-medium" href="/swagger">SiaGraph</a>
<div class="dropdown-divider"></div>
- <a class="dropdown-item text-black font-medium" href="https://api.sia.tech/explored">Explorer</a>
+ <a class="dropdown-item text-black dark:text-white font-medium" href="https://api.sia.tech/explored">Explorer</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white font-medium" href="#" id="navbarDropdown"
role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Settings
</a>
- <div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a class="dropdown-item text-black opacity-50 font-medium" href="#"
+ <div class="dropdown-menu dark:bg-gray-700" aria-labelledby="navbarDropdown">
+ <a class="dropdown-item text-black dark:text-white opacity-50 font-medium" href="#"
onclick="switchLightDarkMode()">Switch
- Light/Dark Mode (TBA)</a>
+ Light/Dark Mode</a>
<div class="dropdown-divider"></div>
- <a class="dropdown-item text-black font-medium" href="#"
+ <a class="dropdown-item text-black dark:text-white font-medium" href="#"
onclick="switchEuroDollar()">Switch
Euro/Dollar</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
</div>
</header>
\ No newline at end of file
diff --git a/index.php b/index.php
index 696e24923e3484459c3aea175932ba0f48c9e30e..1312be499de3d406c2ce7dc303e155428bf1aa38 100644
--- a/index.php
+++ b/index.php
@@ -6,51 +6,51 @@ include_once "include/utils.php";
$recentstats = getCache($recentStatsKey);
if (isset($recentstats)) {
$recentstats = json_decode($recentstats, true);
}
$currencyCookie = isset($_COOKIE['currency']) ? $_COOKIE['currency'] : 'eur';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.6.0/nouislider.min.css" rel="stylesheet">
<script src="script.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<meta property="og:title" content="SiaGraph" />
<meta property="og:description" content="A statistics website for the Sia Network." />
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html" ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5 max-w-screen-xl">
<!-- Row for new section and additional info section -->
<div class="row">
<!-- Additional Information Section -->
<div class="col-md-6">
<section id="additional-info" class="bg-light p-3 rounded-3">
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">
Growth in the past day
</h2>
<!-- Used Storage -->
<div class="row mt-4">
<!-- Statistics Section -->
<div class="col-md-12">
<div class="row">
<!-- Used Storage -->
<div class="col-md-4">
<div class="p-2">
<span class="fs-6">Utilized Storage</span>
<br><span id="stats1a"
class="glanceNumber fs-4"><?php echo !empty($recentstats) ? formatBytes($recentstats['actual']['utilized_storage']) : 0; ?></span>
<br><span id="stats1b"
diff --git a/network_growth.php b/network_growth.php
index 58f095151c0487549e4b2f738f4b521635da8d47..14584f7af5043b5e594a71c81d030c3867707d73 100644
--- a/network_growth.php
+++ b/network_growth.php
@@ -1,48 +1,49 @@
<?php
include_once 'include/graph.php';
include_once "include/redis.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+ <script src="script.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html" ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5 max-w-screen-xl">
<!-- Row for new section and additional info section -->
<div class="row align-items-start mt-4">
<div class="col-md-6">
<section id="graph-section" class="bg-light p-3 rounded-3 ">
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">
Storage size
</h2>
<section class="graph-container">
<?php
// Define datasets with their keys and labels
renderGraph(
$canvasid = "networkstorage",
$datasets = [
[
'label' => 'Utilized Storage',
'key' => 'total_storage', // Modify based on your data
'backgroundColor' => 'rgba(75, 192, 192, 0.2)',
'borderColor' => 'rgba(75, 192, 192, 1)',
'transform' => "return entry['utilized_storage'];",
diff --git a/peers.php b/peers.php
index 698bb702f71e3867d02ec65d1376cb7641e76316..f4752c40a1f651f5fbc56448409116ed61b8bbef 100644
--- a/peers.php
+++ b/peers.php
@@ -1,59 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css">
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+ <script src="script.js"></script>
<style>
.copy-notification {
position: absolute;
background: #333;
color: #fff;
padding: 5px 10px;
border-radius: 5px;
display: none;
font-size: 0.9em;
z-index: 1000;
}
.copy-text {
cursor: pointer;
font-weight: bold;
position: relative;
}
</style>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html"; ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5">
<div class="max-w-6xl mx-auto">
<div class="grid grid-cols-1 md:grid-cols-2 flex justify-center gap-5">
<!-- Left Section -->
<div class="bg-white rounded-lg shadow-lg p-6 w-full overflow-x-auto max-w-xl">
<table id="mainnetTable" class="table-auto w-full border-collapse sm:table-fixed">
<thead>
<tr class="bg-primary text-white">
<th class="px-4 py-2">Address</th>
<th class="px-4 py-2 text-right">Protocol Version</th>
<th class="px-4 py-2 text-right">Last Scanned</th>
</tr>
</thead>
<tbody>
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">Mainnet</h2>
</tbody>
</table>
</div>
<!-- Right Section -->
<div class="bg-white rounded-lg shadow-lg p-6 w-full overflow-x-auto max-w-xl">
<table id="zenTable" class="table-auto w-full border-collapse sm:table-fixed">
<thead>
diff --git a/script.js b/script.js
index 5bb27c33b4bbbbe755b5e80028c5deb98d6cb82b..fd1bc06cd7b9e7562934eca3de239b1b3aa13143 100644
--- a/script.js
+++ b/script.js
@@ -1,92 +1,74 @@
// script.js
function displayStorageMetric(id, actualValue, changeValue) {
const actualElement = document.getElementById(id + 'a');
const changeElement = document.getElementById(id + 'b');
if (actualElement && changeElement) {
actualElement.textContent = actualValue;
changeElement.textContent = (changeValue > 0) ? ` (+${changeValue})` : ` (${changeValue})`;
} else {
console.error('Elements with id ' + id + 'a or ' + id + 'b not found.');
}
}
- function switchLightDarkMode() {
- // Check if the 'mode' cookie exists
- var modeCookie = getCookie('mode');
-
- // If the 'mode' cookie doesn't exist, set it to 'dark'
- // Otherwise, toggle between 'light' and 'dark'
- var newMode = (modeCookie === 'light') ? 'dark' : 'light';
-
- // Set the 'mode' cookie with the new value
- document.cookie = "mode=" + newMode + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
+function switchLightDarkMode() {
+ const mode = getCookie('mode');
+ const newMode = (mode === 'dark') ? 'light' : 'dark';
+ document.cookie = "mode=" + newMode + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
+ applyModeFromCookie();
+}
- // Refresh the page
- location.reload();
+function applyModeFromCookie() {
+ const mode = getCookie('mode');
+ if (mode === 'dark') {
+ document.documentElement.classList.add('dark');
+ } else {
+ document.documentElement.classList.remove('dark');
}
+}
function switchEuroDollar() {
// Check if the 'currency' cookie exists
var currencyCookie = getCookie('currency');
// If the 'currency' cookie doesn't exist, set it to 'eur'
// Otherwise, toggle between 'eur' and 'usd'
var newCurrency = (currencyCookie === 'usd' || currencyCookie === null) ? 'eur' : 'usd';
// Set the 'currency' cookie with the new value
document.cookie = "currency=" + newCurrency + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
// Refresh the page
location.reload();
}
- // Helper function to get the value of a cookie by name
- function getCookie(name) {
- var cookieArr = document.cookie.split('; ');
- for (var i = 0; i < cookieArr.length; i++) {
- var cookiePair = cookieArr[i].split('=');
- if (cookiePair[0] === name) {
- return cookiePair[1];
- }
- }
- return null;
- }
+
-// Function to apply light mode
-function applyLightMode() {
- document.getElementById("theme-style").href = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css";
- document.getElementById("header").classList.remove("bg-dark");
-}
-
-// Function to apply dark mode
-function applyDarkMode() {
- document.getElementById("theme-style").href = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.dark.min.css"; // Bootstrap dark theme
- document.getElementById("header").classList.add("bg-dark");
-}
// Function to get the value of a cookie
function getCookie(name) {
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
if (match) return match[2];
}
function getLocalizedTime(timestamp) {
// Create a new Date object from the provided UTC timestamp
const date = new Date(timestamp);
// Format the date using the local time zone (no need for manual adjustment)
const localizedTime = date.toLocaleString( {
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone, // Get the local timezone dynamically
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
});
return localizedTime;
}
+
+document.addEventListener('DOMContentLoaded', applyModeFromCookie);
diff --git a/tokenomics.php b/tokenomics.php
index a91d10988d3949804966727a23132d5fe663f0ae..5b86e3ef489463aed6ea1a56fe55329371bbe62f 100644
--- a/tokenomics.php
+++ b/tokenomics.php
@@ -1,52 +1,53 @@
<?php
/* Todo;
- add current price
-
*/
include_once 'include/graph.php';
include_once "include/redis.php";
include_once "include/utils.php";
$currencyCookie = isset($_COOKIE['currency']) ? $_COOKIE['currency'] : 'eur';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SiaGraph</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+ <script src="script.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
-<body>
+<body class="bg-white dark:bg-gray-900 text-black dark:text-white min-h-screen">
<!-- Header Section -->
<?php include "include/header.html" ?>
<!-- Main Content Section -->
<section id="main-content" class="container mt-4 pb-5">
<section id="graph-section" class="bg-light p-3 rounded-3 mt-4">
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">
Coin growth</span>
</h2>
<section class="graph-container">
<!-- Include the Chart.js graph using an iframe -->
<?php include $_SERVER['DOCUMENT_ROOT'] . "/graphs/CoinGrowthGraph.php"; ?>
<!-- Add any additional content related to the Network graph -->
</section>
</section>
<div class="col-md-6">
<section id="graph2-section" class="bg-light p-3 rounded-3">
<!-- Graph Section for Network -->
<section class="graph-container">
<h2 class="text-center fs-5 fw-bold py-2 bg-primary text-white rounded-top">
Monthly Revenue
</h2>
<?php
// Call the function with specific parameters
renderGraph(