repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
8e0e7f4
parent
adf572f
author
Antonio Mika
date
2024-11-16 19:19:31 +0000 UTC
Update utils
6 files changed,  +9, -9
M go.mod
M go.sum
M auth/api.go
+2, -2
 1@@ -258,7 +258,7 @@ func keyHandler(w http.ResponseWriter, r *http.Request) {
 2 
 3 	space := r.URL.Query().Get("space")
 4 	if space == "" {
 5-		spaceErr := fmt.Errorf("Must provide `space` query parameter")
 6+		spaceErr := fmt.Errorf("must provide `space` query parameter")
 7 		client.Logger.Error(spaceErr.Error())
 8 		http.Error(w, spaceErr.Error(), http.StatusUnprocessableEntity)
 9 	}
10@@ -644,7 +644,7 @@ func handler(routes []shared.Route, client *Client) http.HandlerFunc {
11 
12 func metricDrainSub(ctx context.Context, dbpool db.DB, logger *slog.Logger, secret string) {
13 	conn := shared.NewPicoPipeClient()
14-	stdoutPipe, err := pipe.Sub("sub metric-drain -k", ctx, conn)
15+	stdoutPipe, err := pipe.Sub(ctx, logger, conn, "sub metric-drain -k")
16 
17 	if err != nil {
18 		logger.Error("could not sub to metric-drain", "err", err)
M go.mod
+1, -1
1@@ -41,7 +41,7 @@ require (
2 	github.com/picosh/pubsub v0.0.0-20241114191831-ec8f16c0eb88
3 	github.com/picosh/send v0.0.0-20241107150437-0febb0049b4f
4 	github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9
5-	github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4
6+	github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605
7 	github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
8 	github.com/sendgrid/sendgrid-go v3.16.0+incompatible
9 	github.com/simplesurance/go-ip-anonymizer v0.0.0-20200429124537-35a880f8e87d
M go.sum
+2, -3
 1@@ -277,9 +277,8 @@ github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0 h1:pBRIbiCj7K6rGELij
 2 github.com/picosh/senpai v0.0.0-20240503200611-af89e73973b0/go.mod h1:QaBDtybFC5gz7EG/9c3bgzuyW7W5W2rYLFZxWNuWk3Q=
 3 github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9 h1:g5oZmnDFr11HarA8IAXcc4o9PBlolSM59QIATCSoato=
 4 github.com/picosh/tunkit v0.0.0-20240905223921-532404cef9d9/go.mod h1:UrDH/VCIc1wg/L6iY2zSYt4TiGw+25GsKSnkVkU40Dw=
 5-github.com/picosh/utils v0.0.0-20241018143404-b351d5d765f3/go.mod h1:ftrp1FjbKK/mFnBAYGymA1QEtPlkA0+lWkPI5h0HKt4=
 6-github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4 h1:F5HYOJKgAVjZHjqrZPwPHbJwiH2VMK5cgfruc/c7GU8=
 7-github.com/picosh/utils v0.0.0-20241116165501-b922efcc56f4/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
 8+github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605 h1:A9yRvOupUH9gxGJ/r+4x2RL2uZVEf2Am2AfiLrAfaTg=
 9+github.com/picosh/utils v0.0.0-20241116191332-39c204dc4605/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
10 github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
11 github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
12 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
M pico/cli.go
+1, -1
1@@ -71,7 +71,7 @@ func (c *Cmd) notifications() error {
2 
3 func (c *Cmd) logs(ctx context.Context) error {
4 	conn := shared.NewPicoPipeClient()
5-	stdoutPipe, err := pipeLogger.ReadLogs(ctx, conn)
6+	stdoutPipe, err := pipeLogger.ReadLogs(ctx, c.Log, conn)
7 
8 	if err != nil {
9 		return err
M shared/analytics.go
+2, -1
 1@@ -1,6 +1,7 @@
 2 package shared
 3 
 4 import (
 5+	"context"
 6 	"crypto/hmac"
 7 	"crypto/sha256"
 8 	"encoding/hex"
 9@@ -167,7 +168,7 @@ func AnalyticsVisitFromRequest(r *http.Request, dbpool db.DB, userID string) (*d
10 
11 func AnalyticsCollect(ch chan *db.AnalyticsVisits, dbpool db.DB, logger *slog.Logger) {
12 	info := NewPicoPipeClient()
13-	metricDrain, err := pipe.NewClient(logger, info)
14+	metricDrain, err := pipe.NewClient(context.Background(), logger, info)
15 	if err != nil {
16 		logger.Error("could not create metric-drain client", "err", err)
17 		return
M tui/logs/logs.go
+1, -1
1@@ -172,7 +172,7 @@ func (m Model) waitForActivity(sub chan map[string]any) tea.Cmd {
2 func (m Model) connectLogs(sub chan map[string]any) tea.Cmd {
3 	return func() tea.Msg {
4 		conn := shared.NewPicoPipeClient()
5-		stdoutPipe, err := pipeLogger.ReadLogs(m.ctx, conn)
6+		stdoutPipe, err := pipeLogger.ReadLogs(m.ctx, m.shared.Logger, conn)
7 		if err != nil {
8 			return errMsg(err)
9 		}