remove blog

This commit is contained in:
JurajKubrican
2024-12-30 13:51:34 +01:00
parent f9ba885019
commit 6a5a9dad90
4 changed files with 1 additions and 118 deletions

View File

@@ -3,7 +3,6 @@ package main
import (
"html/template"
"io"
"net/http"
"strconv"
"strings"
"sync"
@@ -11,7 +10,6 @@ import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/gommon/log"
"github.com/russross/blackfriday/v2"
"golang.org/x/net/websocket"
)
@@ -39,20 +37,11 @@ func newPage(boxes map[int]bool) Page {
}
}
type Article struct {
Content template.HTML
}
func newArticle(content template.HTML) Article {
return Article{
Content: content,
}
}
var (
wsConnections = make(map[*websocket.Conn]bool)
wsMutex sync.Mutex
boxes = make(map[int]bool, 1000)
e = echo.New()
)
func broadcastMessage(message string) {
@@ -67,7 +56,6 @@ func broadcastMessage(message string) {
}
func main() {
e := echo.New()
e.Renderer = NewTemplates()
e.Logger.SetLevel(log.DEBUG)
@@ -86,19 +74,6 @@ func main() {
return c.Render(200, "index", page)
})
e.GET("/blog", func(c echo.Context) error {
// Log a test message
e.Logger.Info("Test log: /we-are-here endpoint called")
msg := getNotes(c, e.Logger)
e.Logger.Info(msg)
htmlContent := blackfriday.Run([]byte(msg))
article := newArticle(template.HTML(string(htmlContent)))
return c.Render(http.StatusOK, "article", article)
})
e.GET("/ws", initWs)
e.Logger.Fatal(e.Start(":54321"))

View File

@@ -1,35 +0,0 @@
package main
import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/labstack/echo/v4"
)
func getNotes(c echo.Context, logger echo.Logger) string {
// Load the Shared AWS Configuration (~/.aws/config)
cfg, err := config.LoadDefaultConfig(c.Request().Context(), config.WithRegion("eu-west-1"))
if err != nil {
logger.Fatal(err)
}
// Create an Amazon S3 service client with the specified endpoint
client := s3.NewFromConfig(cfg)
// Get the first page of results for ListObjectsV2 for a bucket
output, err := client.ListObjectsV2(c.Request().Context(), &s3.ListObjectsV2Input{
Bucket: aws.String("obsidian-notes-jurajk"),
Prefix: aws.String("pub"),
})
if err != nil {
logger.Fatal(err)
}
logger.Info("first page results:")
for _, object := range output.Contents {
logger.Printf("key=%s size=%d", aws.ToString(object.Key), object.Size)
}
return "success"
}