mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 09:38:13 -05:00
♻️ dayNight主题更新 + 一些重构
This commit is contained in:
parent
691d04ac62
commit
b19a704aee
@ -71,6 +71,5 @@ func (mp *memberPage) notification(c *gin.Context) {
|
|||||||
func (mp *memberPage) setting(c *gin.Context) {
|
func (mp *memberPage) setting(c *gin.Context) {
|
||||||
c.HTML(http.StatusOK, "dashboard/setting", mygin.CommonEnvironment(c, gin.H{
|
c.HTML(http.StatusOK, "dashboard/setting", mygin.CommonEnvironment(c, gin.H{
|
||||||
"Title": "系统设置",
|
"Title": "系统设置",
|
||||||
"Conf": dao.Conf,
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
9
cmd/playground/example.sh
Executable file
9
cmd/playground/example.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -x
|
||||||
|
|
||||||
|
ME=`whoami`
|
||||||
|
|
||||||
|
ping example.com -c20 && \
|
||||||
|
echo "==== $ME ====" && \
|
||||||
|
ping example.net -c20 && \
|
||||||
|
echo "==== done! ===="
|
@ -6,6 +6,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -16,8 +17,9 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
// icmp()
|
// icmp()
|
||||||
// tcpping()
|
// tcpping()
|
||||||
httpWithSSLInfo()
|
// httpWithSSLInfo()
|
||||||
// diskinfo()
|
// diskinfo()
|
||||||
|
cmdExec()
|
||||||
}
|
}
|
||||||
|
|
||||||
func tcpping() {
|
func tcpping() {
|
||||||
@ -71,13 +73,12 @@ func icmp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func cmdExec() {
|
func cmdExec() {
|
||||||
cmd := exec.Command("ping", "example.com", "-c2")
|
execFrom, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
cmd := exec.Command(execFrom + "/cmd/playground/example.sh")
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
log.Println("output:", string(output))
|
log.Println("output:", string(output))
|
||||||
log.Println("err:", err)
|
log.Println("err:", err)
|
||||||
|
|
||||||
cmd = exec.Command("ping", "example", "-c2")
|
|
||||||
output, err = cmd.Output()
|
|
||||||
log.Println("output:", string(output))
|
|
||||||
log.Println("err:", err)
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ var adminPage = map[string]bool{
|
|||||||
func CommonEnvironment(c *gin.Context, data map[string]interface{}) gin.H {
|
func CommonEnvironment(c *gin.Context, data map[string]interface{}) gin.H {
|
||||||
data["MatchedPath"] = c.MustGet("MatchedPath")
|
data["MatchedPath"] = c.MustGet("MatchedPath")
|
||||||
data["Version"] = dao.Version
|
data["Version"] = dao.Version
|
||||||
|
data["Conf"] = dao.Conf
|
||||||
// 是否是管理页面
|
// 是否是管理页面
|
||||||
data["IsAdminPage"] = adminPage[data["MatchedPath"].(string)]
|
data["IsAdminPage"] = adminPage[data["MatchedPath"].(string)]
|
||||||
// 站点标题
|
// 站点标题
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
计划的格式为:<code>* * * * *</code> 分 时 天 月 星期,详情见 <a
|
计划的格式为:<code>* * * * *</code> 分 时 天 月 星期,详情见 <a
|
||||||
href="https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format"
|
href="https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format"
|
||||||
target="_blank">计划表达式格式</a><br>
|
target="_blank">计划表达式格式</a><br>
|
||||||
命令:Shell 命令,就像写脚本一样就可以,如果遇到 xxx 命令找不到,可能是 <code>PATH</code> 环境变量的问题,<code>source ~/.bashrc</code>
|
命令:Shell 命令,就像写脚本一样就可以,如果遇到 xxx 命令找不到,可能是 <code>PATH</code> 环境变量的问题,在脚本顶部加一个 <code>source ~/.bashrc</code>
|
||||||
或者使用绝对路径执行。
|
或者使用绝对路径执行,示例 <a href="https://gist.github.com/naiba/26efc8bf6f0b3273a9ba15ee48db5f11" target="_blank" rel="noopener noreferrer">备份脚本</a>。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<body data-theme="light" data-gridlist="grid">
|
<body data-theme="light" data-gridlist="grid">
|
||||||
<header class="nav-bar clearfix">
|
<header class="nav-bar clearfix">
|
||||||
<figure class="logo"><a href="/">{{.Title}}</a></figure>
|
<figure class="logo"><a href="/">{{.Conf.Site.Brand}}</a></figure>
|
||||||
<div class="icon-container">
|
<div class="icon-container">
|
||||||
<div class="row cf">
|
<div class="row cf">
|
||||||
<div class="three col">
|
<div class="three col">
|
||||||
@ -34,16 +34,12 @@
|
|||||||
{{if .Admin}}
|
{{if .Admin}}
|
||||||
<li><a href="/">首页</a></li>
|
<li><a href="/">首页</a></li>
|
||||||
<li><a href="/service">服务状态</a></li>
|
<li><a href="/service">服务状态</a></li>
|
||||||
<li><a href="/server">服务器</a></li>
|
<li><a href="/server" style="padding:.8em;text-align:center;">管理后台</a></li>
|
||||||
<li><a href="/monitor">监控</a></li>
|
|
||||||
<li><a href="/notification">通知</a></li>
|
|
||||||
<li><a href="/setting">设置</a></li>
|
|
||||||
<li><a href="#" style="padding:.8em;text-align:center;"
|
|
||||||
title="您已登录">{{.Admin.Name}}</a></li>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<li><a href="/">首页</a></li>
|
<li><a href="/">首页</a></li>
|
||||||
<li><a href="/service">服务状态</a></li>
|
<li><a href="/service">服务状态</a></li>
|
||||||
<li><a href="/login">登录</a></li>{{end}}
|
<li><a href="/login">登录</a></li>
|
||||||
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<body data-theme="light" data-gridlist="list">
|
<body data-theme="light" data-gridlist="list">
|
||||||
<article>
|
<article>
|
||||||
<header class="nav-bar clearfix">
|
<header class="nav-bar clearfix">
|
||||||
<figure class="logo"><a href="/">{{.Title}}</a></figure>
|
<figure class="logo"><a href="/">{{.Conf.Site.Brand}}</a></figure>
|
||||||
<div class="icon-container">
|
<div class="icon-container">
|
||||||
<div class="row cf">
|
<div class="row cf">
|
||||||
<div class="three col">
|
<div class="three col">
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
pb "github.com/naiba/nezha/proto"
|
pb "github.com/naiba/nezha/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "v0.3.9"
|
var Version = "v0.3.10"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SnapshotDelay = 3
|
SnapshotDelay = 3
|
||||||
|
Loading…
Reference in New Issue
Block a user