small changes e2bea64f
Steve · 2024-08-25 19:28 3 file(s) · +7 −3
index.html +4 −0
66 66
             align-items: center;
67 67
          	gap: 0.5rem;
68 68
         }
69 +
         .source-link {
70 +
             padding-top: 2rem;
71 +
         }
69 72
         p {
70 73
         	padding: 0;
71 74
          	margin: 0;
129 132
          Memory: <span id="memoryUsed">-</span>/<span id="memoryTotal">-</span>
130 133
        </p>
131 134
      </div>
135 +
      <a class="source-link" href="http://github.com/stevedylandev/pi-widget" target="_blank">Source Code</a>
132 136
    </div>
133 137
    <script>
134 138
      function formatBytes(bytes, decimals = 2) {
main.go +1 −1
194 194
		MemoryTotal: v.Total,
195 195
		OS:          "Debian GNU/Linux 12 (bookworm) aarch64",
196 196
		Kernel:      hostInfo.KernelVersion,
197 -
		Uptime:      formatUptime(uptime),
197 +
		Uptime:      FormatUptime(uptime),
198 198
		CPUModel:    "BCM2835 (4) @ 1.800GHz",
199 199
	}, nil
200 200
}
utils.go +2 −2
6 6
	"time"
7 7
)
8 8
9 -
func formatBytes(bytes int64) string {
9 +
func FormatBytes(bytes int64) string {
10 10
	const unit = 1024
11 11
	if bytes < unit {
12 12
		return fmt.Sprintf("%d B", bytes)
19 19
	return fmt.Sprintf("%.1f %ciB", float64(bytes)/float64(div), "KMGTPE"[exp])
20 20
}
21 21
22 -
func formatUptime(uptime time.Duration) string {
22 +
func FormatUptime(uptime time.Duration) string {
23 23
	days := int(uptime.Hours() / 24)
24 24
	hours := int(uptime.Hours()) % 24
25 25
	minutes := int(uptime.Minutes()) % 60