@@ -30,7 +30,7 @@ type Application struct {
30
30
Services map [string ]service.Service
31
31
serviceFolder string
32
32
Domain string
33
- GitlabDomain string
33
+ GitlabURL string
34
34
Router http.Handler
35
35
storage storage.Storage
36
36
volumes * volumes.Volumes
@@ -103,7 +103,7 @@ func New(cfg *conf.Conf) (*Application, error) {
103
103
Services : svcs ,
104
104
Domain : cfg .OAuth .AppURL ,
105
105
// FIXME: use dedicated variable
106
- GitlabDomain : cfg .OAuth .ProviderURL ,
106
+ GitlabURL : cfg .OAuth .ProviderURL ,
107
107
serviceFolder : cfg .Services ,
108
108
storage : s ,
109
109
Router : MagicPathHandler (r ),
@@ -131,22 +131,33 @@ func New(cfg *conf.Conf) (*Application, error) {
131
131
r .Get ("/services" , a .ServicesHandler )
132
132
r .Get ("/service/{serviceID}" , a .ReadmeHandler )
133
133
r .Route ("/service/{serviceID}/{project}" , func (r chi.Router ) {
134
- r .Use (authMiddleware .Middleware ())
135
134
r .Use (a .ServiceMiddleware )
136
135
r .Route ("/" , func (r chi.Router ) {
137
136
r .Route ("/{branch}" , func (r chi.Router ) {
138
137
r .Route ("/{commit}" , func (r chi.Router ) {
139
- r .Post ("/" , a .PostTaskHandler )
140
- r .Get ("/" , a .TaskHandler (false ))
141
- r .Get ("/status" , badge .StatusBadge (a .storage , false ))
142
- r .Get ("/badge/{badge}" , a .BadgeMyTaskHandler (false ))
143
- r .Get ("/volumes/*" , a .VolumesHandler (6 , false ))
138
+ r .Group (func (r chi.Router ) {
139
+ r .Use (authMiddleware .Middleware ())
140
+ r .Post ("/" , a .PostTaskHandler )
141
+ r .Get ("/" , a .TaskHandler (false ))
142
+ r .Get ("/volumes/*" , a .VolumesHandler (6 , false ))
143
+ })
144
+ r .Group (func (r chi.Router ) {
145
+ r .Use (a .RefererMiddleware )
146
+ r .Get ("/status" , badge .StatusBadge (a .storage , false ))
147
+ r .Get ("/badge/{badge}" , a .BadgeMyTaskHandler (false ))
148
+ })
144
149
})
145
150
r .Route ("/latest" , func (r chi.Router ) {
146
- r .Get ("/" , a .TaskHandler (true ))
147
- r .Get ("/status" , badge .StatusBadge (a .storage , true ))
148
- r .Get ("/badge/{badge}" , a .BadgeMyTaskHandler (true ))
149
- r .Get ("/volumes/*" , a .VolumesHandler (6 , true ))
151
+ r .Group (func (r chi.Router ) {
152
+ r .Use (authMiddleware .Middleware ())
153
+ r .Get ("/" , a .TaskHandler (true ))
154
+ r .Get ("/volumes/*" , a .VolumesHandler (6 , true ))
155
+ })
156
+ r .Group (func (r chi.Router ) {
157
+ r .Use (a .RefererMiddleware )
158
+ r .Get ("/status" , badge .StatusBadge (a .storage , true ))
159
+ r .Get ("/badge/{badge}" , a .BadgeMyTaskHandler (true ))
160
+ })
150
161
})
151
162
})
152
163
})
0 commit comments