git-pr

created pr with 16.1 on 2024-08-18T15:28:14Z · by c8ef7d19
added 16.2 on 2024-08-18T15:31:36Z · by c8ef7d19
1: 3bd44da ! 1: 9002592 chore(pgs): add validation to project names
added 16.3 on 2024-08-18T16:05:53Z · by c8ef7d19
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 on 2024-08-18T16:06:30Z · by c8ef7d19
added 16.4 on 2024-08-18T16:39:07Z · by c8ef7d19
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 on 2024-08-19T02:01:34Z · by c8ef7d19
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 -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 16.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 16
+7 -0 cmd/obj/ssh/main.go #
......@@ -0,0 +1,7 @@
1+package main
2+
3+import "github.com/picosh/pico/obj"
4+
5+func main() {
6+ obj.StartSshServer()
7+}
+15 -13 obj/ssh.go #
......@@ -10,8 +10,8 @@ import (
1010 "syscall"
1111 "time"
1212
13+ "github.com/charmbracelet/ssh"
1314 "github.com/charmbracelet/wish"
14- "github.com/picosh/pico/db"
1515 "github.com/picosh/pico/db/postgres"
1616 "github.com/picosh/pico/filehandlers/util"
1717 "github.com/picosh/pico/shared"
......@@ -20,19 +20,20 @@ import (
2020 "github.com/picosh/send/send/utils"
2121 )
2222
23-type AssetNamesPriv struct {
24- DBPool db.DB
25-}
23+type AssetNamesPriv struct{}
2624
2725 var _ pobj.AssetNames = &AssetNamesPriv{}
2826 var _ pobj.AssetNames = (*AssetNamesPriv)(nil)
2927
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
3334 }
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
3637 }
3738
3839 func StartSshServer() {
......@@ -50,10 +51,12 @@ func StartSshServer() {
5051 } else {
5152 st, err = storage.NewStorageMinio(cfg.MinioURL, cfg.MinioUser, cfg.MinioPass)
5253 }
53-
54- assetNames := &AssetNamesPriv{
55- DBPool: dbpool,
54+ if err != nil {
55+ logger.Error(err.Error())
56+ return
5657 }
58+
59+ assetNames := &AssetNamesPriv{}
5760 objcfg := &pobj.Config{
5861 Logger: logger,
5962 Storage: st,
......@@ -61,7 +64,6 @@ func StartSshServer() {
6164 }
6265
6366 handler := pobj.NewUploadAssetHandler(objcfg)
64-
6567 sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
6668 s, err := wish.NewServer(
6769 wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
Back to top