-
Notifications
You must be signed in to change notification settings - Fork 34
/
init.go
43 lines (40 loc) · 1.14 KB
/
init.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package board
import (
"github.com/TeaWeb/code/teaweb/actions/default/proxy"
"github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils"
"github.com/TeaWeb/code/teaweb/configs"
"github.com/TeaWeb/code/teaweb/helpers"
"github.com/iwind/TeaGo"
"github.com/iwind/TeaGo/logs"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
// 定义路由
server.
Helper(&helpers.UserMustAuth{
Grant: configs.AdminGrantProxy,
}).
Helper(new(proxy.Helper)).
Module("").
Prefix("/proxy/board").
GetPost("", new(IndexAction)).
GetPost("/charts", new(ChartsAction)).
GetPost("/make", new(MakeAction)).
Post("/test", new(TestAction)).
GetPost("/chart", new(ChartAction)).
GetPost("/updateChart", new(UpdateChartAction)).
Post("/deleteChart", new(DeleteChartAction)).
Post("/useChart", new(UseChartAction)).
Post("/cancelChart", new(CancelChartAction)).
Post("/moveChart", new(MoveChartAction)).
EndAll()
// 检查图表更新
logs.Println("[proxy]check widget changes")
if proxyutils.CheckChartChanges() {
err := proxyutils.ApplyChartChanges()
if err != nil {
logs.Error(err)
}
}
})
}