repos / pico

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

commit
7e4ad3e
parent
7225c57
author
Antonio Mika
date
2024-11-17 23:30:11 +0000 UTC
Cleanup and standardize user id for logs
5 files changed,  +8, -8
M go.mod
M go.sum
M db/postgres/storage.go
+1, -1
1@@ -593,7 +593,7 @@ func (me *PsqlDB) FindUserForKey(username string, key string) (*db.User, error)
2 	me.Logger.Info("attempting to find user with only public key", "key", key)
3 	pk, err := me.FindPublicKeyForKey(key)
4 	if err == nil {
5-		me.Logger.Info("found pubkey, looking for user", "key", key, "userID", pk.UserID)
6+		me.Logger.Info("found pubkey, looking for user", "key", key, "userId", pk.UserID)
7 		user, err := me.FindUser(pk.UserID)
8 		if err != nil {
9 			return nil, 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-20241117214552-6372620615c4
6+	github.com/picosh/utils v0.0.0-20241117232851-a32d4675d449
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, -4
 1@@ -277,10 +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-20241117203114-3decbe6f0cec h1:syh21+XscCDAWFimYTyeJL+LQXTsKz+/mv5cHw6l2Cc=
 6-github.com/picosh/utils v0.0.0-20241117203114-3decbe6f0cec/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
 7-github.com/picosh/utils v0.0.0-20241117214552-6372620615c4 h1:p+ZsJGcQWUnMY2O6621/vdXl0GLagli6VvMgFs0AAYI=
 8-github.com/picosh/utils v0.0.0-20241117214552-6372620615c4/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
 9+github.com/picosh/utils v0.0.0-20241117232851-a32d4675d449 h1:hXJPjYl0y9YD0EqqST3j4oqCEKQJzZwNTg/iHgD40wo=
10+github.com/picosh/utils v0.0.0-20241117232851-a32d4675d449/go.mod h1:HogYEyJ43IGXrOa3D/kjM1pkzNAyh+pejRyv8Eo//pk=
11 github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
12 github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
13 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
M pico/cli.go
+2, -1
 1@@ -89,7 +89,8 @@ func (c *Cmd) logs(ctx context.Context) error {
 2 		}
 3 
 4 		user := utils.AnyToStr(parsedData, "user")
 5-		if user == c.User.Name {
 6+		userId := utils.AnyToStr(parsedData, "userId")
 7+		if user == c.User.Name || userId == c.User.ID {
 8 			wish.Println(c.SshSession, line)
 9 		}
10 	}
M tui/logs/logs.go
+2, -1
 1@@ -189,7 +189,8 @@ func (m Model) connectLogs(sub chan map[string]any) tea.Cmd {
 2 			}
 3 
 4 			user := utils.AnyToStr(parsedData, "user")
 5-			if user == m.shared.User.Name {
 6+			userId := utils.AnyToStr(parsedData, "userId")
 7+			if user == m.shared.User.Name || userId == m.shared.User.ID {
 8 				sub <- parsedData
 9 			}
10 		}