repos / pico

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

commit
78af75d
parent
3c844e7
author
Antonio Mika
date
2022-08-26 17:52:18 +0000 UTC
Fixed image deletes from cms and fixed prose image uploads
4 files changed,  +36, -1
M lists/config.go
+8, -0
 1@@ -15,6 +15,10 @@ func NewConfigSite() *shared.ConfigSite {
 2 	port := shared.GetEnv("LISTS_WEB_PORT", "3000")
 3 	protocol := shared.GetEnv("LISTS_PROTOCOL", "https")
 4 	allowRegister := shared.GetEnv("LISTS_ALLOW_REGISTER", "1")
 5+	storageDir := shared.GetEnv("IMGS_STORAGE_DIR", ".storage")
 6+	minioURL := shared.GetEnv("MINIO_URL", "")
 7+	minioUser := shared.GetEnv("MINIO_ROOT_USER", "")
 8+	minioPass := shared.GetEnv("MINIO_ROOT_PASSWORD", "")
 9 	dbURL := shared.GetEnv("DATABASE_URL", "")
10 	subdomainsEnabled := false
11 	if subdomains == "1" {
12@@ -41,6 +45,10 @@ func NewConfigSite() *shared.ConfigSite {
13 			Port:          port,
14 			Protocol:      protocol,
15 			DbURL:         dbURL,
16+			StorageDir:    storageDir,
17+			MinioURL:      minioURL,
18+			MinioUser:     minioUser,
19+			MinioPass:     minioPass,
20 			Description:   "A microblog for your lists.",
21 			IntroText:     intro,
22 			Space:         "lists",
M pastes/config.go
+8, -0
 1@@ -16,6 +16,10 @@ func NewConfigSite() *shared.ConfigSite {
 2 	dbURL := shared.GetEnv("DATABASE_URL", "")
 3 	protocol := shared.GetEnv("PASTES_PROTOCOL", "https")
 4 	allowRegister := shared.GetEnv("PASTES_ALLOW_REGISTER", "1")
 5+	storageDir := shared.GetEnv("IMGS_STORAGE_DIR", ".storage")
 6+	minioURL := shared.GetEnv("MINIO_URL", "")
 7+	minioUser := shared.GetEnv("MINIO_ROOT_USER", "")
 8+	minioPass := shared.GetEnv("MINIO_ROOT_PASSWORD", "")
 9 	subdomainsEnabled := false
10 	if subdomains == "1" {
11 		subdomainsEnabled = true
12@@ -41,6 +45,10 @@ func NewConfigSite() *shared.ConfigSite {
13 			Protocol:      protocol,
14 			Email:         email,
15 			DbURL:         dbURL,
16+			StorageDir:    storageDir,
17+			MinioURL:      minioURL,
18+			MinioUser:     minioUser,
19+			MinioPass:     minioPass,
20 			Description:   "a pastebin for hackers.",
21 			IntroText:     intro,
22 			Space:         "pastes",
M prose/config.go
+8, -0
 1@@ -15,6 +15,10 @@ func NewConfigSite() *shared.ConfigSite {
 2 	port := shared.GetEnv("PROSE_WEB_PORT", "3000")
 3 	protocol := shared.GetEnv("PROSE_PROTOCOL", "https")
 4 	allowRegister := shared.GetEnv("PROSE_ALLOW_REGISTER", "1")
 5+	storageDir := shared.GetEnv("IMGS_STORAGE_DIR", ".storage")
 6+	minioURL := shared.GetEnv("MINIO_URL", "")
 7+	minioUser := shared.GetEnv("MINIO_ROOT_USER", "")
 8+	minioPass := shared.GetEnv("MINIO_ROOT_PASSWORD", "")
 9 	dbURL := shared.GetEnv("DATABASE_URL", "")
10 	subdomainsEnabled := false
11 	if subdomains == "1" {
12@@ -41,6 +45,10 @@ func NewConfigSite() *shared.ConfigSite {
13 			Port:          port,
14 			Protocol:      protocol,
15 			DbURL:         dbURL,
16+			StorageDir:    storageDir,
17+			MinioURL:      minioURL,
18+			MinioUser:     minioUser,
19+			MinioPass:     minioPass,
20 			Description:   "a blog platform for hackers.",
21 			IntroText:     intro,
22 			Space:         "prose",
M wish/cms/ui/posts/posts.go
+12, -1
 1@@ -331,10 +331,21 @@ func (m Model) fetchPosts(userID string) tea.Cmd {
 2 
 3 func removePost(m Model) tea.Cmd {
 4 	return func() tea.Msg {
 5-		err := m.dbpool.RemovePosts([]string{m.posts[m.getSelectedIndex()].ID})
 6+		bucket, err := m.st.UpsertBucket(m.user.ID)
 7 		if err != nil {
 8 			return errMsg{err}
 9 		}
10+
11+		err = m.st.DeleteFile(bucket, m.posts[m.getSelectedIndex()].Filename)
12+		if err != nil {
13+			return errMsg{err}
14+		}
15+
16+		err = m.dbpool.RemovePosts([]string{m.posts[m.getSelectedIndex()].ID})
17+		if err != nil {
18+			return errMsg{err}
19+		}
20+
21 		return removePostMsg(m.index)
22 	}
23 }