Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
plutobell committed Aug 10, 2021
1 parent e14bf73 commit 2aa8c3d
Show file tree
Hide file tree
Showing 14 changed files with 811 additions and 71 deletions.
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# Changelog #

**2021-08-10**

* v1.2.0 :
* Rewrite login authentication
* Added new login page
* Added new command line parameter: session
* Use Go v1.16.7
* Updated dependencies

**2021-06-17**

* v1.1.2 :
* Changed the way cpu usage is calculated
* Update dependencies
* Updated dependencies

**2021-06-16**

* v1.1.1 :
* Fix the bug of abnormal display of cpu information
* Use Go v1.16.5
* Update dependencies
* Updated dependencies

**2021-04-05**

Expand All @@ -27,7 +36,7 @@
* 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
* Added golang version display on view

**2020-8-14**

Expand All @@ -40,7 +49,7 @@

* v1.0.8 :
* Optimize swap display details
* Add shortcut buttons such as shutdown and reboot
* Added shortcut buttons such as shutdown and reboot

**2020-8-7**

Expand Down Expand Up @@ -73,7 +82,7 @@
* v1.0.2 :
* Improve command line parameter verification
* Detail optimization
* Add test case device_test.go
* Added test case device_test.go
* New page loading animation

**2020-8-4**
Expand Down
4 changes: 2 additions & 2 deletions Makefile
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-10
# @Last modify: 2021-06-17
# @Version: 1.1.2
# @Last modify: 2021-08-10
# @Version: 1.2.0

PROGRAM = pi-dashboard-go
OUTPUT = build
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@



![](./screenshot.png)
![](./screenshot_view.png)

![](./screenshot_login.png)



## Install

Expand Down Expand Up @@ -33,7 +37,7 @@ chmod +x pi-dashboard-go

**Pi Dashboard Go** can be configured via command line parameters:

```
```bash
Pi Dashboard Go version: 1.1.0
Project address: https://github.com/plutobell/pi-dashboard-go

Expand All @@ -52,6 +56,8 @@ Options:
specify the network device (default "lo")
-port string
specify the running port (default "8080")
-session string
specify the login status validity in days (default "7")
-title string
specify the website title (default "Pi Dashboard Go")
-version
Expand Down
6 changes: 3 additions & 3 deletions assets/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// @Description: Golang implementation of pi-dashboard
// @Author: github.com/plutobell
// @Creation: 2020-08-01
// @Last modify: 2021-06-17
// @Version: 1.1.2
// @Last modify: 2021-08-10
// @Version: 1.2.0

window.oncontextmenu=function(){return false;}
window.onkeydown = window.onkeyup = window.onkeypress = function () {
window.event.returnValue = false;
window.event.returnValue = false;
return false;
}

Expand Down
195 changes: 195 additions & 0 deletions assets/login.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Login</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#222222" />
<link rel="icon" href="assets/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="assets/favicon.ico" type="image/x-icon" />
<link href="assets/bootstrap.min.css" rel="stylesheet">
<script src="assets/jquery-3.1.1.min.js"></script>
<script src="assets/bootstrap.min.js"></script>
<script language="JavaScript">
window.oncontextmenu=function(){return false;}
</script>
<style type="text/css">
.label {color: #9da3a4; font-size: 75%; font-weight: bolder;}
::-webkit-scrollbar {
width: 6.5px;
height: 6.5px;
}
::-webkit-scrollbar-track {
border-radius: 3.5px;
background: rgba(0,0,0,0.06);
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.08);
}
::-webkit-scrollbar-thumb {
border-radius: 3.5px;
background: rgba(0,0,0,0.12);
-webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

body{
-moz-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
-khtml-user-select:none;
user-select:none;
margin-top: 70px;
}

#loading{
background: #363636;
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
display: block;
z-index: 20;
filter: alpha(opacity=90);
opacity: 0.9 !important;
}

.spinner {
width: 50px;
height: 60px;
text-align: center;
font-size: 10px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}

