feat(web): service page, manual update, jobs list and live job log (#7)
Also publishes the jobs topic on agent revoke and updates the agent snippet to mount stacks read-write at the same path.
This commit is contained in:
@@ -157,7 +157,7 @@ func (a *Auth) Require(next http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
}
|
||||
next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), sessionKey{}, sess)))
|
||||
next.ServeHTTP(w, r.WithContext(WithSession(r.Context(), sess)))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -171,6 +171,11 @@ func (a *Auth) session(r *http.Request) (model.Session, error) {
|
||||
|
||||
type sessionKey struct{}
|
||||
|
||||
// WithSession returns ctx carrying sess, as Require does.
|
||||
func WithSession(ctx context.Context, sess model.Session) context.Context {
|
||||
return context.WithValue(ctx, sessionKey{}, sess)
|
||||
}
|
||||
|
||||
// SessionFrom returns the session Require stored in ctx.
|
||||
func SessionFrom(ctx context.Context) (model.Session, bool) {
|
||||
s, ok := ctx.Value(sessionKey{}).(model.Session)
|
||||
|
||||
Reference in New Issue
Block a user