版本升级到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 /bin
/web/public/static /web/public/static
/web/public/index.html /web/public/index.html
/gocron_package /gocron-package
/gocron-node_package /gocron-node-package
node_modules node_modules

View File

@ -22,9 +22,9 @@
* HTTP任务 * HTTP任务
> 访问指定的URL地址, 由调度器直接执行, 不依赖任务节点 > 访问指定的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/scheduler.png)
![任务](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/task.png) ![任务](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/task.png)
![Slack](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/notification.png) ![Slack](https://raw.githubusercontent.com/ouqiang/gocron/master/assets/screenshot/notification.png)

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -3,5 +3,8 @@ import httpClient from '../utils/httpClient'
export default { export default {
store (data, callback) { store (data, callback) {
httpClient.post('/install/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-input v-model.trim="searchParams.name"></el-input>
</el-form-item> </el-form-item>
<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-item>
</el-row> </el-row>
</el-form> </el-form>

View File

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

View File

@ -49,7 +49,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<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-item>
</el-row> </el-row>
</el-form> </el-form>

View File

@ -29,7 +29,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<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-item>
</el-form> </el-form>
<el-row type="flex" justify="end"> <el-row type="flex" justify="end">