.spinner > div {
background-color: #D6264F;
height: 100%;
width: 6px;
border-radius: 20px;
display: inline-block;

-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
animation: stretchdelay 1.2s infinite ease-in-out;
}

.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}

.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}

.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}

.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}

@-webkit-keyframes stretchdelay {
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
20% { -webkit-transform: scaleY(1.0) }
}

@keyframes stretchdelay {
0%, 40%, 100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
} 20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}

#command-btns{
list-style-type:none;
display: block;
margin-top: 0 auto;
margin-top: 10px;
padding: 0;
}
#command-btns li{
display: inline;
white-space:nowrap;
margin: auto 7px;
cursor: pointer;
}
#command-btns li img:hover{
border: 1px solid #E5E6E4;
border-radius: 90px;
}

.box-radius {
border-radius: 3px;
}
</style>
</head>
<body>
<div id="app">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="javascript:void(0);"><img style="height: 100%; display: inline; margin-right: 10px;" src="assets/logo.png">{{.site_title}}</a>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- <li><a target="_blank" href="#">Blog</a></li> -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">About <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a target="_blank" href="https://ojoll.com/archives/86/">Pi Dashboard Go</a></li>
<li><a target="_blank" href="https://github.com/plutobell/pi-dashboard-go">GitHub Source</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>

<div class="container">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4" style="padding: 5%;">
<div style="text-align: center; width: 100%;margin-bottom: 20px;"><img src="assets/devices/{{.device_photo}}" /></div>
<form action="/login" method="POST">
<div class="form-group">
<input type="text" class="form-control box-radius" name="username" placeholder="Username">
</div>
<div class="form-group">
<input type="password" class="form-control box-radius" name="password" placeholder="Password">
</div>
<button type="submit" class="btn btn-default box-radius" style="width: 100%;">Sign in</button>
</form>
<p class="pull-left" style="font-size: 12px;margin-top: 20px;">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 class="col-md-4">
</div>
</div>
</div>
</div>
<!--
@Program : Pi Dashboard Go (https://github.com/plutobell/pi-dashboard-go)
@Description: Golang implementation of pi-dashboard
@Author: github.com/plutobell
@Creation: 2020-08-01
@Last modify: 2021-08-10
@Version: 1.2.0 -->
</body>
</html>
5 changes: 3 additions & 2 deletions assets/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- <li><a target="_blank" href="#">Blog</a></li> -->
<li><a href="/?logout=true">Sign out</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">About <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
Expand Down Expand Up @@ -389,7 +390,7 @@
@Description: Golang implementation of pi-dashboard
@Author: github.com/plutobell
@Creation: 2020-08-01
@Last modify: 2021-06-17
@Version: 1.1.2 -->
@Last modify: 2021-08-10
@Version: 1.2.0 -->
</body>
</html>
4 changes: 2 additions & 2 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-06-17
// @Version: 1.1.2
// @Last modify: 2021-08-10
// @Version: 1.2.0

package main

Expand Down
17 changes: 17 additions & 0 deletions device_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"net/http"
"testing"
)

Expand Down Expand Up @@ -33,3 +34,19 @@ func Test_bytesRound(t *testing.T) {
t.Error("Fail")
}
}

func Test_getFileSystem(t *testing.T) {
if _, ok := getFileSystem(false).(http.FileSystem); ok {
t.Log("Pass")
} else {
t.Error("Fail")
}
}

func Test_getRandomString(t *testing.T) {
if res := getRandomString(16); len(res) == 16 {
t.Log("Pass")
} else {
t.Error("Fail")
}
}
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ module pi-dashboard-go
go 1.16

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/labstack/echo/v4 v4.3.0
github.com/mattn/go-isatty v0.0.13 // indirect
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
github.com/gorilla/sessions v1.2.1
github.com/labstack/echo-contrib v0.11.0
github.com/labstack/echo/v4 v4.5.0
)
Loading

0 comments on commit 2aa8c3d

Please sign in to comment.