Skip to content

Commit

Permalink
版本升级到v1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ouqiang committed May 26, 2018
1 parent 0e023bd commit 50f08e9
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gocron/gocron.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

var (
AppVersion = "1.4"
AppVersion = "1.5"
BuildDate, GitCommit string
)

Expand Down
2 changes: 2 additions & 0 deletions internal/modules/notify/webhook.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package notify

import (
"html"
"time"

"github.com/ouqiang/gocron/internal/models"
Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/routers/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const testConnectionCommand = "echo hello"
const testConnectionTimeout = 10
const testConnectionTimeout = 5

// Index 主机列表
func Index(ctx *macaron.Context) string {
Expand Down
9 changes: 7 additions & 2 deletions internal/routers/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

// 用户
Expand Down Expand Up @@ -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{}
Expand Down Expand Up @@ -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
Expand All @@ -245,6 +249,7 @@ func urlAuth(ctx *macaron.Context) {
// 普通用户允许访问的URL地址
allowPaths := []string{
"",
"/install/status",
"/task",
"/task/log",
"/host",
Expand Down
3 changes: 3 additions & 0 deletions internal/routers/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/statik/statik.go

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ set -o errexit
set -o nounset
# 管道中任一命令执行失败退出
set -o pipefail


eval $(go env)

# 二进制文件名
BINARY_NAME=''
# main函数所在文件
Expand All @@ -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)
# 支持的架构
Expand Down
6 changes: 5 additions & 1 deletion web/vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export default {
return {}
},
created () {
installService.store({})
installService.status((data) => {
if (!data) {
this.$router.push('/install')
}
})
},
components: {
appHeader,
Expand Down
3 changes: 3 additions & 0 deletions web/vue/src/api/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion web/vue/src/pages/host/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion web/vue/src/pages/system/notification/email.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default {
},
init () {
this.username = ''
this.password = ''
this.email = ''
notificationService.mail((data) => {
this.form.host = data.host
if (data.port) {
Expand Down
2 changes: 1 addition & 1 deletion web/vue/src/pages/task/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion web/vue/src/pages/taskLog/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 50f08e9

Please sign in to comment.