Skip to content

Commit

Permalink
v1.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
plutobell committed Mar 31, 2021
1 parent 7840893 commit 19ed9a7
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 23 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@

command.md
rice-box.go
dashboard.min.js
build/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog #

**2021-03-31**

* v1.0.10 :
* Fix the bug of panic caused by empty device model information #1
* Fix the bug of not finding dashboard.min.js #2
* Fix the bug of invalid hostname command on arch
* Adds golang version display on view

**2020-8-14**

* v1.0.9 :
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# @Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
# @Description: Golang implementation of pi-dashboard
# @Author: github.com/plutobell
# @Creation: 2020-8-10
# @Last modify: 2020-9-7
# @Version: 1.0.9
# @Creation: 2020-08-10
# @Last modify: 2021-03-31
# @Version: 1.0.10

PROGRAM = pi-dashboard-go
OUTPUT = build
Expand Down
6 changes: 3 additions & 3 deletions assets/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
// @Description: Golang implementation of pi-dashboard
// @Author: github.com/plutobell
// @Creation: 2020-8-1
// @Last modify: 2020-8-14
// @Version: 1.0.9
// @Creation: 2020-08-01
// @Last modify: 2021-03-31
// @Version: 1.0.10

window.oncontextmenu=function(){return false;}
window.onkeydown = window.onkeyup = window.onkeypress = function () {
Expand Down
10 changes: 5 additions & 5 deletions assets/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
<div class="col-md-12">
<div id="footer">
<hr style="margin: 20px 0 10px 0;" />
<p class="pull-left" style="font-size: 12px;">Powered by <a target="_blank" href="https://ojoll.com/archives/86/" style="color:#D6264F;"><strong>Pi Dashboard Go</strong></a> v{{.version}}, <a target="_blank" href="https://ojoll.com" style="color:#D6264F;">北及</a> all rights reserved.
<p class="pull-left" style="font-size: 12px;">Powered by <a target="_blank" href="https://ojoll.com/archives/86/" style="color:#D6264F;"><strong>Pi Dashboard Go</strong></a> v{{.version}}, <a target="_blank" href="https://ojoll.com" style="color:#D6264F;">北及</a> all rights reserved. <span style="color:#eaece5;";">{{.go_version}}</span>
</p>
</div>
</div>
Expand All @@ -382,13 +382,13 @@
<div class="rect5"></div>
</div>
</div>
<script src="assets/dashboard.min.js"></script>
<script src="assets/dashboard.js"></script>
<!--
@Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
@Description: Golang implementation of pi-dashboard
@Author: github.com/plutobell
@Creation: 2020-8-1
@Last modify: 2020-8-14
@Version: 1.0.9 -->
@Creation: 2020-08-01
@Last modify: 2021-03-31
@Version: 1.0.10 -->
</body>
</html>
12 changes: 8 additions & 4 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// @Description: Golang implementation of pi-dashboard
// @Author: github.com/plutobell
// @Creation: 2020-08-01
// @Last modify: 2021-03-15
// @Version: 1.0.9
// @Last modify: 2021-03-31
// @Version: 1.0.10

package main

Expand Down Expand Up @@ -66,7 +66,7 @@ func Device() map[string]string {
"arch": "arch",
"uname": "uname -a",
"cpu_revision": "cat /proc/cpuinfo | grep Revision | awk '{ print $3}'",
"model": "cat /proc/cpuinfo | grep Model",
"model": "cat /proc/cpuinfo | grep -i Model |sort -u |head -1",
"cpu_model_name": "lscpu | grep 'Model name' | awk '{ print $3}'",
"cpu_cores": "lscpu | grep 'CPU(s):' | awk '{ print $2}'",
"cpu_status": "top -bn1 | grep -w '%Cpu(s):' | awk '{ print $2,$4,$6,$8,$10,$12,$14,$16}'",
Expand Down Expand Up @@ -111,7 +111,11 @@ func Device() map[string]string {
device["system"] = strings.Replace(strings.Replace(strings.Split(device["system"], "\"")[1], " GNU/Linux ", " ", -1), "\"", "", -1)
if arch == "arm" {
device["cpu_temperature"] = strconv.FormatFloat(float64(cpuTemperature)/1000, 'f', 1, 64)
device["model"] = strings.Split(device["model"], ":")[1]
if strings.Contains(device["model"], ":") {
device["model"] = strings.Split(device["model"], ":")[1]
} else {
device["model"] = ""
}
} else {
device["cpu_temperature"] = "NaN"
device["model"] = "Linux Computer"
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
// @Description: Golang implementation of pi-dashboard
// @Author: github.com/plutobell
// @Creation: 2020-8-1
// @Last modify: 2020-8-14
// @Version: 1.0.9
// @Creation: 2020-08-01
// @Last modify: 2021-03-31
// @Version: 1.0.10

package main

Expand All @@ -19,7 +19,7 @@ const (
//AUTHOR 作者信息
AUTHOR string = "github:plutobell"
//VERSION 版本信息
VERSION string = "1.0.9"
VERSION string = "1.0.10"
//USERNAME 默认用户
USERNAME string = "pi"
//PASSWORD 默认密码
Expand Down
8 changes: 5 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
// @Description: Golang implementation of pi-dashboard
// @Author: github.com/plutobell
// @Creation: 2020-8-1
// @Last modify: 2020-8-14
// @Version: 1.0.9
// @Creation: 2020-08-01
// @Last modify: 2021-03-31
// @Version: 1.0.10

package main

Expand All @@ -13,6 +13,7 @@ import (
"io"
"log"
"net/http"
"runtime"
"strings"
"text/template"

Expand Down Expand Up @@ -80,6 +81,7 @@ func View(c echo.Context) error {
device := Device()
device["version"] = VERSION
device["site_title"] = Title
device["go_version"] = runtime.Version()

if ajax := c.QueryParam("ajax"); ajax == "true" {
return c.JSON(http.StatusOK, device)
Expand Down

0 comments on commit 19ed9a7

Please sign in to comment.