diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-05-24 17:37:07 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-05-24 17:37:07 -0400 |
| commit | 6de8ae1cd17dfff569ac82e07204c48bfe2e3a62 (patch) | |
| tree | abaedee2a9a6b1254c4375186b75f3c1e335792a | |
| parent | fa4e3a34bb7474cada1ee748d9e7ed9fc2cda3f5 (diff) | |
| download | xesite-6de8ae1cd17dfff569ac82e07204c48bfe2e3a62.tar.xz xesite-6de8ae1cd17dfff569ac82e07204c48bfe2e3a62.zip | |
internal/lume: allow rebuilds when git is happy
Signed-off-by: Xe Iaso <me@xeiaso.net>
| -rw-r--r-- | internal/lume/lume.go | 10 | ||||
| -rw-r--r-- | internal/passwdmiddleware.go | 15 | ||||
| -rw-r--r-- | lume/src/events.jsx | 4 |
3 files changed, 25 insertions, 4 deletions
diff --git a/internal/lume/lume.go b/internal/lume/lume.go index a575d2b..aa84abe 100644 --- a/internal/lume/lume.go +++ b/internal/lume/lume.go @@ -4,6 +4,7 @@ import ( "archive/zip" "context" "encoding/json" + "errors" "expvar" "fmt" "html/template" @@ -251,8 +252,13 @@ func (f *FS) Update(ctx context.Context) error { ReferenceName: plumbing.NewBranchReferenceName(f.opt.Branch), }) if err != nil { - updateErrors.Add(1) - return err + switch { + case errors.Is(err, git.NoErrAlreadyUpToDate): + slog.Debug("already up to date") + default: + updateErrors.Add(1) + return err + } } err = wt.Checkout(&git.CheckoutOptions{ diff --git a/internal/passwdmiddleware.go b/internal/passwdmiddleware.go new file mode 100644 index 0000000..8fa511a --- /dev/null +++ b/internal/passwdmiddleware.go @@ -0,0 +1,15 @@ +package internal + +import "net/http" + +func PasswordMiddleware(username, password string, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + user, pass, ok := r.BasicAuth() + if !ok || user != username || pass != password { + http.Error(w, "Unauthorized", http.StatusUnauthorized) + return + } + + next.ServeHTTP(w, r) + }) +} diff --git a/lume/src/events.jsx b/lume/src/events.jsx index 6cc0efd..b4072df 100644 --- a/lume/src/events.jsx +++ b/lume/src/events.jsx @@ -19,11 +19,11 @@ export default ({ events }) => ( </div> )} - <div className="my-4 prose"> + <div className="my-4 prose max-w-full"> <p> If you'd like me to speak at an event, please <a href="/contact">contact me</a>! I'm always looking for new opportunities to share my knowledge and experiences. I'm also available for interviews, podcasts, and other media appearances. </p> - <p>Please note that all conferences and meetups I attend require a publicly posted code of conduct.</p> + <p>Please note that all conferences and meetups I speak at require a publicly posted code of conduct.</p> </div> </> );
\ No newline at end of file |
