diff options
| author | 2026-04-15 16:11:51 +0700 | |
|---|---|---|
| committer | 2026-04-15 16:11:51 +0700 | |
| commit | 66b2a96fcca113105043be3cb9c49f8ee7fe240c (patch) | |
| tree | 04a9d8b816f6507076bf778769f7990bf153fce4 /internal/blog/client.go | |
| parent | a3aa1dd07abfbbb27a7dfeeb536a6fcc51709256 (diff) | |
| download | web-66b2a96fcca113105043be3cb9c49f8ee7fe240c.tar.gz web-66b2a96fcca113105043be3cb9c49f8ee7fe240c.zip | |
feat: support s3 for blog pages
refactor: make blog client an interface
feat: claude.md
Diffstat (limited to 'internal/blog/client.go')
| -rw-r--r-- | internal/blog/client.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/blog/client.go b/internal/blog/client.go new file mode 100644 index 0000000..56bbee4 --- /dev/null +++ b/internal/blog/client.go @@ -0,0 +1,27 @@ +package blog + +import ( + "time" + + "github.com/SayaAndy/saya-today-web/config" + "github.com/SayaAndy/saya-today-web/internal/frontmatter" +) + +type Page struct { + Link string + FileName string + Lang string + ModifiedTime time.Time + Metadata *frontmatter.Metadata +} + +type Client interface { + Scan(prefix string) ([]*Page, error) + ReadAll(path string) ([]byte, error) + ReadFrontmatter(path string) (metadata *frontmatter.Metadata, markdown []byte, err error) +} + +var NewClientMap = map[string]func(*config.StorageConfig) (Client, error){ + "b2": NewB2Client, + "s3": NewS3Client, +} |