git-pr
created pr with
16.1
added 16.2
1: 3bd44da ! 1: 9002592 chore(pgs): add validation to project names
added 16.3
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
-: ------- > 2: cd17cf4 chore: update pobj
-: ------- > 3: a00def2 chore: complete impl
changed pr name to
feat: private obj store service
added 16.4
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
2: cd17cf4 = 2: cd17cf4 chore: update pobj
3: a00def2 = 3: a00def2 chore: complete impl
-: ------- > 4: 0ed7dc9 chore: update pobj
-: ------- > 5: 8ff1131 working!
added 16.5
1: 9002592 = 1: 9002592 chore(pgs): add validation to project names
2: cd17cf4 = 2: cd17cf4 chore: update pobj
3: a00def2 = 3: a00def2 chore: complete impl
4: 0ed7dc9 = 4: 0ed7dc9 chore: update pobj
5: 8ff1131 = 5: 8ff1131 working!
-: ------- > 6: 0c8ad0d chore(obj): prep service def
cmds
checkout latest patchset:
ssh pr.pico.sh print 16 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 16.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 16
Patchset
16.4
chore: complete impl
Eric Bower
2024-08-18T16:02:22ZSemantic diff summary
1 added,
3 modified,
2 signature changed,
0 removed
across 2 analyzed files
+7
-0
cmd/obj/ssh/main.go
#
+15
-13
obj/ssh.go
#
| ... | ... | @@ -20,19 +20,20 @@ import ( | |
| 20 | 20 | "github.com/picosh/send/send/utils" | |
| 21 | 21 | ) | |
| 22 | 22 | ||
| 23 | - | type AssetNamesPriv struct { | |
| 24 | - | DBPool db.DB | |
| 25 | - | } | |
| 23 | + | type AssetNamesPriv struct{} | |
| 26 | 24 | ||
| 27 | 25 | var _ pobj.AssetNames = &AssetNamesPriv{} | |
| 28 | 26 | var _ pobj.AssetNames = (*AssetNamesPriv)(nil) | |
| 29 | 27 | ||
| 30 | - | func (an *AssetNamesPriv) BucketName(userName string) string { | |
| 31 | - | user, _ := an.DBPool.FindUserForName(userName) | |
| 32 | - | return shared.GetAssetBucketName(user.ID) | |
| 28 | + | func (an *AssetNamesPriv) BucketName(sesh ssh.Session) (string, error) { | |
| 29 | + | user, err := util.GetUser(sesh.Context()) | |
| 30 | + | if err != nil { | |
| 31 | + | return "", err | |
| 32 | + | } | |
| 33 | + | return shared.GetAssetBucketName(user.ID), nil | |
| 33 | 34 | } | |
| 34 | - | func (an *AssetNamesPriv) ObjectName(entry *utils.FileEntry) string { | |
| 35 | - | return filepath.Join("pico-private", entry.Filepath) | |
| 35 | + | func (an *AssetNamesPriv) ObjectName(sesh ssh.Session, entry *utils.FileEntry) (string, error) { | |
| 36 | + | return filepath.Join("/pico-private", entry.Filepath), nil | |
| 36 | 37 | } | |
| 37 | 38 | ||
| 38 | 39 | func StartSshServer() { |
| ... | ... | @@ -50,10 +51,12 @@ func StartSshServer() { | |
| 50 | 51 | } else { | |
| 51 | 52 | st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass) | |
| 52 | 53 | } | |
| 53 | - | ||
| 54 | - | assetNames := &AssetNamesPriv{ | |
| 55 | - | DBPool: dbpool, | |
| 54 | + | if err != nil { | |
| 55 | + | logger.Error(err.Error()) | |
| 56 | + | return | |
| 56 | 57 | } | |
| 58 | + | ||
| 59 | + | assetNames := &AssetNamesPriv{} | |
| 57 | 60 | objcfg := &pobj.Config{ | |
| 58 | 61 | Logger: logger, | |
| 59 | 62 | Storage: st, |