版本升级到v1.5

develop v1.5
ouqiang 2018-05-26 11:16:36 +08:00
parent 0e023bd3fa
commit 50f08e996a
15 changed files with 36 additions and 17 deletions

4
.gitignore vendored
View File

@ -34,7 +34,7 @@ profile/*
/bin
/web/public/static
/web/public/index.html
/gocron_package
/gocron-node_package
/gocron-package
/gocron-node-package
node_modules

View File

@ -22,9 +22,9 @@
* HTTP任务
> 访问指定的URL地址, 由调度器直接执行, 不依赖任务节点
* 查看任务执行结果日志
* 任务执行结果通知, 支持邮件、Slack
* 任务执行结果通知, 支持邮件、Slack、Webhook
### v1.5(未发布)截图
### 截图
![流程图](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/scheduler.png)
![任务](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/task.png)
![Slack](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/notification.png)

View File

@ -20,7 +20,7 @@ import (
)
var (
AppVersion = "1.4"
AppVersion = "1.5"
BuildDate, GitCommit string
)

View File

@ -1,6 +1,7 @@
package notify
import (
"html"
"time"
"github.com/ouqiang/gocron/internal/models"
@ -26,6 +27,7 @@ func (webHook *WebHook) Send(msg Message) {
msg["name"] = utils.EscapeJson(msg["name"].(string))
msg["output"] = utils.EscapeJson(msg["output"].(string))
msg["content"] = parseNotifyTemplate(webHookSetting.Template, msg)
msg["content"] = html.UnescapeString(msg["content"].(string))
webHook.send(msg, webHookSetting.Url)
}

View File

@ -18,7 +18,7 @@ import (
)
const testConnectionCommand = "echo hello"
const testConnectionTimeout = 10
const testConnectionTimeout = 5
// Index 主机列表
func Index(ctx *macaron.Context) string {

View File

@ -61,6 +61,10 @@ func Register(m *macaron.Macaron) {
// 系统安装
m.Group("/install", func() {
m.Post("/store", binding.Bind(install.InstallForm{}), install.Store)
m.Get("/status", func(ctx *macaron.Context) string {
jsonResp := utils.JsonResponse{}
return jsonResp.Success("", app.Installed)
})
})
// 用户
@ -174,7 +178,7 @@ func checkAppInstall(ctx *macaron.Context) {
if app.Installed {
return
}
if ctx.Req.URL.Path == "/install/store" || ctx.Req.URL.Path == "/" {
if strings.HasPrefix(ctx.Req.URL.Path, "/install") || ctx.Req.URL.Path == "/" {
return
}
jsonResp := utils.JsonResponse{}
@ -218,7 +222,7 @@ func userAuth(ctx *macaron.Context) {
if strings.HasPrefix(uri, "/v1") {
return
}
excludePaths := []string{"", "/user/login"}
excludePaths := []string{"", "/user/login", "/install/status"}
for _, path := range excludePaths {
if uri == path {
return
@ -245,6 +249,7 @@ func urlAuth(ctx *macaron.Context) {
// 普通用户允许访问的URL地址
allowPaths := []string{
"",
"/install/status",
"/task",
"/task/log",
"/host",

View File

@ -181,6 +181,9 @@ func UpdatePassword(ctx *macaron.Context) string {
if newPassword == "" || confirmNewPassword == "" {
return json.CommonFailure("请输入密码")
}
if newPassword != confirmNewPassword {
return json.CommonFailure("两次输入密码不一致")
}
userModel := new(models.User)
_, err := userModel.UpdatePassword(id, newPassword)
if err != nil {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,9 @@ set -o errexit
set -o nounset
# 管道中任一命令执行失败退出
set -o pipefail
eval $(go env)
# 二进制文件名
BINARY_NAME=''
# main函数所在文件
@ -25,9 +27,9 @@ INPUT_OS=()
# 外部输入的架构
INPUT_ARCH=()
# 未指定OS默认值
DEFAULT_OS='linux'
DEFAULT_OS=${GOHOSTOS}
# 未指定ARCH,默认值
DEFAULT_ARCH='amd64'
DEFAULT_ARCH=${GOHOSTARCH}
# 支持的系统
SUPPORT_OS=(linux darwin windows)
# 支持的架构

View File

@ -27,7 +27,11 @@ export default {
return {}
},
created () {
installService.store({})
installService.status((data) => {
if (!data) {
this.$router.push('/install')
}
})
},
components: {
appHeader,

View File

@ -3,5 +3,8 @@ import httpClient from '../utils/httpClient'
export default {
store (data, callback) {
httpClient.post('/install/store', data, callback)
},
status (callback) {
httpClient.get('/install/status', {}, callback)
}
}

View File

@ -10,7 +10,7 @@
<el-input v-model.trim="searchParams.name"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search"></el-button>
<el-button type="primary" @click="search()"></el-button>
</el-form-item>
</el-row>
</el-form>

View File

@ -155,7 +155,7 @@ export default {
},
init () {
this.username = ''
this.password = ''
this.email = ''
notificationService.mail((data) => {
this.form.host = data.host
if (data.port) {

View File

@ -49,7 +49,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search"></el-button>
<el-button type="primary" @click="search()"></el-button>
</el-form-item>
</el-row>
</el-form>

View File

@ -29,7 +29,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search"></el-button>
<el-button type="primary" @click="search()"></el-button>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">