+1
.gitignore
+1
.gitignore
···
1
+
leaflet-hugo-sync
+16
.leaflet-sync.yaml
+16
.leaflet-sync.yaml
···
1
+
source:
2
+
handle: "marius.bsky.social"
3
+
collection: "com.whtwnd.blog.entry"
4
+
5
+
output:
6
+
posts_dir: "content/posts/leaflet"
7
+
images_dir: "static/images/leaflet"
8
+
image_path_prefix: "/images/leaflet"
9
+
10
+
template:
11
+
frontmatter: |
12
+
---
13
+
title: "{{ .Title }}"
14
+
date: {{ .CreatedAt }}
15
+
original_url: "https://leaflet.pub/{{ .Handle }}/{{ .Slug }}"
16
+
---
+57
README.md
+57
README.md
···
1
+
# leaflet-hugo-sync
2
+
3
+
A CLI tool to hydrate Hugo blogs with content hosted on Leaflet (via AT Protocol).
4
+
5
+
## Features
6
+
7
+
- **Configurable Mapping**: Use a YAML config file to define source and output paths.
8
+
- **Rich Text to Markdown**: Converts Leaflet blog entries to Hugo-compatible Markdown.
9
+
- **Image Mirroring**: Automatically downloads image blobs and updates paths.
10
+
- **Customizable Frontmatter**: Use Go templates to define your Hugo frontmatter.
11
+
12
+
## Installation
13
+
14
+
```bash
15
+
go install github.com/marius/leaflet-hugo-sync/cmd/leaflet-hugo-sync@latest
16
+
```
17
+
18
+
## Configuration
19
+
20
+
Create a `.leaflet-sync.yaml` in your Hugo project root:
21
+
22
+
```yaml
23
+
source:
24
+
handle: "yourname.bsky.social"
25
+
collection: "com.whtwnd.blog.entry"
26
+
27
+
output:
28
+
posts_dir: "content/posts/leaflet"
29
+
images_dir: "static/images/leaflet"
30
+
image_path_prefix: "/images/leaflet"
31
+
32
+
template:
33
+
frontmatter: |
34
+
---
35
+
title: "{{ .Title }}"
36
+
date: {{ .CreatedAt }}
37
+
original_url: "https://leaflet.pub/{{ .Handle }}/{{ .Slug }}"
38
+
---
39
+
```
40
+
41
+
## Usage
42
+
43
+
Run the tool from your Hugo project root:
44
+
45
+
```bash
46
+
leaflet-hugo-sync
47
+
```
48
+
49
+
You can specify a custom config path:
50
+
51
+
```bash
52
+
leaflet-hugo-sync -config my-config.yaml
53
+
```
54
+
55
+
## License
56
+
57
+
MIT
+93
cmd/leaflet-hugo-sync/main.go
+93
cmd/leaflet-hugo-sync/main.go
···
1
+
package main
2
+
3
+
import (
4
+
"context"
5
+
"encoding/json"
6
+
"flag"
7
+
"fmt"
8
+
"log"
9
+
"strings"
10
+
11
+
"github.com/marius/leaflet-hugo-sync/internal/atproto"
12
+
"github.com/marius/leaflet-hugo-sync/internal/config"
13
+
"github.com/marius/leaflet-hugo-sync/internal/generator"
14
+
"github.com/marius/leaflet-hugo-sync/internal/media"
15
+
)
16
+
17
+
func lastPathPart(uri string) string {
18
+
parts := strings.Split(uri, "/")
19
+
return parts[len(parts)-1]
20
+
}
21
+
22
+
func main() {
23
+
configPath := flag.String("config", ".leaflet-sync.yaml", "Path to config file")
24
+
flag.Parse()
25
+
26
+
cfg, err := config.LoadConfig(*configPath)
27
+
if err != nil {
28
+
log.Fatalf("failed to load config: %v", err)
29
+
}
30
+
31
+
ctx := context.Background()
32
+
client := atproto.NewClient("")
33
+
34
+
did, err := client.ResolveHandle(ctx, cfg.Source.Handle)
35
+
if err != nil {
36
+
log.Fatalf("failed to resolve handle: %v", err)
37
+
}
38
+
39
+
fmt.Printf("Resolved %s to %s\n", cfg.Source.Handle, did)
40
+
41
+
records, err := client.FetchEntries(ctx, did, cfg.Source.Collection)
42
+
if err != nil {
43
+
log.Fatalf("failed to fetch entries: %v", err)
44
+
}
45
+
46
+
fmt.Printf("Found %d entries\n", len(records))
47
+
48
+
downloader := media.NewDownloader(cfg.Output.ImagesDir, cfg.Output.ImagePathPrefix, client.XRPC.Host)
49
+
gen := generator.NewGenerator(cfg)
50
+
51
+
for _, rec := range records {
52
+
var entry atproto.BlogEntry
53
+
valBytes, _ := json.Marshal(rec.Value)
54
+
if err := json.Unmarshal(valBytes, &entry); err != nil {
55
+
fmt.Printf("Failed to unmarshal record %s: %v\n", rec.Uri, err)
56
+
continue
57
+
}
58
+
59
+
if entry.Slug == "" {
60
+
entry.Slug = lastPathPart(rec.Uri)
61
+
}
62
+
63
+
fmt.Printf("Processing: %s\n", entry.Title)
64
+
65
+
// Handle images
66
+
if entry.Embed != nil && len(entry.Embed.Images) > 0 {
67
+
imageMarkdown := "\n\n"
68
+
for _, img := range entry.Embed.Images {
69
+
localPath, err := downloader.DownloadBlob(ctx, did, img.Image.Ref.Link)
70
+
if err != nil {
71
+
fmt.Printf(" Failed to download image: %v\n", err)
72
+
continue
73
+
}
74
+
imageMarkdown += fmt.Sprintf("\n", img.Alt, localPath)
75
+
}
76
+
entry.Content += imageMarkdown
77
+
}
78
+
79
+
postData := generator.PostData{
80
+
Title: entry.Title,
81
+
CreatedAt: entry.CreatedAt,
82
+
Slug: entry.Slug,
83
+
Handle: cfg.Source.Handle,
84
+
Content: entry.Content,
85
+
}
86
+
87
+
if err := gen.GeneratePost(postData); err != nil {
88
+
fmt.Printf(" Failed to generate post: %v\n", err)
89
+
}
90
+
}
91
+
92
+
fmt.Println("Done!")
93
+
}
+57
go.mod
+57
go.mod
···
1
+
module github.com/marius/leaflet-hugo-sync
2
+
3
+
go 1.25.5
4
+
5
+
require (
6
+
github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36
7
+
gopkg.in/yaml.v3 v3.0.1
8
+
)
9
+
10
+
require (
11
+
github.com/earthboundkid/versioninfo/v2 v2.24.1 // indirect
12
+
github.com/felixge/httpsnoop v1.0.4 // indirect
13
+
github.com/go-logr/logr v1.4.1 // indirect
14
+
github.com/go-logr/stdr v1.2.2 // indirect
15
+
github.com/gogo/protobuf v1.3.2 // indirect
16
+
github.com/google/uuid v1.4.0 // indirect
17
+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
18
+
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
19
+
github.com/hashicorp/golang-lru v1.0.2 // indirect
20
+
github.com/ipfs/bbloom v0.0.4 // indirect
21
+
github.com/ipfs/go-block-format v0.2.0 // indirect
22
+
github.com/ipfs/go-cid v0.4.1 // indirect
23
+
github.com/ipfs/go-datastore v0.6.0 // indirect
24
+
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
25
+
github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect
26
+
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
27
+
github.com/ipfs/go-ipld-cbor v0.1.0 // indirect
28
+
github.com/ipfs/go-ipld-format v0.6.0 // indirect
29
+
github.com/ipfs/go-log v1.0.5 // indirect
30
+
github.com/ipfs/go-log/v2 v2.5.1 // indirect
31
+
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
32
+
github.com/jbenet/goprocess v0.1.4 // indirect
33
+
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
34
+
github.com/mattn/go-isatty v0.0.20 // indirect
35
+
github.com/minio/sha256-simd v1.0.1 // indirect
36
+
github.com/mr-tron/base58 v1.2.0 // indirect
37
+
github.com/multiformats/go-base32 v0.1.0 // indirect
38
+
github.com/multiformats/go-base36 v0.2.0 // indirect
39
+
github.com/multiformats/go-multibase v0.2.0 // indirect
40
+
github.com/multiformats/go-multihash v0.2.3 // indirect
41
+
github.com/multiformats/go-varint v0.0.7 // indirect
42
+
github.com/opentracing/opentracing-go v1.2.0 // indirect
43
+
github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f // indirect
44
+
github.com/spaolacci/murmur3 v1.1.0 // indirect
45
+
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e // indirect
46
+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
47
+
go.opentelemetry.io/otel v1.21.0 // indirect
48
+
go.opentelemetry.io/otel/metric v1.21.0 // indirect
49
+
go.opentelemetry.io/otel/trace v1.21.0 // indirect
50
+
go.uber.org/atomic v1.11.0 // indirect
51
+
go.uber.org/multierr v1.11.0 // indirect
52
+
go.uber.org/zap v1.26.0 // indirect
53
+
golang.org/x/crypto v0.21.0 // indirect
54
+
golang.org/x/sys v0.22.0 // indirect
55
+
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
56
+
lukechampine.com/blake3 v1.2.1 // indirect
57
+
)
+217
go.sum
+217
go.sum
···
1
+
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2
+
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
3
+
github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36 h1:0biH9kLhFMnTDdyJN+e+D+Hb4eZ7P5K66iiqWwyZzYE=
4
+
github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36/go.mod h1:KIy0FgNQacp4uv2Z7xhNkV3qZiUSGuRky97s7Pa4v+o=
5
+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
6
+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7
+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
8
+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9
+
github.com/earthboundkid/versioninfo/v2 v2.24.1 h1:SJTMHaoUx3GzjjnUO1QzP3ZXK6Ee/nbWyCm58eY3oUg=
10
+
github.com/earthboundkid/versioninfo/v2 v2.24.1/go.mod h1:VcWEooDEuyUJnMfbdTh0uFN4cfEIg+kHMuWB2CDCLjw=
11
+
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
12
+
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
13
+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
14
+
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
15
+
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
16
+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
17
+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
18
+
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
19
+
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
20
+
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
21
+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
22
+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
23
+
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
24
+
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
25
+
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
26
+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
27
+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
28
+
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
29
+
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
30
+
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
31
+
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
32
+
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
33
+
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
34
+
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
35
+
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
36
+
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
37
+
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
38
+
github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs=
39
+
github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM=
40
+
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
41
+
github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
42
+
github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk=
43
+
github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8=
44
+
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
45
+
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
46
+
github.com/ipfs/go-ipfs-blockstore v1.3.1 h1:cEI9ci7V0sRNivqaOr0elDsamxXFxJMMMy7PTTDQNsQ=
47
+
github.com/ipfs/go-ipfs-blockstore v1.3.1/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE=
48
+
github.com/ipfs/go-ipfs-ds-help v1.1.1 h1:B5UJOH52IbcfS56+Ul+sv8jnIV10lbjLF5eOO0C66Nw=
49
+
github.com/ipfs/go-ipfs-ds-help v1.1.1/go.mod h1:75vrVCkSdSFidJscs8n4W+77AtTpCIAdDGAwjitJMIo=
50
+
github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0=
51
+
github.com/ipfs/go-ipfs-util v0.0.3/go.mod h1:LHzG1a0Ig4G+iZ26UUOMjHd+lfM84LZCrn17xAKWBvs=
52
+
github.com/ipfs/go-ipld-cbor v0.1.0 h1:dx0nS0kILVivGhfWuB6dUpMa/LAwElHPw1yOGYopoYs=
53
+
github.com/ipfs/go-ipld-cbor v0.1.0/go.mod h1:U2aYlmVrJr2wsUBU67K4KgepApSZddGRDWBYR0H4sCk=
54
+
github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U=
55
+
github.com/ipfs/go-ipld-format v0.6.0/go.mod h1:g4QVMTn3marU3qXchwjpKPKgJv+zF+OlaKMyhJ4LHPg=
56
+
github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8=
57
+
github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo=
58
+
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
59
+
github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY=
60
+
github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI=
61
+
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
62
+
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
63
+
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
64
+
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
65
+
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
66
+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
67
+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
68
+
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
69
+
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
70
+
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
71
+
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
72
+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
73
+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
74
+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
75
+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
76
+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
77
+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
78
+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
79
+
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
80
+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
81
+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
82
+
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
83
+
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
84
+
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
85
+
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
86
+
github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE=
87
+
github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI=
88
+
github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0=
89
+
github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4=
90
+
github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g=
91
+
github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk=
92
+
github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U=
93
+
github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM=
94
+
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
95
+
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
96
+
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
97
+
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
98
+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
99
+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
100
+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
101
+
github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f h1:VXTQfuJj9vKR4TCkEuWIckKvdHFeJH/huIFJ9/cXOB0=
102
+
github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw=
103
+
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
104
+
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
105
+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
106
+
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
107
+
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
108
+
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
109
+
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
110
+
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
111
+
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
112
+
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
113
+
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
114
+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
115
+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
116
+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
117
+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
118
+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
119
+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
120
+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
121
+
github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
122
+
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ=
123
+
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
124
+
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e h1:28X54ciEwwUxyHn9yrZfl5ojgF4CBNLWX7LR0rvBkf4=
125
+
github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
126
+
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
127
+
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
128
+
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
129
+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24=
130
+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo=
131
+
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
132
+
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
133
+
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
134
+
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
135
+
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
136
+
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
137
+
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
138
+
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
139
+
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
140
+
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
141
+
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
142
+
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
143
+
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
144
+
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
145
+
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
146
+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
147
+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
148
+
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
149
+
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
150
+
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
151
+
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
152
+
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
153
+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
154
+
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
155
+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
156
+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
157
+
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
158
+
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
159
+
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
160
+
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
161
+
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
162
+
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
163
+
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
164
+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
165
+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
166
+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
167
+
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
168
+
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
169
+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
170
+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
171
+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
172
+
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
173
+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
174
+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
175
+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
176
+
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177
+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
178
+
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
179
+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
180
+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
181
+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
182
+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
183
+
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
184
+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
185
+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
186
+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
187
+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
188
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
189
+
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
190
+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
191
+
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
192
+
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
193
+
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
194
+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
195
+
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
196
+
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
197
+
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
198
+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
199
+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
200
+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
201
+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
202
+
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
203
+
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
204
+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
205
+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
206
+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
207
+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
208
+
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
209
+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
210
+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
211
+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
212
+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
213
+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
214
+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
215
+
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
216
+
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
217
+
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
+53
internal/atproto/client.go
+53
internal/atproto/client.go
···
1
+
package atproto
2
+
3
+
import (
4
+
"context"
5
+
"fmt"
6
+
7
+
"github.com/bluesky-social/indigo/api/atproto"
8
+
"github.com/bluesky-social/indigo/xrpc"
9
+
)
10
+
11
+
type Client struct {
12
+
XRPC *xrpc.Client
13
+
}
14
+
15
+
func NewClient(pdsHost string) *Client {
16
+
if pdsHost == "" {
17
+
pdsHost = "https://bsky.social"
18
+
}
19
+
return &Client{
20
+
XRPC: &xrpc.Client{
21
+
Host: pdsHost,
22
+
},
23
+
}
24
+
}
25
+
26
+
func (c *Client) ResolveHandle(ctx context.Context, handle string) (string, error) {
27
+
out, err := atproto.IdentityResolveHandle(ctx, c.XRPC, handle)
28
+
if err != nil {
29
+
return "", fmt.Errorf("resolving handle: %w", err)
30
+
}
31
+
return out.Did, nil
32
+
}
33
+
34
+
func (c *Client) FetchEntries(ctx context.Context, repo string, collection string) ([]*atproto.RepoListRecords_Record, error) {
35
+
var records []*atproto.RepoListRecords_Record
36
+
cursor := ""
37
+
38
+
for {
39
+
out, err := atproto.RepoListRecords(ctx, c.XRPC, collection, cursor, 100, repo, false)
40
+
if err != nil {
41
+
return nil, fmt.Errorf("listing records: %w", err)
42
+
}
43
+
44
+
records = append(records, out.Records...)
45
+
46
+
if out.Cursor == nil || *out.Cursor == "" {
47
+
break
48
+
}
49
+
cursor = *out.Cursor
50
+
}
51
+
52
+
return records, nil
53
+
}
+65
internal/atproto/types.go
+65
internal/atproto/types.go
···
1
+
package atproto
2
+
3
+
type Entry struct {
4
+
Content string `json:"content"`
5
+
Title string `json:"title"`
6
+
CreatedAt string `json:"createdAt"`
7
+
// RichText facets might be here if it's using standard RT,
8
+
// but WhiteWind usually stores Markdown in 'content'
9
+
// and facets in a separate field if applicable.
10
+
// Actually, WhiteWind uses Markdown.
11
+
}
12
+
13
+
type BlogEntry struct {
14
+
Content string `json:"content"`
15
+
Title string `json:"title"`
16
+
Slug string `json:"slug"`
17
+
CreatedAt string `json:"createdAt"`
18
+
Facets []Facet `json:"facets,omitempty"`
19
+
Tags []string `json:"tags,omitempty"`
20
+
Embed *Embed `json:"embed,omitempty"`
21
+
}
22
+
23
+
type Embed struct {
24
+
Type string `json:"$type"`
25
+
Images []ImageEmbed `json:"images,omitempty"`
26
+
External *ExternalEmbed `json:"external,omitempty"`
27
+
}
28
+
29
+
type ImageEmbed struct {
30
+
Image Blob `json:"image"`
31
+
Alt string `json:"alt"`
32
+
}
33
+
34
+
type ExternalEmbed struct {
35
+
Uri string `json:"uri"`
36
+
Title string `json:"title"`
37
+
Description string `json:"description"`
38
+
Thumb *Blob `json:"thumb,omitempty"`
39
+
}
40
+
41
+
type Blob struct {
42
+
Ref BlobRef `json:"ref"`
43
+
Mime string `json:"mimeType"`
44
+
Size int `json:"size"`
45
+
}
46
+
47
+
type BlobRef struct {
48
+
Link string `json:"$link"`
49
+
}
50
+
51
+
type Facet struct {
52
+
Index Features `json:"index"`
53
+
Features []Feature `json:"features"`
54
+
}
55
+
56
+
type Features struct {
57
+
ByteStart int `json:"byteStart"`
58
+
ByteEnd int `json:"byteEnd"`
59
+
}
60
+
61
+
type Feature struct {
62
+
Type string `json:"$type"`
63
+
URI string `json:"uri,omitempty"`
64
+
Did string `json:"did,omitempty"`
65
+
}
+44
internal/config/config.go
+44
internal/config/config.go
···
1
+
package config
2
+
3
+
import (
4
+
"os"
5
+
6
+
"gopkg.in/yaml.v3"
7
+
)
8
+
9
+
type Config struct {
10
+
Source Source `yaml:"source"`
11
+
Output Output `yaml:"output"`
12
+
Template Template `yaml:"template"`
13
+
}
14
+
15
+
type Source struct {
16
+
Handle string `yaml:"handle"`
17
+
Collection string `yaml:"collection"`
18
+
}
19
+
20
+
type Output struct {
21
+
PostsDir string `yaml:"posts_dir"`
22
+
ImagesDir string `yaml:"images_dir"`
23
+
ImagePathPrefix string `yaml:"image_path_prefix"`
24
+
}
25
+
26
+
type Template struct {
27
+
Frontmatter string `yaml:"frontmatter"`
28
+
}
29
+
30
+
func LoadConfig(path string) (*Config, error) {
31
+
f, err := os.Open(path)
32
+
if err != nil {
33
+
return nil, err
34
+
}
35
+
defer f.Close()
36
+
37
+
var cfg Config
38
+
decoder := yaml.NewDecoder(f)
39
+
if err := decoder.Decode(&cfg); err != nil {
40
+
return nil, err
41
+
}
42
+
43
+
return &cfg, nil
44
+
}
+42
internal/config/config_test.go
+42
internal/config/config_test.go
···
1
+
package config
2
+
3
+
import (
4
+
"os"
5
+
"testing"
6
+
)
7
+
8
+
func TestLoadConfig(t *testing.T) {
9
+
content := `
10
+
source:
11
+
handle: "test.bsky.social"
12
+
collection: "com.whtwnd.blog.entry"
13
+
output:
14
+
posts_dir: "content/posts"
15
+
images_dir: "static/images"
16
+
image_path_prefix: "/images"
17
+
template:
18
+
frontmatter: |
19
+
---
20
+
title: "{{ .Title }}"
21
+
---
22
+
`
23
+
tmpfile, err := os.CreateTemp("", "config*.yaml")
24
+
if err != nil {
25
+
t.Fatal(err)
26
+
}
27
+
defer os.Remove(tmpfile.Name())
28
+
29
+
if _, err := tmpfile.Write([]byte(content)); err != nil {
30
+
t.Fatal(err)
31
+
}
32
+
tmpfile.Close()
33
+
34
+
cfg, err := LoadConfig(tmpfile.Name())
35
+
if err != nil {
36
+
t.Fatalf("LoadConfig failed: %v", err)
37
+
}
38
+
39
+
if cfg.Source.Handle != "test.bsky.social" {
40
+
t.Errorf("expected test.bsky.social, got %s", cfg.Source.Handle)
41
+
}
42
+
}
+51
internal/generator/hugo.go
+51
internal/generator/hugo.go
···
1
+
package generator
2
+
3
+
import (
4
+
"bytes"
5
+
"os"
6
+
"path/filepath"
7
+
"text/template"
8
+
9
+
"github.com/marius/leaflet-hugo-sync/internal/config"
10
+
)
11
+
12
+
type Generator struct {
13
+
Cfg *config.Config
14
+
}
15
+
16
+
type PostData struct {
17
+
Title string
18
+
CreatedAt string
19
+
Slug string
20
+
Handle string
21
+
Content string
22
+
Data map[string]interface{}
23
+
}
24
+
25
+
func NewGenerator(cfg *config.Config) *Generator {
26
+
return &Generator{Cfg: cfg}
27
+
}
28
+
29
+
func (g *Generator) GeneratePost(data PostData) error {
30
+
tmpl, err := template.New("frontmatter").Parse(g.Cfg.Template.Frontmatter)
31
+
if err != nil {
32
+
return err
33
+
}
34
+
35
+
var buf bytes.Buffer
36
+
if err := tmpl.Execute(&buf, data); err != nil {
37
+
return err
38
+
}
39
+
40
+
if err := os.MkdirAll(g.Cfg.Output.PostsDir, 0755); err != nil {
41
+
return err
42
+
}
43
+
44
+
fileName := data.Slug + ".md"
45
+
filePath := filepath.Join(g.Cfg.Output.PostsDir, fileName)
46
+
47
+
fullContent := buf.String() + "\n" + data.Content
48
+
49
+
return os.WriteFile(filePath, []byte(fullContent), 0644)
50
+
}
51
+
+52
internal/generator/hugo_test.go
+52
internal/generator/hugo_test.go
···
1
+
package generator
2
+
3
+
import (
4
+
"os"
5
+
"path/filepath"
6
+
"testing"
7
+
8
+
"github.com/marius/leaflet-hugo-sync/internal/config"
9
+
)
10
+
11
+
func TestGeneratePost(t *testing.T) {
12
+
tmpDir, err := os.MkdirTemp("", "output")
13
+
if err != nil {
14
+
t.Fatal(err)
15
+
}
16
+
defer os.RemoveAll(tmpDir)
17
+
18
+
cfg := &config.Config{
19
+
Output: config.Output{
20
+
PostsDir: filepath.Join(tmpDir, "posts"),
21
+
},
22
+
Template: config.Template{
23
+
Frontmatter: "---\ntitle: \"{{ .Title }}\"\n---",
24
+
},
25
+
}
26
+
27
+
gen := NewGenerator(cfg)
28
+
data := PostData{
29
+
Title: "Hello World",
30
+
Slug: "hello-world",
31
+
Content: "This is a test post.",
32
+
}
33
+
34
+
if err := gen.GeneratePost(data); err != nil {
35
+
t.Fatalf("GeneratePost failed: %v", err)
36
+
}
37
+
38
+
expectedPath := filepath.Join(tmpDir, "posts", "hello-world.md")
39
+
if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
40
+
t.Errorf("expected file %s to exist", expectedPath)
41
+
}
42
+
43
+
content, err := os.ReadFile(expectedPath)
44
+
if err != nil {
45
+
t.Fatal(err)
46
+
}
47
+
48
+
expectedContent := "---\ntitle: \"Hello World\"\n---\nThis is a test post."
49
+
if string(content) != expectedContent {
50
+
t.Errorf("expected content %q, got %q", expectedContent, string(content))
51
+
}
52
+
}
+86
internal/media/downloader.go
+86
internal/media/downloader.go
···
1
+
package media
2
+
3
+
import (
4
+
"context"
5
+
"fmt"
6
+
"io"
7
+
"net/http"
8
+
"os"
9
+
"path/filepath"
10
+
)
11
+
12
+
type Downloader struct {
13
+
ImagesDir string
14
+
ImagePathPrefix string
15
+
PDSHost string
16
+
}
17
+
18
+
func NewDownloader(imagesDir, imagePathPrefix, pdsHost string) *Downloader {
19
+
return &Downloader{
20
+
ImagesDir: imagesDir,
21
+
ImagePathPrefix: imagePathPrefix,
22
+
PDSHost: pdsHost,
23
+
}
24
+
}
25
+
26
+
func (d *Downloader) DownloadBlob(ctx context.Context, did string, cid string) (string, error) {
27
+
// Construct blob URL
28
+
// https://bsky.social/xrpc/com.atproto.sync.getBlob?did=did:plc:xxx&cid=bafyxxx
29
+
url := fmt.Sprintf("%s/xrpc/com.atproto.sync.getBlob?did=%s&cid=%s", d.PDSHost, did, cid)
30
+
31
+
if err := os.MkdirAll(d.ImagesDir, 0755); err != nil {
32
+
return "", err
33
+
}
34
+
35
+
ext := ".bin" // Default, should ideally check MIME
36
+
fileName := cid + ext
37
+
filePath := filepath.Join(d.ImagesDir, fileName)
38
+
39
+
// Check if already exists
40
+
if _, err := os.Stat(filePath); err == nil {
41
+
return filepath.Join(d.ImagePathPrefix, fileName), nil
42
+
}
43
+
44
+
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
45
+
if err != nil {
46
+
return "", err
47
+
}
48
+
49
+
resp, err := http.DefaultClient.Do(req)
50
+
if err != nil {
51
+
return "", err
52
+
}
53
+
defer resp.Body.Close()
54
+
55
+
if resp.StatusCode != http.StatusOK {
56
+
return "", fmt.Errorf("failed to download blob: %s", resp.Status)
57
+
}
58
+
59
+
// Try to guess extension from Content-Type
60
+
contentType := resp.Header.Get("Content-Type")
61
+
switch contentType {
62
+
case "image/jpeg":
63
+
ext = ".jpg"
64
+
case "image/png":
65
+
ext = ".png"
66
+
case "image/webp":
67
+
ext = ".webp"
68
+
case "image/gif":
69
+
ext = ".gif"
70
+
}
71
+
fileName = cid + ext
72
+
filePath = filepath.Join(d.ImagesDir, fileName)
73
+
74
+
out, err := os.Create(filePath)
75
+
if err != nil {
76
+
return "", err
77
+
}
78
+
defer out.Close()
79
+
80
+
_, err = io.Copy(out, resp.Body)
81
+
if err != nil {
82
+
return "", err
83
+
}
84
+
85
+
return filepath.Join(d.ImagePathPrefix, fileName), nil
86
+
}