Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8a1403a35d | ||
|
07db4cf999 |
@@ -9,7 +9,7 @@ type Func func(db *sql.DB)
|
|||||||
|
|
||||||
type Actor struct {
|
type Actor struct {
|
||||||
DB *sql.DB
|
DB *sql.DB
|
||||||
ActionChan <-chan Func
|
ActionChan chan Func
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Actor) Run(ctx context.Context) error {
|
func (a *Actor) Run(ctx context.Context) error {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
// Logger is a loggin interface with only the essentials that a function that needs to log should care about. Compatible with standard Go logger.
|
// Logger is a logging interface with only the essentials that a function that needs to log should care about. Compatible with standard Go logger.
|
||||||
type Logger interface {
|
type Logger interface {
|
||||||
Print(v ...interface{})
|
Print(v ...interface{})
|
||||||
Printf(format string, v ...interface{})
|
Printf(format string, v ...interface{})
|
||||||
|
@@ -20,7 +20,7 @@ func BasicAuth(h http.Handler, htpasswd map[string]string, realm string) http.Ha
|
|||||||
user, pass, _ := r.BasicAuth()
|
user, pass, _ := r.BasicAuth()
|
||||||
if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) {
|
if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) {
|
||||||
w.Header().Set("WWW-Authenticate", rlm)
|
w.Header().Set("WWW-Authenticate", rlm)
|
||||||
http.Error(w, "Unauthorized.", 401)
|
http.Error(w, "Unauthorized", 401)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.ServeHTTP(w, r)
|
h.ServeHTTP(w, r)
|
||||||
|
@@ -11,7 +11,7 @@ type StatusHandler int
|
|||||||
func (s StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
code := int(s)
|
code := int(s)
|
||||||
w.WriteHeader(code)
|
w.WriteHeader(code)
|
||||||
io.WriteString(w, http.StatusText(code))
|
_, _ = io.WriteString(w, http.StatusText(code))
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Reference in New Issue
Block a user